blobtest

package
v0.0.0-...-74fe3af Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package blobtest contains helpers for interacting with value separation and blob files in tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlobHandle

func IsBlobHandle(input string) bool

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(fileNum base.DiskFileNum) 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) Fetch

func (bv *Values) Fetch(
	ctx context.Context, handleSuffix []byte, blobFileNum base.DiskFileNum, valLen uint32, _ []byte,
) (val []byte, callerOwned bool, err error)

Fetch returns the value corresponding to the given handle.

func (*Values) Parse

func (bv *Values) Parse(input string) (h blob.Handle, remaining string, err error)

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.

Jump to

Keyboard shortcuts

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