Help us shape the future of Go! Take the 2026 Go Developer Survey

keys

package
v1.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MetadataPrefix is the prefix for user metadata keys stored in RocksDB.
	// This ensures user keys have their own namespace separate from internal keys.
	// Uses the same format as other internal keys (starting with !)
	MetadataPrefix = "!meta/"

	// AccessBucketPrefix is the prefix for time-bucketed access index entries
	// Format: !access_bucket/YYYYMMDDHH/timestamp_nano/key
	AccessBucketPrefix = "!access_bucket/"

	// AccessBucketFormat is the time format for bucket keys (YYYYMMDDHH)
	AccessBucketFormat = "2006010215"

	// AccessBucketIndexPrefix is the prefix for the secondary index mapping keys to their bucket location
	// Format: !bucket_index/<key> -> bucketed_key
	AccessBucketIndexPrefix = "!access_bucket_index/"

	// CompactionIndexPrefix is the prefix for all compaction index entries in RocksDB
	CompactionIndexPrefix = "!compact/"

	// CompactionIndexKeyFormat is the format for compaction index keys
	// Format: !compact/<timestamp>|<userKey>
	CompactionIndexKeyFormat = "!compact/%020d|%s"

	// SyncIndexPrefix is the prefix for all sync tracking entries in RocksDB
	SyncIndexPrefix = "!sync/"

	// DeletionQueuePrefix is the prefix for deletion queue entries in RocksDB
	DeletionQueuePrefix = "!del/"

	// DeleteIndexPrefix is the prefix for segment deletion tracking entries in RocksDB
	DeleteIndexPrefix = "!delete:segment/"

	// FifoIndexPrefix is the prefix for the FIFO eviction index. Entries embed the
	// write time in the key so the eviction scan can walk them oldest-written
	// first. Unlike the access index, entries are written once at Put and never
	// bumped on reads.
	// Format: !fifo/<write_time_nano>/<key>
	FifoIndexPrefix = "!fifo/"

	// FifoBackrefPrefix is the prefix for the FIFO secondary index that maps a
	// cache key to its current FIFO entry, mirroring the LRU access index's
	// secondary index. It lets Put/Delete/TTL locate and remove a key's previous
	// FIFO entry so the index holds exactly one entry per live key.
	// Format: !fifo_ref/<key> -> !fifo/<nano>/<key>
	FifoBackrefPrefix = "!fifo_ref/"
)

Variables

This section is empty.

Functions

func ExtractAccessBucketFromKey

func ExtractAccessBucketFromKey(key []byte) string

ExtractAccessBucketFromKey extracts just the bucket portion from a full key Returns empty string if not a valid bucketed key

func ExtractSegmentPath

func ExtractSegmentPath(deleteIndexKey []byte) string

ExtractSegmentPath extracts the segment path from a delete index key

func ExtractUserKey

func ExtractUserKey(metadataKey []byte) string

ExtractUserKey removes the metadata prefix from a metadata key to get the original user key

func GetBucketedAccessKey

func GetBucketedAccessKey(timestamp time.Time) string

GetBucketedAccessKey returns the bucket key for a given timestamp Format: !access_bucket/YYYYMMDDHH/

func GetFifoIndexPrefix added in v1.8.0

func GetFifoIndexPrefix() []byte

GetFifoIndexPrefix returns the prefix used to iterate FIFO index entries (oldest first, since the write-time nanos sort lexicographically).

func IsBucketedAccessKey

func IsBucketedAccessKey(key []byte) bool

IsBucketedAccessKey checks if a key is a bucketed access index key

func IsDeleteIndexKey

func IsDeleteIndexKey(key []byte) bool

IsDeleteIndexKey checks if a key is a delete index entry

func IsDeletionQueueKey

func IsDeletionQueueKey(key []byte) bool

IsDeletionQueueKey checks if a key is a deletion queue entry

func IsInternalKey

func IsInternalKey(key []byte) bool

IsInternalKey checks if a given key is an internal system key (starts with !)

func IsMetadataKey

func IsMetadataKey(key []byte) bool

IsMetadataKey checks if a given key is a user metadata key (has the metadata prefix)

func IsSyncKey

func IsSyncKey(key []byte) bool

IsSyncKey checks if a key is a sync index entry

func MakeBucketedAccessIndexKey

func MakeBucketedAccessIndexKey(key string) []byte

MakeBucketedAccessIndexKey creates a secondary index key that maps a cache key to its current bucket location Format: !bucket_index/<key>

func MakeBucketedAccessKey

func MakeBucketedAccessKey(key string, accessTime time.Time) []byte

MakeBucketedAccessKey creates a bucketed access index key Format: !access_bucket/YYYYMMDDHH/timestamp_nano/key

func MakeCompactionKey

func MakeCompactionKey(ts int64, key string) []byte

MakeCompactionKey creates a compaction key by adding the compaction prefix to the user key

func MakeDeleteIndexKey

func MakeDeleteIndexKey(segmentPath string) []byte

MakeDeleteIndexKey creates a delete index key for tracking segment deletions

func MakeDeletionQueueKey

func MakeDeletionQueueKey(timestamp int64, filepath string) []byte

MakeDeletionQueueKey creates a deletion queue key for a file Format: !del/<timestamp>/<filepath>

func MakeFifoBackrefKey added in v1.8.0

func MakeFifoBackrefKey(key string) []byte

MakeFifoBackrefKey creates the FIFO secondary-index key mapping a cache key to its current FIFO entry. Format: !fifo_ref/<key>

func MakeFifoIndexKey added in v1.8.0

func MakeFifoIndexKey(key string, writeTime time.Time) []byte

MakeFifoIndexKey creates a FIFO eviction index key that embeds the write time so entries sort oldest-written first. Format: !fifo/<write_time_nano>/<key>

func MakeMetadataKey

func MakeMetadataKey(userKey string) []byte

MakeMetadataKey creates a metadata key by adding the metadata prefix to the user key

func MakeSyncKey

func MakeSyncKey(filepath string) []byte

MakeSyncKey creates a sync index key for a file

func ParseBucketedAccessKey

func ParseBucketedAccessKey(bucketedKey []byte) (string, time.Time, error)

ParseBucketedAccessKey extracts components from a bucketed access key Returns: original key, access time, error

func ParseCompactionIndexRow

func ParseCompactionIndexRow(k, v []byte) (userKey, filePath string, ok bool)

ParseCompactionIndexRow extracts userKey, filePath and size from RocksDB file-index key/value pairs. Returns ok=false when the row does not follow the expected format.

func ParseDeletionQueueKey

func ParseDeletionQueueKey(key []byte) (int64, string, error)

ParseDeletionQueueKey extracts timestamp and filepath from a deletion queue key

func ParseFifoIndexKey added in v1.8.0

func ParseFifoIndexKey(fifoKey []byte) (string, error)

ParseFifoIndexKey extracts the original user key from a FIFO index key. Format: !fifo/<19-digit nano>/<key>

func ParseSyncKey

func ParseSyncKey(key []byte) (int64, string, error)

ParseSyncKey extracts timestamp and filepath from a sync key

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL