package
23.2.20+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
Package pebbleiter exposes a type that selectively wraps a Pebble Iterator only in crdb_test builds.

# Functions

Attributes configures the engine's attributes.
BallastSize sets the amount reserved by a ballast file for manual out-of-disk recovery.
BallastSizeBytes returns the desired size of the emergency ballast, calculated from the provided store spec and disk usage.
BatchCount provides an efficient way to get the count of mutations in a batch representation.
BlockConcurrencyLimitDivisor sets the divisor used to calculate the block load concurrency limit: the current value of the BlockLoadConcurrencyLimit setting divided by the divisor.
BlockSize sets the engine block size, primarily for testing purposes.
Caches sets the block and table caches.
CacheSize configures the size of the block cache.
CanGCEntireRange checks if a span of keys doesn't contain any live data and all data is covered by range tombstones at or below provided threshold.
CanUseMVCCRangeTombstones returns true if the caller can begin writing MVCC range tombstones, by setting DeleteRangeRequest.UseRangeTombstone.
CheckNoRegistryFile checks that no registry file currently exists.
CheckSSTConflicts iterates over an SST and a Reader in lockstep and errors out if it finds any conflicts.
ClearRangeWithHeuristic clears the keys from start (inclusive) to end (exclusive), including any range keys, but does not clear intents unless the lock table is targeted explicitly.
CombineOptions combines many options into one.
ComputeStats scans the given key span and computes MVCC stats.
ComputeStatsForIter is like ComputeStats, but scans across the given iterator until exhausted.
ComputeStatsWithVisitors is like ComputeStats, but also takes callbacks that are invoked on each key.
DecodeEngineKey decodes the given bytes as an EngineKey.
DecodeMVCCKey decodes an MVCCKey from its Pebble representation.
DecodeMVCCTimestampSuffix decodes an MVCC timestamp from its Pebble representation, including the length suffix.
DecodeMVCCValue decodes an MVCCKey from its Pebble representation.
DecodeMVCCValueAndErr is a helper that can be called using the ([]byte, error) pair returned from the iterator UnsafeValue(), Value() methods.
DefaultPebbleOptions returns the default pebble options.
DisableMetamorphicLockTableItersBeforeSeek disables the metamorphic value for the duration of a test, resetting it at the end.
DisableMetamorphicSimpleValueEncoding disables the disableSimpleValueEncoding metamorphic bool for the duration of a test, resetting it at the end.
DisableOpLogger disables op logging for the given read/writer.
EncodedMVCCKeyPrefixLength returns the encoded length of a roachpb.Key prefix including the sentinel byte.
EncodedMVCCTimestampSuffixLength returns the encoded length of the given MVCC timestamp, including the length suffix.
EncodedMVCCValueIsTombstone is faster than decoding a MVCCValue and then calling MVCCValue.IsTombstone.
EncodeMVCCKey encodes an MVCCKey into its Pebble representation.
EncodeMVCCKeyPrefix encodes an MVCC user key (without timestamp) into its Pebble prefix representation.
EncodeMVCCKeyToBuf encodes an MVCCKey into its Pebble representation, reusing the given byte buffer if it has sufficient capacity.
EncodeMVCCTimestampSuffix encodes an MVCC timestamp into its Pebble representation, including the length suffix but excluding the sentinel byte.
EncodeMVCCTimestampToBuf encodes an MVCC timestamp into its Pebble representation, excluding the length suffix and sentinel byte, reusing the given byte slice if it has sufficient capacity.
EncodeMVCCValue encodes an MVCCValue into its Pebble representation.
EncryptionAtRest configures an engine to use encryption-at-rest.
EngineKeyCompare compares cockroach keys, including the version (which could be MVCC timestamps).
EngineKeyEqual checks for equality of cockroach keys, including the version (which could be MVCC timestamps).
Filesystem constructs a Location that instructs the storage engine to read and store data on the filesystem in the provided directory.
FingerprintRangekeys iterates over the provided SSTs, that are expected to contain only rangekeys, and maintains a XOR aggregate of each rangekey's fingerprint.
GetIntent will look up an intent given a key.
GetKeyPartFromEngineKey is a specialization of DecodeEngineKey which avoids constructing a slice for the version part of the key, since the caller does not need it.
Hook configures a hook to initialize additional storage options.
If enables the given option if enable is true.
IncludeStartKeyIntoErr wraps with the given error to include the provided start key of the scan as an additional detail.
InMemFromFS allocates and returns new, opened in-memory engine.
InMemory constructs a Location that instructs the storage engine to store data in-memory.
IsDiskFull examines the store indicated by spec, determining whether the store's underlying disk is out of disk space.
IsValidSplitKey returns whether the key is a valid split key.
MakeBackupSSTWriter creates a new SSTWriter tailored for backup SSTs which are typically only ever iterated in their entirety.
MakeExternalStorageWrapper returns a remote.Storage implementation that wraps cloud.ExternalStorage.
MakeIngestionSSTWriter creates a new SSTWriter tailored for ingestion SSTs.
MakeIngestionWriterOptions returns writer options suitable for writing SSTs that will subsequently be ingested (e.g.
MakeLocation constructs a Location from a directory and a vfs.FS.
MakeMVCCMetadataKey creates an MVCCKey from a roachpb.Key.
MakeSingleEngineReplicasStorage constructs a ReplicasStorage where the same Engine contains the the raft log and the state machine.
MakeValue returns the inline value.
MaxConcurrentCompactions configures the maximum number of concurrent compactions an Engine will execute.
MaxOpenFiles sets the maximum number of files an engine should open.
MaxSizeBytes ets the intended maximum store size as an absolute byte value.
MaxSizePercent ets the intended maximum store size as the specified percentage of total capacity.
MaxWriterConcurrency sets the concurrency of the sstable Writers.
MergeInternalTimeSeriesData exports the engine's MVCC merge logic for InternalTimeSeriesData to higher level packages.
MinVersionIsAtLeastTargetVersion returns whether the min version recorded on disk is at least the target version.
MVCCAcquireLock attempts to acquire a lock at the specified key and strength by the specified transaction.
MVCCBlindConditionalPut is a fast-path of MVCCConditionalPut.
MVCCBlindInitPut is a fast-path of MVCCInitPut.
MVCCBlindPut is a fast-path of MVCCPut.
MVCCBlindPutInlineWithPrev updates an inline value using a blind put when the previous value is known.
MVCCBlindPutProto sets the given key to the protobuf-serialized byte string of msg and the provided timestamp.
MVCCCheckForAcquireLock scans the replicated lock table to determine whether a lock acquisition at the specified key and strength by the specified transaction would succeed.
MVCCClearTimeRange clears all MVCC versions (point keys and range keys) within the span [key, endKey) which have timestamps in the span (startTime, endTime].
MVCCConditionalPut sets the value for a specified key only if the expected value matches.
MVCCDelete marks the key deleted so that it will not be returned in future get responses.
MVCCDeleteRange deletes the range of key/value pairs specified by start and end keys.
MVCCDeleteRangeUsingTombstone deletes the given MVCC keyspan at the given timestamp using an MVCC range tombstone (rather than MVCC point tombstones).
MVCCExportFingerprint exports a fingerprint for point keys in the keyrange [StartKey, EndKey) over the interval (StartTS, EndTS].
MVCCExportToSST exports changes to the keyrange [StartKey, EndKey) over the interval (StartTS, EndTS] as a Pebble SST.
MVCCFindSplitKey finds a key from the given span such that the left side of the split is roughly targetSize bytes.
MVCCFirstSplitKey returns the first key which is safe to split at and no less than desiredSplitKey in the range which spans [startKey,endKey).
MVCCGarbageCollect creates an iterator on the ReadWriter.
MVCCGarbageCollectPointsWithClearRange removes garbage collected points data within range [start@startTimestamp, endTimestamp).
MVCCGarbageCollectRangeKeys is similar in functionality to MVCCGarbageCollect but operates on range keys.
MVCCGarbageCollectWholeRange removes all the range data and resets counters.
MVCCGet returns a MVCCGetResult.
MVCCGetAsTxn constructs a temporary transaction from the given transaction metadata and calls MVCCGet as that transaction.
MVCCGetProto fetches the value at the specified key and unmarshals it into msg if msg is non-nil.
MVCCGetWithValueHeader is like MVCCGet, but in addition returns the MVCCValueHeader for the value.
MVCCIncrement fetches the value for key, and assuming the value is an "integer" type, increments it by inc and stores the new value.
MVCCInitPut sets the value for a specified key if the key doesn't exist.
MVCCIsSpanEmpty returns true if there are no MVCC keys whatsoever in the key span in the requested time interval.
MVCCIterate iterates over the key range [start,end).
MVCCLookupRangeKeyValue reads the value header for a range deletion on [key,endKey) at the specified timestamp.
MVCCMerge implements a merge operation.
MVCCPaginate iteratively invokes f() with the current maxKeys and targetBytes limits.
MVCCPredicateDeleteRange issues MVCC tombstones at endTime to live keys within the span [startKey, endKey) that also have MVCC versions that match the predicate filters.
MVCCPut sets the value for a specified key.
MVCCPutProto sets the given key to the protobuf-serialized byte string of msg and the provided timestamp.
MVCCResolveWriteIntent either commits, aborts (rolls back), or moves forward in time an extant write intent for a given txn according to commit parameter.
MVCCResolveWriteIntentRange commits or aborts (rolls back) the range of write intents specified by start and end keys for a given txn.
MVCCScan scans the key range [key, endKey) in the provided reader up to some maximum number of results in ascending order.
MVCCScanAsTxn constructs a temporary transaction from the given transaction metadata and calls MVCCScan as that transaction.
MVCCScanDecodeKeyValue decodes a key/value pair returned in an MVCCScan "batch" (this is not the RocksDB batch repr format), returning both the key/value and the suffix of data remaining in the batch.
MVCCScanDecodeKeyValues decodes all key/value pairs returned in one or more MVCCScan "batches" (this is not the RocksDB batch repr format).
MVCCScanToBytes is like MVCCScan, but it returns the results in a byte array.
MVCCScanToCols is like MVCCScan, but it returns KVData in a serialized columnar batch suitable for reading by colserde.RecordBatchDeserializer.
NewBatchReader creates a BatchReader from the given batch repr and verifies the header.
NewDefaultInMemForTesting allocates and returns a new, opened in-memory engine with the default configuration.
NewLockTableIterator creates a new LockTableIterator.
NewMemSSTIterator returns an MVCCIterator for the provided SST data, similarly to NewSSTIterator().
NewMultiMemSSTIterator returns an MVCCIterator for the provided SST data, similarly to NewSSTIterator().
NewMVCCIncrementalIterator creates an MVCCIncrementalIterator with the specified reader and options.
NewOpLoggerBatch creates a new batch that logs logical mvcc operations and wraps the provided batch.
NewPebble creates a new Pebble instance, at the specified path.
NewPebbleTempEngine creates a new Pebble engine for DistSQL processors to use when the working set is larger than can be stored in memory.
NewReadAsOfIterator constructs a ReadAsOfIterator.
NewSSTEngineIterator is like NewSSTIterator, but returns an EngineIterator.
NewSSTIterator returns an MVCCIterator for the provided "levels" of SST files.
NewTempEngine creates a new engine for DistSQL processors to use when the working set is larger than can be stored in memory.
Open opens a new Pebble storage engine, reading and writing data to the provided Location, configured with the provided options.
PebbleOptions contains Pebble-specific options in the same format as a Pebble OPTIONS file.
PeekRangeKeysLeft peeks for any range keys to the left of the given key.
PeekRangeKeysRight peeks for any range keys to the right of the given key.
RemoteStorageFactory enables use of remote storage (experimental).
ReplacePointTombstonesWithRangeTombstones will replace existing point tombstones with equivalent point-sized range tombstones in the given span, updating stats as needed.
ResolveEncryptedEnvOptions creates the EncryptionEnv and associated file registry if this store has encryption-at-rest enabled; otherwise returns a nil EncryptionEnv.
Scan returns up to max point key/value objects from start (inclusive) to end (non-inclusive).
ScanConflictingIntentsForDroppingLatchesEarly scans intents using only the separated intents lock table on behalf of a batch request trying to drop its latches early.
ScanLocks scans locks (shared, exclusive, and intent) using only the lock table keyspace.
SecondaryCache enables use of a secondary cache to store shared objects.
SecondaryCacheBytes returns the desired size of the secondary cache, calculated from the provided store spec and disk usage.
SharedStorage enables use of shared storage (experimental).
ShouldUseEFOS returns true if either of the UseEFOS or UseExciseForSnapshots cluster settings are enabled, and EventuallyFileOnlySnapshots must be used to guarantee snapshot-like semantics.
TargetFileSize sets the target file size across all levels of the LSM, primarily for testing purposes.
UpdateSSTTimestamps replaces all MVCC timestamp in the provided SST to the given timestamp.
UpdateStatsOnRangeKeySplit updates MVCCStats for the split/fragmentation of a range key stack at a given split key.
WriteSyncNoop carries out a synchronous no-op write to the engine.

# Constants

CPutAllowIfMissing is used to indicate a CPut can also succeed when the expected entry does not exist.
CPutFailIfMissing is used to indicate the existing value must match the expected value exactly i.e.
DeletedReplica is a replica with neither raft state or state machine.
GuaranteedDurability is an advanced option (only for raftLogTruncator).
InitializedStateMachine is a replica with both raft state and state machine.
IterKeyTypePointsAndRanges iterates over both point and range keys.
IterKeyTypePointsOnly iterates over point keys only.
IterKeyTypeRangesOnly iterates over only range keys.
MaxArrayLen is a safe maximum length for slices on this architecture.
MaxConflictsPerLockConflictErrorDefault is the default value for maximum number of locks reported by ExportToSST and Scan operations in LockConflictError is set to half of the maximum lock table size.
MinimumMaxOpenFiles is the minimum value that RocksDB's max_open_files option can be set to.
MinimumSupportedFormatVersion is the version that provides features that the Cockroach code relies on unconditionally (like range keys).
MinVersionFilename is the name of the file containing a marshaled roachpb.Version that can be updated during storage-related migrations and checked on startup to determine if we can safely use a backwards-incompatible feature.
MVCCAbortIntentOpType corresponds to the MVCCAbortIntentOp variant.
MVCCCommitIntentOpType corresponds to the MVCCCommitIntentOp variant.
MVCCDecodingNotRequired is used when timestamps aren't needed.
MVCCDecodingRequired is used when timestamps are needed.
MVCCDeleteRangeOpType corresponds to the MVCCDeleteRangeOp variant.
MVCCIncrementalIterIntentPolicyAggregate will not fail on first encountered intent, but will proceed further.
MVCCIncrementalIterIntentPolicyEmit will return intents to the caller if they are inside or outside the time range.
MVCCIncrementalIterIntentPolicyError will immediately return an error for any intent found inside the given time range.
MVCCKeyAndIntentsIterKind specifies that intents must be seen, and appear interleaved with keys, even if they are in a separated lock table.
MVCCKeyIterKind specifies that the caller does not need to see intents.
MVCCUpdateIntentOpType corresponds to the MVCCUpdateIntentOp variant.
MVCCVersionTimestampSize is the size of the timestamp portion of MVCC version keys (used to update stats).
MVCCWriteIntentOpType corresponds to the MVCCWriteIntentOp variant.
MVCCWriteValueOpType corresponds to the MVCCWriteValueOp variant.
RecommendedMaxOpenFiles is the recommended value for RocksDB's max_open_files option.
StandardDurability is what should normally be used.
UninitializedStateMachine is a replica with raft state but no state machine.

# Variables

BlockLoadConcurrencyLimit controls the maximum number of outstanding filesystem read operations for loading sstable blocks.
CanRegistryElideFunc is a function that returns true for entries that can be elided instead of being written to the registry.
ConfigureForSharedStorage is used to configure a pebble Options for shared storage.
DefaultNumOldFileRegistryFiles is the default number of old registry files kept for debugging.
DefaultStorageEngine represents the default storage engine to use.
DisableAutomaticCompactions configures an engine to be opened with disabled automatic compactions.
DisableCheckSSTRangeKeyMasking forcibly disables CheckSSTConflicts range key masking.
EngineComparer is a pebble.Comparer object that implements MVCC-specific comparator settings for use with Pebble.
ForceWriterParallelism configures an engine to be opened with disabled automatic compactions.
ForTesting configures the engine for use in testing.
GetCFetcherWrapper returns a CFetcherWrapper.
IngestAsFlushable controls whether ingested sstables that overlap the memtable may be lazily ingested: written to the WAL and enqueued in the list of flushables (eg, memtables, large batches and now lazily-ingested sstables).
IngestSplitEnabled controls whether ingest-time splitting is enabled in Pebble.
LocalTimestampsEnabled controls whether local timestamps are written in MVCC values.
MaxConflictsPerLockConflictError sets maximum number of locks returned in LockConflictError in operations that return multiple locks per error.
Default maximum wait time before an EventuallyFileOnlySnapshot transitions to a file-only snapshot.
MaxSyncDuration is the threshold above which an observed engine sync duration triggers either a warning or a fatal error.
MaxSyncDurationFatalOnExceeded governs whether disk stalls longer than MaxSyncDuration fatal the Cockroach process.
MustExist configures an engine to error on Open if the target directory does not contain an initialized store.
MVCCKeyMax sorts after all other MVCC keys.
MVCCMerger is a pebble.Merger object that implements the merge operator used by Cockroach.
MVCCRangeTombstonesEnabledInMixedClusters enables writing of MVCC range tombstones.
NewEncryptedEnvFunc creates an encrypted environment and returns the vfs.FS to use for reading and writing data.
NilKey is the nil MVCCKey.
PebbleBlockPropertyCollectors is the list of functions to construct BlockPropertyCollectors.
ReadOnly configures an engine to be opened in read-only mode.
No description provided by the author
No description provided by the author
UseEFOS controls whether uses of pebble Snapshots should use EventuallyFileOnlySnapshots instead.
UseExciseForSnapshots controls whether virtual-sstable-based excises should be used instead of range deletions for clearing out replica contents as part of a rebalance/recovery snapshot application.
ValueBlocksEnabled controls whether older versions of MVCC keys in the same sstable will have their values written to value blocks.
WorkloadCollectorEnabled specifies if the workload collector will be enabled.

# Structs

AggregatedBatchCommitStats hold cumulative stats summed over all the batches that committed at the engine.
AggregatedIteratorStats holds cumulative stats, collected and summed over all of an engine's iterators.
No description provided by the author
BatchReader is used to iterate the entries in a Pebble batch representation.
ClearOptions holds optional parameters to methods that clear keys from the storage engine.
CloneContext is an opaque type encapsulating sufficient context to construct a clone of an existing iterator.
CollectableGCRangeKey is a struct containing range key as well as span boundaries locked for particular range key.
ComputeStatsVisitors holds a set of callbacks that are invoked on each key during stats computation.
EncryptionEnv describes the encryption-at-rest environment, providing access to a filesystem with on-the-fly encryption.
EncryptionRegistries contains the encryption-related registries: Both are serialized protobufs.
EngineKey is the general key type that is stored in the engine.
EngineKeyFormatter is a fmt.Formatter for EngineKeys.
EngineKeyRange is a key range composed of EngineKeys.
EngineRangeKeyValue is a raw value for a general range key as stored in the engine.
EnvStats is a set of RocksDB env stats, including encryption status.
ExceedMaxSizeError is the error returned when an export request fails due the export size exceeding the budget.
No description provided by the author
FullReplicaID is a fully-qualified replica ID.
IteratorStats is returned from {MVCCIterator,EngineIterator}.Stats.
IterOptions contains options used to create an {MVCC,Engine}Iterator.
A Location describes where the storage engine's data will be written.
LockTableIterator is an EngineIterator that iterates over locks in the lock table keyspace.
LockTableIteratorOptions contains options used to create a LockTableIterator.
LockTableKey is a key representing a lock in the lock table.
MemObject is an in-memory implementation of objstorage.Writable, intended use with SSTWriter.
Metrics is a set of Engine metrics.
MetricsForInterval is a set of pebble.Metrics that need to be saved in order to compute metrics according to an interval.
No description provided by the author
MVCCExportOptions contains options for MVCCExportToSST.
MVCCGetOptions bundles options for the MVCCGet family of functions.
MVCCGetResult bundles return values for the MVCCGet family of functions.
MVCCIncrementalIterator iterates over the diff of the key range [startKey,endKey) and time range (startTime,endTime].
MVCCIncrementalIterOptions bundles options for NewMVCCIncrementalIterator.
MVCCIsSpanEmptyOptions configures the MVCCIsSpanEmpty function.
MVCCKey is a versioned key, distinguished from roachpb.Key with the addition of a "version" timestamp.
MVCCKeyValue contains the raw bytes of the value for a key.
MVCCLogicalOpDetails contains details about the occurrence of an MVCC logical operation.
MVCCRangeKey is a versioned key span.
MVCCRangeKeyStack represents a stack of range key fragments as returned by SimpleMVCCIterator.RangeKeys().
MVCCRangeKeyValue contains the raw bytes of the value for a key.
MVCCRangeKeyVersion represents a single range key fragment version.
MVCCResolveWriteIntentOptions bundles options for the MVCCResolveWriteIntent function.
MVCCResolveWriteIntentRangeOptions bundles options for the MVCCResolveWriteIntentRange function.
MVCCScanOptions bundles options for the MVCCScan family of functions.
MVCCScanResult groups the values returned from an MVCCScan operation.
MVCCValue is a versioned value, stored at an associated MVCCKey with a non-zero version timestamp.
MVCCValueMerger implements the `ValueMerger` interface.
MVCCWriteOptions bundles options for the MVCCPut and MVCCDelete families of functions.
OpLoggerBatch records a log of logical MVCC operations.
Pebble is a wrapper around a Pebble database instance.
PebbleConfig holds all configuration parameters and knobs used in setting up a new Pebble instance.
PebbleFileRegistry keeps track of files for the data-FS and store-FS for Pebble (see encrypted_fs.go for high-level comment).
RaftMutationBatch specifies mutations to the raft log entries and/or HardState.
ReadAsOfIterator wraps a SimpleMVCCIterator and only surfaces the latest valid point key of a given MVCC key that is also below the asOf timestamp, if set.
ReplicaInfo provides the replica ID and state pair.
RowCounter is a helper that counts how many distinct rows appear in the KVs that is shown via `Count`.
SSTWriter writes SSTables.

# Interfaces

Batch is the interface for batch specific operations.
CFetcherWrapper is a wrapper around a colfetcher.cFetcher that populates only the needed (according to the fetchpb.IndexFetchSpec) vectors which are returned as coldata.Batch'es (either serialized or as is).
EncryptionStatsHandler provides encryption related stats.
Engine is the interface that wraps the core operations of a key/value store.
EngineIterator is an iterator over key-value pairs where the key is an EngineKey.
EventuallyFileOnlyReader is a specialized Reader that supports a method to wait on a transition to being a file-only reader that does not pin any keys in-memory.
ExportWriter is a trimmed down version of the Writer interface.
InternalWriter is an extension of Writer that supports additional low-level methods to operate on internal keys in Pebble.
LockTableView is a transaction-bound view into an in-memory collections of key-level locks.
MutationBatch can be committed to the underlying engine.
MVCCIterator is an interface for iterating over key/value pairs in an engine.
NextKVer can fetch a new KV from somewhere.
RangeStorage is a handle for a FullReplicaID that provides the ability to write to the raft state and state machine state.
Reader is the read interface to an engine's data.
ReadWriter is the read/write interface to an engine's data.
ReplicasStorage provides an interface to manage the persistent state of a store that includes the lifecycle of a range replica, its raft log, and the state machine state.
SimpleMVCCIterator is an interface for iterating over key/value pairs in an engine.
WriteBatch is the interface for write batch specific operations.
Writer is the write interface to an engine's data.

# Type aliases

A ConfigOption may be passed to Open to configure the storage engine.
CPutMissingBehavior describes the handling a non-existing expected value.
DurabilityRequirement is an advanced option.
FirstKeyOfRowGetter returns the first key included into the last incomplete SQL row by the user of NextKVer.
IterKeyType configures which types of keys an iterator should surface.
MVCCDecodingStrategy controls if and how the fetcher should decode MVCC timestamps from returned KV's.
MVCCIncrementalIterIntentPolicy controls how the MVCCIncrementalIterator will handle intents that it encounters when iterating.
MVCCIterKind is used to inform Reader about the kind of iteration desired by the caller.
MVCCLogicalOpType is an enum with values corresponding to each of the enginepb.MVCCLogicalOp variants.
MVCCRangeKeyVersions represents a stack of range key fragment versions.
ReplicaState represents the current state of a range replica in this store.