Documentation
¶
Overview ¶
Package blobtest contains helpers for interacting with value separation and blob files in tests.
Index ¶
- func IsBlobHandle(input string) bool
- type References
- type Values
- func (bv *Values) FetchHandle(ctx context.Context, handleSuffix []byte, blobFileID base.BlobFileID, ...) (val []byte, callerOwned bool, err error)
- func (bv *Values) Parse(input string) (h blob.Handle, remaining string, err error)
- func (bv *Values) ParseInlineHandle(input string) (h blob.InlineHandle, remaining string, err error)
- func (bv *Values) ParseInternalValue(input string) (base.InternalValue, error)
- func (bv *Values) WriteFiles(newBlobObject func(fileNum base.DiskFileNum) (objstorage.Writable, error), ...) (map[base.DiskFileNum]blob.FileWriterStats, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsBlobHandle ¶
IsBlobHandle returns true if the input string looks like it's a debug blob handle.
Types ¶
type References ¶
type References struct {
// contains filtered or unexported fields
}
References is a helper for tests that manually construct inline blob references. It tracks the set of file numbers used within a sstable, and maps each file number to a reference index (encoded within the blob.InlineHandlePreface).
func (*References) MapToReferenceID ¶
func (b *References) MapToReferenceID(fileID base.BlobFileID) blob.ReferenceID
MapToReferenceID maps the given file number to a reference ID.
type Values ¶
type Values struct { References References // contains filtered or unexported fields }
Values is a helper for using blob handles in tests. It supports parsing a human-readable string describing a blob handle, synthesizing unspecified fields, and tracking the blob handle to support future fetches.
func (*Values) FetchHandle ¶
func (bv *Values) FetchHandle( ctx context.Context, handleSuffix []byte, blobFileID base.BlobFileID, valLen uint32, _ []byte, ) (val []byte, callerOwned bool, err error)
FetchHandle returns the value corresponding to the given handle.
func (*Values) Parse ¶
Parse parses a debug blob handle from the string, returning the handle and recording the handle's corresponding value.
func (*Values) ParseInlineHandle ¶
func (bv *Values) ParseInlineHandle( input string, ) (h blob.InlineHandle, remaining string, err error)
ParseInlineHandle parses a debug blob handle from the string. It maps the file number to a reference index using the provided *BlobReferences, returning an inline handle.
It's intended for tests that must manually construct inline blob references.
func (*Values) ParseInternalValue ¶
func (bv *Values) ParseInternalValue(input string) (base.InternalValue, error)
ParseInternalValue parses a debug blob handle from the string, returning the handle as an InternalValue and recording the handle's corresponding value.
func (*Values) WriteFiles ¶
func (bv *Values) WriteFiles( newBlobObject func(fileNum base.DiskFileNum) (objstorage.Writable, error), writerOpts blob.FileWriterOptions, ) (map[base.DiskFileNum]blob.FileWriterStats, error)
WriteFiles writes all the blob files referenced by Values, using newBlobObject to construct new objects.
Return the FileWriterStats for the written blob files.