Module constants

Module constants 

Source
Expand description

Global constants and helpers for filenames/paths, networking defaults, compression, index settings, and position conversions

Constants§

BINARY_NAME
Binary name used in user agents and metadata
BUNDLE_SIZE
Number of operations per bundle
DEFAULT_HANDLE_RESOLVER_URL
Default handle resolver URL for AT Protocol handle resolution
DEFAULT_ORIGIN
Default origin identifier for local repositories
DEFAULT_PLC_DIRECTORY_URL
Default PLC directory URL
DEFAULT_RATE_LIMIT
Default rate limit for PLC API requests (requests per minute) Set to 80% of quota (72 req/min) to provide safety margin and prevent rate limiting
DID_INDEX_CONFIG
DID index config file name
DID_INDEX_DELTAS
DID index delta segments subdirectory name
DID_INDEX_DIR
DID index directory name (hidden directory in bundle repository)
DID_INDEX_FLUSH_INTERVAL
Default flush interval for DID index building (number of bundles before flushing to disk) A value of 0 means flush only at the end (maximum memory usage)
DID_INDEX_SHARDS
DID index shards subdirectory name
FRAME_SIZE
Number of operations per frame (for multi-frame compression)
HTTP_BUNDLE_TIMEOUT_SECS
HTTP request timeout for bundle fetching
HTTP_INDEX_TIMEOUT_SECS
HTTP request timeout for index fetching
HTTP_PING_TIMEOUT_SECS
HTTP request timeout for ping operations
HTTP_RESOLVER_TIMEOUT_SECS
HTTP request timeout for handle resolver
HTTP_TIMEOUT_SECS
Default HTTP request timeout
MEMPOOL_FILE_PREFIX
Mempool file prefix (e.g., “plc_mempool_000001.jsonl”)
MEMPOOL_STALE_THRESHOLD_SECS
Mempool file staleness threshold (1 hour in seconds)
MIN_BUNDLE_CREATION_INTERVAL_SECS
Minimum time between bundle creation attempts (60 seconds)
VERSION
Package version from Cargo.toml (set at compile time)
ZSTD_COMPRESSION_LEVEL
Zstd compression level (1 = fast, 3 = balanced, 19 = maximum)

Functions§

bundle_filename
Returns the canonical bundle filename for a bundle number
bundle_path
Resolves an on-disk bundle path relative to the provided directory
bundle_position_to_global
Calculate global position from bundle number and position within bundle Global position = ((bundle_number - 1) * BUNDLE_SIZE) + position
created_by
Returns the created_by string for bundle metadata
global_to_bundle_position
Convert global position to bundle number and position Returns (bundle_number, position) where bundle_number is 1-indexed and position is 0-indexed
mempool_position_to_global
Calculate global position for a mempool operation Global position = total_operations_from_bundles + mempool_position
total_operations_from_bundles
Calculate total number of operations from all bundles Total = last_bundle * BUNDLE_SIZE
user_agent
Returns the user agent string for HTTP requests