fs

package
v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Overview

Package fs is a generated GoMock package.

Index

Constants

View Source
const (
	// CheckpointFileSizeBytes is the expected size of a valid checkpoint file.
	CheckpointFileSizeBytes = 4
)

Variables

View Source
var (
	// ErrCheckpointFileNotFound returned when the checkpoint file doesn't exist
	ErrCheckpointFileNotFound = errors.New("checkpoint file does not exist")
)

Functions

func CommitLogFilePath

func CommitLogFilePath(prefix string, index int) string

CommitLogFilePath returns the path for a commitlog file.

func CommitLogsDirPath

func CommitLogsDirPath(prefix string) string

CommitLogsDirPath returns the path to commit logs.

func CompleteCheckpointFileExists

func CompleteCheckpointFileExists(filePath string) (bool, error)

CompleteCheckpointFileExists returns whether a checkpoint file exists, and if so, is it complete.

func DataDirPath

func DataDirPath(prefix string) string

DataDirPath returns the path to the data directory belonging to a db

func DataFileSetExists

func DataFileSetExists(
	filePathPrefix string,
	namespace ident.ID,
	shard uint32,
	blockStart time.Time,
	volume int,
) (bool, error)

DataFileSetExists determines whether data fileset files exist for the given namespace, shard, block start, and volume.

func DataFileSetsBefore

func DataFileSetsBefore(filePathPrefix string, namespace ident.ID, shard uint32, t time.Time) ([]string, error)

DataFileSetsBefore returns all the flush data fileset paths whose timestamps are earlier than a given time.

func DeleteDirectories

func DeleteDirectories(dirPaths []string) error

DeleteDirectories delets a set of directories and its contents, returning all of the errors encountered during the deletion process.

func DeleteFileSetAt

func DeleteFileSetAt(filePathPrefix string, namespace ident.ID, shard uint32, blockStart time.Time, volume int) error

DeleteFileSetAt deletes a FileSetFile for a given namespace/shard/blockStart/volume combination if it exists.

func DeleteFiles

func DeleteFiles(filePaths []string) error

DeleteFiles delete a set of files, returning all the errors encountered during the deletion process.

func DeleteInactiveDirectories

func DeleteInactiveDirectories(parentDirectoryPath string, activeDirectories []string) error

DeleteInactiveDirectories deletes any directories that are not currently active, as defined by the inputed active directories within the parent directory

func FileExists

func FileExists(filePath string) (bool, error)

FileExists returns whether a file at the given path exists.

func FilesBefore

func FilesBefore(files []string, t time.Time) ([]string, error)

FilesBefore filters the list of files down to those whose name indicate they are before a given time period. Mutates the provided slice.

func IndexFileSetsBefore

func IndexFileSetsBefore(filePathPrefix string, namespace ident.ID, t time.Time) ([]string, error)

IndexFileSetsBefore returns all the flush index fileset paths whose timestamps are earlier than a given time.

func NamespaceDataDirPath

func NamespaceDataDirPath(prefix string, namespace ident.ID) string

NamespaceDataDirPath returns the path to the data directory for a given namespace.

func NamespaceIndexDataDirPath

func NamespaceIndexDataDirPath(prefix string, namespace ident.ID) string

NamespaceIndexDataDirPath returns the path to the data directory for a given namespace.

func NamespaceIndexSnapshotDirPath

func NamespaceIndexSnapshotDirPath(prefix string, namespace ident.ID) string

NamespaceIndexSnapshotDirPath returns the path to the data directory for a given namespace.

func NamespaceSnapshotsDirPath

func NamespaceSnapshotsDirPath(prefix string, namespace ident.ID) string

NamespaceSnapshotsDirPath returns the path to the snapshots directory for a given namespace.

func NewPersistManager

func NewPersistManager(opts Options) (persist.Manager, error)

NewPersistManager creates a new filesystem persist manager

func NextIndexFileSetVolumeIndex

func NextIndexFileSetVolumeIndex(filePathPrefix string, namespace ident.ID, blockStart time.Time) (int, error)

NextIndexFileSetVolumeIndex returns the next index file set index for a given namespace/blockStart combination.

func NextIndexSnapshotFileIndex

func NextIndexSnapshotFileIndex(filePathPrefix string, namespace ident.ID, blockStart time.Time) (int, error)

NextIndexSnapshotFileIndex returns the next snapshot file index for a given namespace/shard/blockStart combination.

func NextSnapshotFileSetVolumeIndex

func NextSnapshotFileSetVolumeIndex(filePathPrefix string, namespace ident.ID, shard uint32, blockStart time.Time) (int, error)

NextSnapshotFileSetVolumeIndex returns the next snapshot file set index for a given namespace/shard/blockStart combination.

func NextSnapshotMetadataFileIndex

func NextSnapshotMetadataFileIndex(opts Options) (int64, error)

NextSnapshotMetadataFileIndex returns the next snapshot metadata file index.

func OpenWritable

func OpenWritable(filePath string, perm os.FileMode) (*os.File, error)

OpenWritable opens a file for writing and truncating as necessary.

func ReadIndexSegments

func ReadIndexSegments(
	opts ReadIndexSegmentsOptions,
) ([]segment.Segment, error)

ReadIndexSegments will read a set of segments.

func ShardDataDirPath

func ShardDataDirPath(prefix string, namespace ident.ID, shard uint32) string

ShardDataDirPath returns the path to the data directory for a given shard.

func ShardSnapshotsDirPath

func ShardSnapshotsDirPath(prefix string, namespace ident.ID, shard uint32) string

ShardSnapshotsDirPath returns the path to the snapshots directory for a given shard.

func SnapshotDirPath

func SnapshotDirPath(prefix string) string

SnapshotDirPath returns the path to the snapshot directory belong to a db

func SnapshotFileSetExistsAt

func SnapshotFileSetExistsAt(prefix string, namespace ident.ID, shard uint32, blockStart time.Time) (bool, error)

SnapshotFileSetExistsAt determines whether snapshot fileset files exist for the given namespace, shard, and block start time.

func SnapshotTimeAndID

func SnapshotTimeAndID(
	filePathPrefix string, id FileSetFileIdentifier) (time.Time, uuid.UUID, error)

SnapshotTimeAndID returns the metadata for the snapshot.

func SnapshotsDirPath

func SnapshotsDirPath(prefix string) string

SnapshotsDirPath returns the path to the snapshots directory.

func SortedCommitLogFiles

func SortedCommitLogFiles(commitLogsDir string) ([]string, error)

SortedCommitLogFiles returns all the commit log files in the commit logs directory.

func SortedSnapshotMetadataFiles

func SortedSnapshotMetadataFiles(opts Options) (
	[]SnapshotMetadata, []SnapshotMetadataErrorWithPaths, error)

SortedSnapshotMetadataFiles returns a slice of all the SnapshotMetadata files that are on disk, as well as any files that it encountered errors for (corrupt, missing checkpoints, etc) which facilitates cleanup of corrupt files. []SnapshotMetadata will be sorted by index (i.e the chronological order in which the snapshots were taken), but []SnapshotMetadataErrorWithPaths will not be in any particular order.

func TimeAndIndexFromCommitlogFilename

func TimeAndIndexFromCommitlogFilename(fname string) (time.Time, int, error)

TimeAndIndexFromCommitlogFilename extracts the block start and index from file name for a commitlog.

func TimeAndVolumeIndexFromDataFileSetFilename

func TimeAndVolumeIndexFromDataFileSetFilename(fname string) (time.Time, int, error)

TimeAndVolumeIndexFromDataFileSetFilename extracts the block start and volume index from a data fileset file name that may or may not have an index. If the file name does not include an index, unindexedFilesetIndex is returned as the volume index.

func TimeAndVolumeIndexFromFileSetFilename

func TimeAndVolumeIndexFromFileSetFilename(fname string) (time.Time, int, error)

TimeAndVolumeIndexFromFileSetFilename extracts the block start and volume index from an index file name.

func TimeFromFileName

func TimeFromFileName(fname string) (time.Time, error)

TimeFromFileName extracts the block start time from file name.

Types

type BlockRetrieverOptions

type BlockRetrieverOptions interface {
	// Validate validates the options.
	Validate() error

	// SetRetrieveRequestPool sets the retrieve request pool.
	SetRetrieveRequestPool(value RetrieveRequestPool) BlockRetrieverOptions

	// RetrieveRequestPool returns the retrieve request pool.
	RetrieveRequestPool() RetrieveRequestPool

	// SetBytesPool sets the bytes pool.
	SetBytesPool(value pool.CheckedBytesPool) BlockRetrieverOptions

	// BytesPool returns the bytes pool.
	BytesPool() pool.CheckedBytesPool

	// SetFetchConcurrency sets the fetch concurrency.
	SetFetchConcurrency(value int) BlockRetrieverOptions

	// FetchConcurrency returns the fetch concurrency.
	FetchConcurrency() int

	// SetIdentifierPool sets the identifierPool.
	SetIdentifierPool(value ident.Pool) BlockRetrieverOptions

	// IdentifierPool returns the identifierPool.
	IdentifierPool() ident.Pool

	// SetBlockLeaseManager sets the block leaser.
	SetBlockLeaseManager(leaseMgr block.LeaseManager) BlockRetrieverOptions

	// BlockLeaseManager returns the block leaser.
	BlockLeaseManager() block.LeaseManager
}

BlockRetrieverOptions represents the options for block retrieval

func NewBlockRetrieverOptions

func NewBlockRetrieverOptions() BlockRetrieverOptions

NewBlockRetrieverOptions creates a new set of block retriever options

type ConcurrentDataFileSetSeeker

type ConcurrentDataFileSetSeeker interface {
	io.Closer

	// SeekByID is the same as in DataFileSetSeeker
	SeekByID(id ident.ID, resources ReusableSeekerResources) (data checked.Bytes, err error)

	// SeekByIndexEntry is the same as in DataFileSetSeeker
	SeekByIndexEntry(entry IndexEntry, resources ReusableSeekerResources) (checked.Bytes, error)

	// SeekIndexEntry is the same as in DataFileSetSeeker
	SeekIndexEntry(id ident.ID, resources ReusableSeekerResources) (IndexEntry, error)

	// ConcurrentIDBloomFilter is the same as in DataFileSetSeeker
	ConcurrentIDBloomFilter() *ManagedConcurrentBloomFilter
}

ConcurrentDataFileSetSeeker is a limited interface that is returned when ConcurrentClone() is called on DataFileSetSeeker. A seeker is essentially a wrapper around file descriptors around a set of files, allowing for interaction with them. We can ask a seeker for a specific time series, which will then be streamed out from the according data file. The clones can be used together concurrently and share underlying resources. Clones are no longer usable once the original has been closed.

type DataBlockRetriever

type DataBlockRetriever interface {
	io.Closer
	block.DatabaseBlockRetriever

	// Open the block retriever to retrieve from a namespace
	Open(md namespace.Metadata) error
}

DataBlockRetriever provides a block retriever for TSDB file sets

func NewBlockRetriever

func NewBlockRetriever(
	opts BlockRetrieverOptions,
	fsOpts Options,
) (DataBlockRetriever, error)

NewBlockRetriever returns a new block retriever for TSDB file sets.

type DataFileSetReader

type DataFileSetReader interface {
	io.Closer

	// Open opens the files for the given shard and version for reading
	Open(opts DataReaderOpenOptions) error

	// Status returns the status of the reader
	Status() DataFileSetReaderStatus

	// Read returns the next id, data, checksum tuple or error, will return io.EOF at end of volume.
	// Use either Read or ReadMetadata to progress through a volume, but not both.
	// Note: make sure to finalize the ID, close the Tags and finalize the Data when done with
	// them so they can be returned to their respective pools.
	Read() (id ident.ID, tags ident.TagIterator, data checked.Bytes, checksum uint32, err error)

	// ReadMetadata returns the next id and metadata or error, will return io.EOF at end of volume.
	// Use either Read or ReadMetadata to progress through a volume, but not both.
	// Note: make sure to finalize the ID, and close the Tags when done with them so they can
	// be returned to their respective pools.
	ReadMetadata() (id ident.ID, tags ident.TagIterator, length int, checksum uint32, err error)

	// ReadBloomFilter returns the bloom filter stored on disk in a container object that is safe
	// for concurrent use and has a Close() method for releasing resources when done.
	ReadBloomFilter() (*ManagedConcurrentBloomFilter, error)

	// Validate validates both the metadata and data and returns an error if either is corrupted
	Validate() error

	// ValidateMetadata validates the data and returns an error if the data is corrupted
	ValidateMetadata() error

	// ValidateData validates the data and returns an error if the data is corrupted
	ValidateData() error

	// Range returns the time range associated with data in the volume
	Range() xtime.Range

	// Entries returns the count of entries in the volume
	Entries() int

	// EntriesRead returns the position read into the volume
	EntriesRead() int

	// MetadataRead returns the position of metadata read into the volume
	MetadataRead() int
}

DataFileSetReader provides an unsynchronized reader for a TSDB file set

func NewReader

func NewReader(
	bytesPool pool.CheckedBytesPool,
	opts Options,
) (DataFileSetReader, error)

NewReader returns a new reader and expects all files to exist. Will read the index info in full on call to Open. The bytesPool can be passed as nil if callers would prefer just dynamically allocated IDs and data.

type DataFileSetReaderStatus

type DataFileSetReaderStatus struct {
	Namespace  ident.ID
	BlockStart time.Time
	Shard      uint32
	Volume     int
	Open       bool
}

DataFileSetReaderStatus describes the status of a file set reader

type DataFileSetSeeker

type DataFileSetSeeker interface {
	io.Closer

	// Open opens the files for the given shard and version for reading
	Open(
		namespace ident.ID,
		shard uint32,
		start time.Time,
		volume int,
		resources ReusableSeekerResources,
	) error

	// SeekByID returns the data for specified ID provided the index was loaded upon open. An
	// error will be returned if the index was not loaded or ID cannot be found.
	SeekByID(id ident.ID, resources ReusableSeekerResources) (data checked.Bytes, err error)

	// SeekByIndexEntry is similar to Seek, but uses an IndexEntry instead of
	// looking it up on its own. Useful in cases where you've already obtained an
	// entry and don't want to waste resources looking it up again.
	SeekByIndexEntry(entry IndexEntry, resources ReusableSeekerResources) (checked.Bytes, error)

	// SeekIndexEntry returns the IndexEntry for the specified ID. This can be useful
	// ahead of issuing a number of seek requests so that the seek requests can be
	// made in order. The returned IndexEntry can also be passed to SeekUsingIndexEntry
	// to prevent duplicate index lookups.
	SeekIndexEntry(id ident.ID, resources ReusableSeekerResources) (IndexEntry, error)

	// Range returns the time range associated with data in the volume
	Range() xtime.Range

	// ConcurrentIDBloomFilter returns a concurrency-safe bloom filter that can
	// be used to quickly disqualify ID's that definitely do not exist. I.E if the
	// Test() method returns true, the ID may exist on disk, but if it returns
	// false, it definitely does not.
	ConcurrentIDBloomFilter() *ManagedConcurrentBloomFilter

	// ConcurrentClone clones a seeker, creating a copy that uses the same underlying resources
	// (mmaps), but that is capable of seeking independently. The original can continue
	// to be used after the clones are closed, but the clones cannot be used after the
	// original is closed.
	ConcurrentClone() (ConcurrentDataFileSetSeeker, error)
}

DataFileSetSeeker provides an out of order reader for a TSDB file set

func NewSeeker

func NewSeeker(
	filePathPrefix string,
	dataBufferSize int,
	infoBufferSize int,
	bytesPool pool.CheckedBytesPool,
	keepUnreadBuf bool,
	opts Options,
) DataFileSetSeeker

NewSeeker returns a new seeker.

type DataFileSetSeekerManager

type DataFileSetSeekerManager interface {
	io.Closer

	// Open opens the seekers for a given namespace.
	Open(md namespace.Metadata) error

	// CacheShardIndices will pre-parse the indexes for given shards
	// to improve times when seeking to a block.
	CacheShardIndices(shards []uint32) error

	// Borrow returns an open seeker for a given shard, block start time, and
	// volume.
	Borrow(shard uint32, start time.Time) (ConcurrentDataFileSetSeeker, error)

	// Return returns (closes) an open seeker for a given shard, block start
	// time, and volume.
	Return(shard uint32, start time.Time, seeker ConcurrentDataFileSetSeeker) error

	// Test checks if an ID exists in a concurrent ID bloom filter for a
	// given shard, block, start time and volume.
	Test(id ident.ID, shard uint32, start time.Time) (bool, error)
}

DataFileSetSeekerManager provides management of seekers for a TSDB namespace.

func NewSeekerManager

func NewSeekerManager(
	bytesPool pool.CheckedBytesPool,
	opts Options,
	blockRetrieverOpts BlockRetrieverOptions,
) DataFileSetSeekerManager

NewSeekerManager returns a new TSDB file set seeker manager.

type DataFileSetWriter

type DataFileSetWriter interface {
	io.Closer

	// Open opens the files for writing data to the given shard in the given namespace.
	// This method is not thread-safe, so its the callers responsibilities that they never
	// try and write two snapshot files for the same block start at the same time or their
	// will be a race in determining the snapshot file's index.
	Open(opts DataWriterOpenOptions) error

	// Write will write the id and data pair and returns an error on a write error. Callers
	// must not call this method with a given ID more than once.
	Write(id ident.ID, tags ident.Tags, data checked.Bytes, checksum uint32) error

	// WriteAll will write the id and all byte slices and returns an error on a write error.
	// Callers must not call this method with a given ID more than once.
	WriteAll(id ident.ID, tags ident.Tags, data []checked.Bytes, checksum uint32) error
}

DataFileSetWriter provides an unsynchronized writer for a TSDB file set

func NewWriter

func NewWriter(opts Options) (DataFileSetWriter, error)

NewWriter returns a new writer with options.

type DataReaderOpenOptions

type DataReaderOpenOptions struct {
	Identifier  FileSetFileIdentifier
	FileSetType persist.FileSetType
}

DataReaderOpenOptions is options struct for the reader open method.

type DataWriterOpenOptions

type DataWriterOpenOptions struct {
	FileSetType        persist.FileSetType
	FileSetContentType persist.FileSetContentType
	Identifier         FileSetFileIdentifier
	BlockSize          time.Duration
	// Only used when writing snapshot files
	Snapshot DataWriterSnapshotOptions
}

DataWriterOpenOptions is the options struct for the Open method on the DataFileSetWriter

type DataWriterSnapshotOptions

type DataWriterSnapshotOptions struct {
	SnapshotTime time.Time
	SnapshotID   []byte
}

DataWriterSnapshotOptions is the options struct for Open method on the DataFileSetWriter that contains information specific to writing snapshot files

type FileSetFile

type FileSetFile struct {
	ID                FileSetFileIdentifier
	AbsoluteFilepaths []string

	CachedSnapshotTime              time.Time
	CachedSnapshotID                uuid.UUID
	CachedHasCompleteCheckpointFile LazyEvalBool
	// contains filtered or unexported fields
}

FileSetFile represents a set of FileSet files for a given block start

func FileSetAt

func FileSetAt(filePathPrefix string, namespace ident.ID, shard uint32, blockStart time.Time, volume int) (FileSetFile, bool, error)

FileSetAt returns a FileSetFile for the given namespace/shard/blockStart/volume combination if it exists.

func NewFileSetFile

func NewFileSetFile(id FileSetFileIdentifier, filePathPrefix string) FileSetFile

NewFileSetFile creates a new FileSet file

func (*FileSetFile) HasCompleteCheckpointFile

func (f *FileSetFile) HasCompleteCheckpointFile() bool

HasCompleteCheckpointFile returns a bool indicating whether the given set of fileset files has a checkpoint file.

func (FileSetFile) IsZero

func (f FileSetFile) IsZero() bool

IsZero returns whether the FileSetFile is a zero value.

func (*FileSetFile) SnapshotTimeAndID

func (f *FileSetFile) SnapshotTimeAndID() (time.Time, uuid.UUID, error)

SnapshotTimeAndID returns the snapshot time and id for the given FileSetFile. Value is meaningless if the the FileSetFile is a flush instead of a snapshot.

type FileSetFileIdentifier

type FileSetFileIdentifier struct {
	FileSetContentType persist.FileSetContentType
	Namespace          ident.ID
	BlockStart         time.Time
	// Only required for data content files
	Shard uint32
	// Required for snapshot files (index yes, data yes) and flush files (index yes, data yes)
	VolumeIndex int
}

FileSetFileIdentifier contains all the information required to identify a FileSetFile

type FileSetFilesSlice

type FileSetFilesSlice []FileSetFile

FileSetFilesSlice is a slice of FileSetFile

func DataFiles

func DataFiles(filePathPrefix string, namespace ident.ID, shard uint32) (FileSetFilesSlice, error)

DataFiles returns a slice of all the names for all the fileset files for a given namespace and shard combination.

func IndexFileSetsAt

func IndexFileSetsAt(filePathPrefix string, namespace ident.ID, blockStart time.Time) (FileSetFilesSlice, error)

IndexFileSetsAt returns all FileSetFile(s) for the given namespace/blockStart combination. NB: It returns all complete Volumes found on disk.

func IndexSnapshotFiles

func IndexSnapshotFiles(filePathPrefix string, namespace ident.ID) (FileSetFilesSlice, error)

IndexSnapshotFiles returns a slice of all the names for all the index fileset files for a given namespace.

func SnapshotFiles

func SnapshotFiles(filePathPrefix string, namespace ident.ID, shard uint32) (FileSetFilesSlice, error)

SnapshotFiles returns a slice of all the names for all the snapshot files for a given namespace and shard combination.

func (FileSetFilesSlice) Filepaths

func (f FileSetFilesSlice) Filepaths() []string

Filepaths flattens a slice of FileSetFiles to a single slice of filepaths. All paths returned are absolute.

func (FileSetFilesSlice) LatestVolumeForBlock

func (f FileSetFilesSlice) LatestVolumeForBlock(blockStart time.Time) (FileSetFile, bool)

LatestVolumeForBlock returns the latest (highest index) FileSetFile in the slice for a given block start that has a complete checkpoint file.

func (FileSetFilesSlice) VolumeExistsForBlock

func (f FileSetFilesSlice) VolumeExistsForBlock(blockStart time.Time, volume int) bool

VolumeExistsForBlock returns whether there is a valid FileSetFile for the given block start and volume index.

type ForEachRemainingFn

type ForEachRemainingFn func(seriesID ident.ID, tags ident.Tags, data []xio.BlockReader) error

ForEachRemainingFn is the function that is run on each of the remaining series of the merge target that did not intersect with the fileset.

type IndexEntry

type IndexEntry struct {
	Size        uint32
	Checksum    uint32
	Offset      int64
	EncodedTags checked.Bytes
}

IndexEntry is an entry from the index file which can be passed to SeekUsingIndexEntry to seek to the data for that entry

type IndexFileSetReader

type IndexFileSetReader interface {
	idxpersist.IndexFileSetReader
	io.Closer

	// Open the index file set reader.
	Open(opts IndexReaderOpenOptions) (IndexReaderOpenResult, error)

	// Validate returns whether all checksums were matched as expected,
	// it must be called after reading all the segment file sets otherwise
	// it returns an error.
	Validate() error
}

IndexFileSetReader is an index file set reader.

func NewIndexReader

func NewIndexReader(opts Options) (IndexFileSetReader, error)

NewIndexReader returns a new index reader with options.

type IndexFileSetWriter

type IndexFileSetWriter interface {
	idxpersist.IndexFileSetWriter
	io.Closer

	// Open the index file set writer.
	Open(opts IndexWriterOpenOptions) error
}

IndexFileSetWriter is a index file set writer.

func NewIndexWriter

func NewIndexWriter(opts Options) (IndexFileSetWriter, error)

NewIndexWriter returns a new index writer with options.

type IndexReaderOpenOptions

type IndexReaderOpenOptions struct {
	Identifier  FileSetFileIdentifier
	FileSetType persist.FileSetType
}

IndexReaderOpenOptions is the index file set reader open options.

type IndexReaderOpenResult

type IndexReaderOpenResult struct {
	Shards map[uint32]struct{}
}

IndexReaderOpenResult describes the results of opening a index file set volume.

type IndexSegmentFile

type IndexSegmentFile interface {
	idxpersist.IndexSegmentFileSet
}

IndexSegmentFile is a file in an index segment file set.

type IndexSegmentFileSet

type IndexSegmentFileSet interface {
	idxpersist.IndexSegmentFileSet
}

IndexSegmentFileSet is an index segment file set.

type IndexSegmentFileSetWriter

type IndexSegmentFileSetWriter interface {
	idxpersist.IndexSegmentFileSetWriter
}

IndexSegmentFileSetWriter is an index segment file set writer.

type IndexWriterOpenOptions

type IndexWriterOpenOptions struct {
	Identifier  FileSetFileIdentifier
	BlockSize   time.Duration
	FileSetType persist.FileSetType
	Shards      map[uint32]struct{}
	// Only used when writing snapshot files
	Snapshot IndexWriterSnapshotOptions
}

IndexWriterOpenOptions is a set of options when opening an index file set writer.

type IndexWriterSnapshotOptions

type IndexWriterSnapshotOptions struct {
	SnapshotTime time.Time
}

IndexWriterSnapshotOptions is a set of options for writing an index file set snapshot.

type Inspection

type Inspection struct {
	// SortedCommitLogFiles contains all commitlog filenames that existed
	// before the node began accepting writes.
	SortedCommitLogFiles []string
}

Inspection contains the outcome of a filesystem inspection.

func InspectFilesystem

func InspectFilesystem(fsOpts Options) (Inspection, error)

InspectFilesystem scans the filesystem and generates a Inspection which the commitlog bootstrapper needs to avoid reading commitlog files that were written *after* the process has already started. I.E in order to distinguish between files that were already on disk before the process started, and those that were written by the process itself once it started accepting writes (but before bootstrapping had complete) we export a function which can be called during node startup.

func (Inspection) CommitLogFilesSet

func (f Inspection) CommitLogFilesSet() map[string]struct{}

CommitLogFilesSet generates a set of unique commitlog files.

type LazyEvalBool

type LazyEvalBool uint8

LazyEvalBool is a boolean that is lazily evaluated.

const (
	// EvalNone indicates the boolean has not been evaluated.
	EvalNone LazyEvalBool = iota
	// EvalTrue indicates the boolean has been evaluated to true.
	EvalTrue
	// EvalFalse indicates the boolean has been evaluated to false.
	EvalFalse
)

type ManagedConcurrentBloomFilter

type ManagedConcurrentBloomFilter struct {
	// contains filtered or unexported fields
}

ManagedConcurrentBloomFilter is a container object that implements lifecycle management on-top of a BloomFilter. I.E it wraps a bloom filter such that all resources are released when the Close() method is called. It's also safe for concurrent access

func (*ManagedConcurrentBloomFilter) Close

func (bf *ManagedConcurrentBloomFilter) Close() error

Close closes the bloom filter, releasing any held resources

func (*ManagedConcurrentBloomFilter) K

K returns the number of hash functions in the bloom filter

func (*ManagedConcurrentBloomFilter) M

M returns the number of elements in the bloom filter

func (*ManagedConcurrentBloomFilter) Test

func (bf *ManagedConcurrentBloomFilter) Test(value []byte) bool

Test tests whether a value is in the bloom filter

type MergeWith

type MergeWith interface {
	// Read returns the data for the given block start and series ID, whether
	// any data was found, and the error encountered (if any).
	Read(
		ctx context.Context,
		seriesID ident.ID,
		blockStart xtime.UnixNano,
		nsCtx namespace.Context,
	) ([]xio.BlockReader, bool, error)

	// ForEachRemaining loops through each seriesID/blockStart combination that
	// was not already handled by a call to Read().
	ForEachRemaining(
		ctx context.Context,
		blockStart xtime.UnixNano,
		fn ForEachRemainingFn,
		nsCtx namespace.Context,
	) error
}

MergeWith is an interface that the fs merger uses to merge data with.

type Merger

type Merger interface {
	// Merge merges the specified fileset file with a merge target.
	Merge(
		fileID FileSetFileIdentifier,
		mergeWith MergeWith,
		nextVolumeIndex int,
		flushPreparer persist.FlushPreparer,
		nsCtx namespace.Context,
	) error
}

Merger is in charge of merging filesets with some target MergeWith interface.

func NewMerger

func NewMerger(
	reader DataFileSetReader,
	blockAllocSize int,
	srPool xio.SegmentReaderPool,
	multiIterPool encoding.MultiReaderIteratorPool,
	identPool ident.Pool,
	encoderPool encoding.EncoderPool,
	contextPool context.Pool,
	nsOpts namespace.Options,
) Merger

NewMerger returns a new Merger. This implementation is in charge of merging the data from an existing fileset with a merge target. If data for a series at a timestamp exists both on disk and the merge target, data from the merge target will be used. This merged data is then persisted.

Note that the merger does not know how or where this merged data is persisted since it just uses the flushPreparer that is passed in. Further, it does not signal to the database of the existence of the newly persisted data, nor does it clean up the original fileset.

type MockConcurrentDataFileSetSeeker

type MockConcurrentDataFileSetSeeker struct {
	// contains filtered or unexported fields
}

MockConcurrentDataFileSetSeeker is a mock of ConcurrentDataFileSetSeeker interface

func NewMockConcurrentDataFileSetSeeker

func NewMockConcurrentDataFileSetSeeker(ctrl *gomock.Controller) *MockConcurrentDataFileSetSeeker

NewMockConcurrentDataFileSetSeeker creates a new mock instance

func (*MockConcurrentDataFileSetSeeker) Close

Close mocks base method

func (*MockConcurrentDataFileSetSeeker) ConcurrentIDBloomFilter

func (m *MockConcurrentDataFileSetSeeker) ConcurrentIDBloomFilter() *ManagedConcurrentBloomFilter

ConcurrentIDBloomFilter mocks base method

func (*MockConcurrentDataFileSetSeeker) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockConcurrentDataFileSetSeeker) SeekByID

SeekByID mocks base method

func (*MockConcurrentDataFileSetSeeker) SeekByIndexEntry

SeekByIndexEntry mocks base method

func (*MockConcurrentDataFileSetSeeker) SeekIndexEntry

SeekIndexEntry mocks base method

type MockConcurrentDataFileSetSeekerMockRecorder

type MockConcurrentDataFileSetSeekerMockRecorder struct {
	// contains filtered or unexported fields
}

MockConcurrentDataFileSetSeekerMockRecorder is the mock recorder for MockConcurrentDataFileSetSeeker

func (*MockConcurrentDataFileSetSeekerMockRecorder) Close

Close indicates an expected call of Close

func (*MockConcurrentDataFileSetSeekerMockRecorder) ConcurrentIDBloomFilter

func (mr *MockConcurrentDataFileSetSeekerMockRecorder) ConcurrentIDBloomFilter() *gomock.Call

ConcurrentIDBloomFilter indicates an expected call of ConcurrentIDBloomFilter

func (*MockConcurrentDataFileSetSeekerMockRecorder) SeekByID

func (mr *MockConcurrentDataFileSetSeekerMockRecorder) SeekByID(arg0, arg1 interface{}) *gomock.Call

SeekByID indicates an expected call of SeekByID

func (*MockConcurrentDataFileSetSeekerMockRecorder) SeekByIndexEntry

func (mr *MockConcurrentDataFileSetSeekerMockRecorder) SeekByIndexEntry(arg0, arg1 interface{}) *gomock.Call

SeekByIndexEntry indicates an expected call of SeekByIndexEntry

func (*MockConcurrentDataFileSetSeekerMockRecorder) SeekIndexEntry

func (mr *MockConcurrentDataFileSetSeekerMockRecorder) SeekIndexEntry(arg0, arg1 interface{}) *gomock.Call

SeekIndexEntry indicates an expected call of SeekIndexEntry

type MockDataFileSetReader

type MockDataFileSetReader struct {
	// contains filtered or unexported fields
}

MockDataFileSetReader is a mock of DataFileSetReader interface

func NewMockDataFileSetReader

func NewMockDataFileSetReader(ctrl *gomock.Controller) *MockDataFileSetReader

NewMockDataFileSetReader creates a new mock instance

func (*MockDataFileSetReader) Close

func (m *MockDataFileSetReader) Close() error

Close mocks base method

func (*MockDataFileSetReader) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDataFileSetReader) Entries

func (m *MockDataFileSetReader) Entries() int

Entries mocks base method

func (*MockDataFileSetReader) EntriesRead

func (m *MockDataFileSetReader) EntriesRead() int

EntriesRead mocks base method

func (*MockDataFileSetReader) MetadataRead

func (m *MockDataFileSetReader) MetadataRead() int

MetadataRead mocks base method

func (*MockDataFileSetReader) Open

Open mocks base method

func (*MockDataFileSetReader) Range

func (m *MockDataFileSetReader) Range() time0.Range

Range mocks base method

func (*MockDataFileSetReader) Read

Read mocks base method

func (*MockDataFileSetReader) ReadBloomFilter

func (m *MockDataFileSetReader) ReadBloomFilter() (*ManagedConcurrentBloomFilter, error)

ReadBloomFilter mocks base method

func (*MockDataFileSetReader) ReadMetadata

func (m *MockDataFileSetReader) ReadMetadata() (ident.ID, ident.TagIterator, int, uint32, error)

ReadMetadata mocks base method

func (*MockDataFileSetReader) Status

Status mocks base method

func (*MockDataFileSetReader) Validate

func (m *MockDataFileSetReader) Validate() error

Validate mocks base method

func (*MockDataFileSetReader) ValidateData

func (m *MockDataFileSetReader) ValidateData() error

ValidateData mocks base method

func (*MockDataFileSetReader) ValidateMetadata

func (m *MockDataFileSetReader) ValidateMetadata() error

ValidateMetadata mocks base method

type MockDataFileSetReaderMockRecorder

type MockDataFileSetReaderMockRecorder struct {
	// contains filtered or unexported fields
}

MockDataFileSetReaderMockRecorder is the mock recorder for MockDataFileSetReader

func (*MockDataFileSetReaderMockRecorder) Close

Close indicates an expected call of Close

func (*MockDataFileSetReaderMockRecorder) Entries

Entries indicates an expected call of Entries

func (*MockDataFileSetReaderMockRecorder) EntriesRead

func (mr *MockDataFileSetReaderMockRecorder) EntriesRead() *gomock.Call

EntriesRead indicates an expected call of EntriesRead

func (*MockDataFileSetReaderMockRecorder) MetadataRead

func (mr *MockDataFileSetReaderMockRecorder) MetadataRead() *gomock.Call

MetadataRead indicates an expected call of MetadataRead

func (*MockDataFileSetReaderMockRecorder) Open

func (mr *MockDataFileSetReaderMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockDataFileSetReaderMockRecorder) Range

Range indicates an expected call of Range

func (*MockDataFileSetReaderMockRecorder) Read

Read indicates an expected call of Read

func (*MockDataFileSetReaderMockRecorder) ReadBloomFilter

func (mr *MockDataFileSetReaderMockRecorder) ReadBloomFilter() *gomock.Call

ReadBloomFilter indicates an expected call of ReadBloomFilter

func (*MockDataFileSetReaderMockRecorder) ReadMetadata

func (mr *MockDataFileSetReaderMockRecorder) ReadMetadata() *gomock.Call

ReadMetadata indicates an expected call of ReadMetadata

func (*MockDataFileSetReaderMockRecorder) Status

Status indicates an expected call of Status

func (*MockDataFileSetReaderMockRecorder) Validate

Validate indicates an expected call of Validate

func (*MockDataFileSetReaderMockRecorder) ValidateData

func (mr *MockDataFileSetReaderMockRecorder) ValidateData() *gomock.Call

ValidateData indicates an expected call of ValidateData

func (*MockDataFileSetReaderMockRecorder) ValidateMetadata

func (mr *MockDataFileSetReaderMockRecorder) ValidateMetadata() *gomock.Call

ValidateMetadata indicates an expected call of ValidateMetadata

type MockDataFileSetSeeker

type MockDataFileSetSeeker struct {
	// contains filtered or unexported fields
}

MockDataFileSetSeeker is a mock of DataFileSetSeeker interface

func NewMockDataFileSetSeeker

func NewMockDataFileSetSeeker(ctrl *gomock.Controller) *MockDataFileSetSeeker

NewMockDataFileSetSeeker creates a new mock instance

func (*MockDataFileSetSeeker) Close

func (m *MockDataFileSetSeeker) Close() error

Close mocks base method

func (*MockDataFileSetSeeker) ConcurrentClone

ConcurrentClone mocks base method

func (*MockDataFileSetSeeker) ConcurrentIDBloomFilter

func (m *MockDataFileSetSeeker) ConcurrentIDBloomFilter() *ManagedConcurrentBloomFilter

ConcurrentIDBloomFilter mocks base method

func (*MockDataFileSetSeeker) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDataFileSetSeeker) Open

func (m *MockDataFileSetSeeker) Open(arg0 ident.ID, arg1 uint32, arg2 time.Time, arg3 int, arg4 ReusableSeekerResources) error

Open mocks base method

func (*MockDataFileSetSeeker) Range

func (m *MockDataFileSetSeeker) Range() time0.Range

Range mocks base method

func (*MockDataFileSetSeeker) SeekByID

SeekByID mocks base method

func (*MockDataFileSetSeeker) SeekByIndexEntry

func (m *MockDataFileSetSeeker) SeekByIndexEntry(arg0 IndexEntry, arg1 ReusableSeekerResources) (checked.Bytes, error)

SeekByIndexEntry mocks base method

func (*MockDataFileSetSeeker) SeekIndexEntry

func (m *MockDataFileSetSeeker) SeekIndexEntry(arg0 ident.ID, arg1 ReusableSeekerResources) (IndexEntry, error)

SeekIndexEntry mocks base method

type MockDataFileSetSeekerManager

type MockDataFileSetSeekerManager struct {
	// contains filtered or unexported fields
}

MockDataFileSetSeekerManager is a mock of DataFileSetSeekerManager interface

func NewMockDataFileSetSeekerManager

func NewMockDataFileSetSeekerManager(ctrl *gomock.Controller) *MockDataFileSetSeekerManager

NewMockDataFileSetSeekerManager creates a new mock instance

func (*MockDataFileSetSeekerManager) Borrow

Borrow mocks base method

func (*MockDataFileSetSeekerManager) CacheShardIndices

func (m *MockDataFileSetSeekerManager) CacheShardIndices(arg0 []uint32) error

CacheShardIndices mocks base method

func (*MockDataFileSetSeekerManager) Close

Close mocks base method

func (*MockDataFileSetSeekerManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDataFileSetSeekerManager) Open

Open mocks base method

func (*MockDataFileSetSeekerManager) Return

Return mocks base method

func (*MockDataFileSetSeekerManager) Test

func (m *MockDataFileSetSeekerManager) Test(arg0 ident.ID, arg1 uint32, arg2 time.Time) (bool, error)

Test mocks base method

type MockDataFileSetSeekerManagerMockRecorder

type MockDataFileSetSeekerManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockDataFileSetSeekerManagerMockRecorder is the mock recorder for MockDataFileSetSeekerManager

func (*MockDataFileSetSeekerManagerMockRecorder) Borrow

func (mr *MockDataFileSetSeekerManagerMockRecorder) Borrow(arg0, arg1 interface{}) *gomock.Call

Borrow indicates an expected call of Borrow

func (*MockDataFileSetSeekerManagerMockRecorder) CacheShardIndices

func (mr *MockDataFileSetSeekerManagerMockRecorder) CacheShardIndices(arg0 interface{}) *gomock.Call

CacheShardIndices indicates an expected call of CacheShardIndices

func (*MockDataFileSetSeekerManagerMockRecorder) Close

Close indicates an expected call of Close

func (*MockDataFileSetSeekerManagerMockRecorder) Open

func (mr *MockDataFileSetSeekerManagerMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockDataFileSetSeekerManagerMockRecorder) Return

func (mr *MockDataFileSetSeekerManagerMockRecorder) Return(arg0, arg1, arg2 interface{}) *gomock.Call

Return indicates an expected call of Return

func (*MockDataFileSetSeekerManagerMockRecorder) Test

func (mr *MockDataFileSetSeekerManagerMockRecorder) Test(arg0, arg1, arg2 interface{}) *gomock.Call

Test indicates an expected call of Test

type MockDataFileSetSeekerMockRecorder

type MockDataFileSetSeekerMockRecorder struct {
	// contains filtered or unexported fields
}

MockDataFileSetSeekerMockRecorder is the mock recorder for MockDataFileSetSeeker

func (*MockDataFileSetSeekerMockRecorder) Close

Close indicates an expected call of Close

func (*MockDataFileSetSeekerMockRecorder) ConcurrentClone

func (mr *MockDataFileSetSeekerMockRecorder) ConcurrentClone() *gomock.Call

ConcurrentClone indicates an expected call of ConcurrentClone

func (*MockDataFileSetSeekerMockRecorder) ConcurrentIDBloomFilter

func (mr *MockDataFileSetSeekerMockRecorder) ConcurrentIDBloomFilter() *gomock.Call

ConcurrentIDBloomFilter indicates an expected call of ConcurrentIDBloomFilter

func (*MockDataFileSetSeekerMockRecorder) Open

func (mr *MockDataFileSetSeekerMockRecorder) Open(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockDataFileSetSeekerMockRecorder) Range

Range indicates an expected call of Range

func (*MockDataFileSetSeekerMockRecorder) SeekByID

func (mr *MockDataFileSetSeekerMockRecorder) SeekByID(arg0, arg1 interface{}) *gomock.Call

SeekByID indicates an expected call of SeekByID

func (*MockDataFileSetSeekerMockRecorder) SeekByIndexEntry

func (mr *MockDataFileSetSeekerMockRecorder) SeekByIndexEntry(arg0, arg1 interface{}) *gomock.Call

SeekByIndexEntry indicates an expected call of SeekByIndexEntry

func (*MockDataFileSetSeekerMockRecorder) SeekIndexEntry

func (mr *MockDataFileSetSeekerMockRecorder) SeekIndexEntry(arg0, arg1 interface{}) *gomock.Call

SeekIndexEntry indicates an expected call of SeekIndexEntry

type MockDataFileSetWriter

type MockDataFileSetWriter struct {
	// contains filtered or unexported fields
}

MockDataFileSetWriter is a mock of DataFileSetWriter interface

func NewMockDataFileSetWriter

func NewMockDataFileSetWriter(ctrl *gomock.Controller) *MockDataFileSetWriter

NewMockDataFileSetWriter creates a new mock instance

func (*MockDataFileSetWriter) Close

func (m *MockDataFileSetWriter) Close() error

Close mocks base method

func (*MockDataFileSetWriter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDataFileSetWriter) Open

Open mocks base method

func (*MockDataFileSetWriter) Write

func (m *MockDataFileSetWriter) Write(arg0 ident.ID, arg1 ident.Tags, arg2 checked.Bytes, arg3 uint32) error

Write mocks base method

func (*MockDataFileSetWriter) WriteAll

func (m *MockDataFileSetWriter) WriteAll(arg0 ident.ID, arg1 ident.Tags, arg2 []checked.Bytes, arg3 uint32) error

WriteAll mocks base method

type MockDataFileSetWriterMockRecorder

type MockDataFileSetWriterMockRecorder struct {
	// contains filtered or unexported fields
}

MockDataFileSetWriterMockRecorder is the mock recorder for MockDataFileSetWriter

func (*MockDataFileSetWriterMockRecorder) Close

Close indicates an expected call of Close

func (*MockDataFileSetWriterMockRecorder) Open

func (mr *MockDataFileSetWriterMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockDataFileSetWriterMockRecorder) Write

func (mr *MockDataFileSetWriterMockRecorder) Write(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Write indicates an expected call of Write

func (*MockDataFileSetWriterMockRecorder) WriteAll

func (mr *MockDataFileSetWriterMockRecorder) WriteAll(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

WriteAll indicates an expected call of WriteAll

type MockIndexFileSetReader

type MockIndexFileSetReader struct {
	// contains filtered or unexported fields
}

MockIndexFileSetReader is a mock of IndexFileSetReader interface

func NewMockIndexFileSetReader

func NewMockIndexFileSetReader(ctrl *gomock.Controller) *MockIndexFileSetReader

NewMockIndexFileSetReader creates a new mock instance

func (*MockIndexFileSetReader) Close

func (m *MockIndexFileSetReader) Close() error

Close mocks base method

func (*MockIndexFileSetReader) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIndexFileSetReader) Open

Open mocks base method

func (*MockIndexFileSetReader) ReadSegmentFileSet

func (m *MockIndexFileSetReader) ReadSegmentFileSet() (persist.IndexSegmentFileSet, error)

ReadSegmentFileSet mocks base method

func (*MockIndexFileSetReader) SegmentFileSets

func (m *MockIndexFileSetReader) SegmentFileSets() int

SegmentFileSets mocks base method

func (*MockIndexFileSetReader) Validate

func (m *MockIndexFileSetReader) Validate() error

Validate mocks base method

type MockIndexFileSetReaderMockRecorder

type MockIndexFileSetReaderMockRecorder struct {
	// contains filtered or unexported fields
}

MockIndexFileSetReaderMockRecorder is the mock recorder for MockIndexFileSetReader

func (*MockIndexFileSetReaderMockRecorder) Close

Close indicates an expected call of Close

func (*MockIndexFileSetReaderMockRecorder) Open

func (mr *MockIndexFileSetReaderMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockIndexFileSetReaderMockRecorder) ReadSegmentFileSet

func (mr *MockIndexFileSetReaderMockRecorder) ReadSegmentFileSet() *gomock.Call

ReadSegmentFileSet indicates an expected call of ReadSegmentFileSet

func (*MockIndexFileSetReaderMockRecorder) SegmentFileSets

func (mr *MockIndexFileSetReaderMockRecorder) SegmentFileSets() *gomock.Call

SegmentFileSets indicates an expected call of SegmentFileSets

func (*MockIndexFileSetReaderMockRecorder) Validate

Validate indicates an expected call of Validate

type MockIndexFileSetWriter

type MockIndexFileSetWriter struct {
	// contains filtered or unexported fields
}

MockIndexFileSetWriter is a mock of IndexFileSetWriter interface

func NewMockIndexFileSetWriter

func NewMockIndexFileSetWriter(ctrl *gomock.Controller) *MockIndexFileSetWriter

NewMockIndexFileSetWriter creates a new mock instance

func (*MockIndexFileSetWriter) Close

func (m *MockIndexFileSetWriter) Close() error

Close mocks base method

func (*MockIndexFileSetWriter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIndexFileSetWriter) Open

Open mocks base method

func (*MockIndexFileSetWriter) WriteSegmentFileSet

func (m *MockIndexFileSetWriter) WriteSegmentFileSet(arg0 persist.IndexSegmentFileSetWriter) error

WriteSegmentFileSet mocks base method

type MockIndexFileSetWriterMockRecorder

type MockIndexFileSetWriterMockRecorder struct {
	// contains filtered or unexported fields
}

MockIndexFileSetWriterMockRecorder is the mock recorder for MockIndexFileSetWriter

func (*MockIndexFileSetWriterMockRecorder) Close

Close indicates an expected call of Close

func (*MockIndexFileSetWriterMockRecorder) Open

func (mr *MockIndexFileSetWriterMockRecorder) Open(arg0 interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockIndexFileSetWriterMockRecorder) WriteSegmentFileSet

func (mr *MockIndexFileSetWriterMockRecorder) WriteSegmentFileSet(arg0 interface{}) *gomock.Call

WriteSegmentFileSet indicates an expected call of WriteSegmentFileSet

type MockIndexSegmentFile

type MockIndexSegmentFile struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFile is a mock of IndexSegmentFile interface

func NewMockIndexSegmentFile

func NewMockIndexSegmentFile(ctrl *gomock.Controller) *MockIndexSegmentFile

NewMockIndexSegmentFile creates a new mock instance

func (*MockIndexSegmentFile) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIndexSegmentFile) Files

Files mocks base method

func (*MockIndexSegmentFile) MajorVersion

func (m *MockIndexSegmentFile) MajorVersion() int

MajorVersion mocks base method

func (*MockIndexSegmentFile) MinorVersion

func (m *MockIndexSegmentFile) MinorVersion() int

MinorVersion mocks base method

func (*MockIndexSegmentFile) SegmentMetadata

func (m *MockIndexSegmentFile) SegmentMetadata() []byte

SegmentMetadata mocks base method

func (*MockIndexSegmentFile) SegmentType

SegmentType mocks base method

type MockIndexSegmentFileMockRecorder

type MockIndexSegmentFileMockRecorder struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFileMockRecorder is the mock recorder for MockIndexSegmentFile

func (*MockIndexSegmentFileMockRecorder) Files

Files indicates an expected call of Files

func (*MockIndexSegmentFileMockRecorder) MajorVersion

func (mr *MockIndexSegmentFileMockRecorder) MajorVersion() *gomock.Call

MajorVersion indicates an expected call of MajorVersion

func (*MockIndexSegmentFileMockRecorder) MinorVersion

func (mr *MockIndexSegmentFileMockRecorder) MinorVersion() *gomock.Call

MinorVersion indicates an expected call of MinorVersion

func (*MockIndexSegmentFileMockRecorder) SegmentMetadata

func (mr *MockIndexSegmentFileMockRecorder) SegmentMetadata() *gomock.Call

SegmentMetadata indicates an expected call of SegmentMetadata

func (*MockIndexSegmentFileMockRecorder) SegmentType

func (mr *MockIndexSegmentFileMockRecorder) SegmentType() *gomock.Call

SegmentType indicates an expected call of SegmentType

type MockIndexSegmentFileSet

type MockIndexSegmentFileSet struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFileSet is a mock of IndexSegmentFileSet interface

func NewMockIndexSegmentFileSet

func NewMockIndexSegmentFileSet(ctrl *gomock.Controller) *MockIndexSegmentFileSet

NewMockIndexSegmentFileSet creates a new mock instance

func (*MockIndexSegmentFileSet) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIndexSegmentFileSet) Files

Files mocks base method

func (*MockIndexSegmentFileSet) MajorVersion

func (m *MockIndexSegmentFileSet) MajorVersion() int

MajorVersion mocks base method

func (*MockIndexSegmentFileSet) MinorVersion

func (m *MockIndexSegmentFileSet) MinorVersion() int

MinorVersion mocks base method

func (*MockIndexSegmentFileSet) SegmentMetadata

func (m *MockIndexSegmentFileSet) SegmentMetadata() []byte

SegmentMetadata mocks base method

func (*MockIndexSegmentFileSet) SegmentType

SegmentType mocks base method

type MockIndexSegmentFileSetMockRecorder

type MockIndexSegmentFileSetMockRecorder struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFileSetMockRecorder is the mock recorder for MockIndexSegmentFileSet

func (*MockIndexSegmentFileSetMockRecorder) Files

Files indicates an expected call of Files

func (*MockIndexSegmentFileSetMockRecorder) MajorVersion

func (mr *MockIndexSegmentFileSetMockRecorder) MajorVersion() *gomock.Call

MajorVersion indicates an expected call of MajorVersion

func (*MockIndexSegmentFileSetMockRecorder) MinorVersion

func (mr *MockIndexSegmentFileSetMockRecorder) MinorVersion() *gomock.Call

MinorVersion indicates an expected call of MinorVersion

func (*MockIndexSegmentFileSetMockRecorder) SegmentMetadata

func (mr *MockIndexSegmentFileSetMockRecorder) SegmentMetadata() *gomock.Call

SegmentMetadata indicates an expected call of SegmentMetadata

func (*MockIndexSegmentFileSetMockRecorder) SegmentType

func (mr *MockIndexSegmentFileSetMockRecorder) SegmentType() *gomock.Call

SegmentType indicates an expected call of SegmentType

type MockIndexSegmentFileSetWriter

type MockIndexSegmentFileSetWriter struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFileSetWriter is a mock of IndexSegmentFileSetWriter interface

func NewMockIndexSegmentFileSetWriter

func NewMockIndexSegmentFileSetWriter(ctrl *gomock.Controller) *MockIndexSegmentFileSetWriter

NewMockIndexSegmentFileSetWriter creates a new mock instance

func (*MockIndexSegmentFileSetWriter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIndexSegmentFileSetWriter) Files

Files mocks base method

func (*MockIndexSegmentFileSetWriter) MajorVersion

func (m *MockIndexSegmentFileSetWriter) MajorVersion() int

MajorVersion mocks base method

func (*MockIndexSegmentFileSetWriter) MinorVersion

func (m *MockIndexSegmentFileSetWriter) MinorVersion() int

MinorVersion mocks base method

func (*MockIndexSegmentFileSetWriter) SegmentMetadata

func (m *MockIndexSegmentFileSetWriter) SegmentMetadata() []byte

SegmentMetadata mocks base method

func (*MockIndexSegmentFileSetWriter) SegmentType

SegmentType mocks base method

func (*MockIndexSegmentFileSetWriter) WriteFile

WriteFile mocks base method

type MockIndexSegmentFileSetWriterMockRecorder

type MockIndexSegmentFileSetWriterMockRecorder struct {
	// contains filtered or unexported fields
}

MockIndexSegmentFileSetWriterMockRecorder is the mock recorder for MockIndexSegmentFileSetWriter

func (*MockIndexSegmentFileSetWriterMockRecorder) Files

Files indicates an expected call of Files

func (*MockIndexSegmentFileSetWriterMockRecorder) MajorVersion

MajorVersion indicates an expected call of MajorVersion

func (*MockIndexSegmentFileSetWriterMockRecorder) MinorVersion

MinorVersion indicates an expected call of MinorVersion

func (*MockIndexSegmentFileSetWriterMockRecorder) SegmentMetadata

func (mr *MockIndexSegmentFileSetWriterMockRecorder) SegmentMetadata() *gomock.Call

SegmentMetadata indicates an expected call of SegmentMetadata

func (*MockIndexSegmentFileSetWriterMockRecorder) SegmentType

SegmentType indicates an expected call of SegmentType

func (*MockIndexSegmentFileSetWriterMockRecorder) WriteFile

func (mr *MockIndexSegmentFileSetWriterMockRecorder) WriteFile(arg0, arg1 interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile

type MockMergeWith

type MockMergeWith struct {
	// contains filtered or unexported fields
}

MockMergeWith is a mock of MergeWith interface

func NewMockMergeWith

func NewMockMergeWith(ctrl *gomock.Controller) *MockMergeWith

NewMockMergeWith creates a new mock instance

func (*MockMergeWith) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockMergeWith) ForEachRemaining

func (m *MockMergeWith) ForEachRemaining(arg0 context.Context, arg1 time0.UnixNano, arg2 ForEachRemainingFn, arg3 namespace.Context) error

ForEachRemaining mocks base method

func (*MockMergeWith) Read

func (m *MockMergeWith) Read(arg0 context.Context, arg1 ident.ID, arg2 time0.UnixNano, arg3 namespace.Context) ([]xio.BlockReader, bool, error)

Read mocks base method

type MockMergeWithMockRecorder

type MockMergeWithMockRecorder struct {
	// contains filtered or unexported fields
}

MockMergeWithMockRecorder is the mock recorder for MockMergeWith

func (*MockMergeWithMockRecorder) ForEachRemaining

func (mr *MockMergeWithMockRecorder) ForEachRemaining(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

ForEachRemaining indicates an expected call of ForEachRemaining

func (*MockMergeWithMockRecorder) Read

func (mr *MockMergeWithMockRecorder) Read(arg0, arg1, arg2, arg3 interface{}) *gomock.Call

Read indicates an expected call of Read

type MockSnapshotMetadataFileWriter

type MockSnapshotMetadataFileWriter struct {
	// contains filtered or unexported fields
}

MockSnapshotMetadataFileWriter is a mock of SnapshotMetadataFileWriter interface

func NewMockSnapshotMetadataFileWriter

func NewMockSnapshotMetadataFileWriter(ctrl *gomock.Controller) *MockSnapshotMetadataFileWriter

NewMockSnapshotMetadataFileWriter creates a new mock instance

func (*MockSnapshotMetadataFileWriter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockSnapshotMetadataFileWriter) Write

Write mocks base method

type MockSnapshotMetadataFileWriterMockRecorder

type MockSnapshotMetadataFileWriterMockRecorder struct {
	// contains filtered or unexported fields
}

MockSnapshotMetadataFileWriterMockRecorder is the mock recorder for MockSnapshotMetadataFileWriter

func (*MockSnapshotMetadataFileWriterMockRecorder) Write

func (mr *MockSnapshotMetadataFileWriterMockRecorder) Write(arg0 interface{}) *gomock.Call

Write indicates an expected call of Write

type NewMergerFn

type NewMergerFn func(
	reader DataFileSetReader,
	blockAllocSize int,
	srPool xio.SegmentReaderPool,
	multiIterPool encoding.MultiReaderIteratorPool,
	identPool ident.Pool,
	encoderPool encoding.EncoderPool,
	contextPool context.Pool,
	nsOpts namespace.Options,
) Merger

NewMergerFn is the function to call to get a new Merger.

type Options

type Options interface {
	// Validate will validate the options and return an error if not valid.
	Validate() error

	// SetClockOptions sets the clock options.
	SetClockOptions(value clock.Options) Options

	// ClockOptions returns the clock options.
	ClockOptions() clock.Options

	// SetInstrumentOptions sets the instrumentation options.
	SetInstrumentOptions(value instrument.Options) Options

	// InstrumentOptions returns the instrumentation options.
	InstrumentOptions() instrument.Options

	// SetRuntimeOptionsManager sets the runtime options manager.
	SetRuntimeOptionsManager(value runtime.OptionsManager) Options

	// RuntimeOptionsManager returns the runtime options manager.
	RuntimeOptionsManager() runtime.OptionsManager

	// SetDecodingOptions sets the decoding options.
	SetDecodingOptions(value msgpack.DecodingOptions) Options

	// DecodingOptions returns the decoding options.
	DecodingOptions() msgpack.DecodingOptions

	// SetFilePathPrefix sets the file path prefix for sharded TSDB files.
	SetFilePathPrefix(value string) Options

	// FilePathPrefix returns the file path prefix for sharded TSDB files.
	FilePathPrefix() string

	// SetNewFileMode sets the new file mode.
	SetNewFileMode(value os.FileMode) Options

	// NewFileMode returns the new file mode.
	NewFileMode() os.FileMode

	// SetNewDirectoryMode sets the new directory mode.
	SetNewDirectoryMode(value os.FileMode) Options

	// NewDirectoryMode returns the new directory mode.
	NewDirectoryMode() os.FileMode

	// SetIndexSummariesPercent size sets the percent of index summaries to write.
	SetIndexSummariesPercent(value float64) Options

	// IndexSummariesPercent size returns the percent of index summaries to write.
	IndexSummariesPercent() float64

	// SetIndexBloomFilterFalsePositivePercent size sets the percent of false positive
	// rate to use for the index bloom filter size and k hashes estimation
	SetIndexBloomFilterFalsePositivePercent(value float64) Options

	// IndexBloomFilterFalsePositivePercent size returns the percent of false positive
	// rate to use for the index bloom filter size and k hashes estimation.
	IndexBloomFilterFalsePositivePercent() float64

	// SetForceIndexSummariesMmapMemory sets whether the summaries files will be mmap'd
	// as an anonymous region, or as a file.
	SetForceIndexSummariesMmapMemory(value bool) Options

	// ForceIndexSummariesMmapMemory returns whether the summaries files will be mmap'd
	// as an anonymous region, or as a file.
	ForceIndexSummariesMmapMemory() bool

	// SetForceBloomFilterMmapMemory sets whether the bloom filters will be mmap'd.
	// as an anonymous region, or as a file.
	SetForceBloomFilterMmapMemory(value bool) Options

	// ForceBloomFilterMmapMemory returns whether the bloom filters will be mmap'd.
	// as an anonymous region, or as a file.
	ForceBloomFilterMmapMemory() bool

	// SetWriterBufferSize sets the buffer size for writing TSDB files.
	SetWriterBufferSize(value int) Options

	// WriterBufferSize returns the buffer size for writing TSDB files.
	WriterBufferSize() int

	// SetInfoReaderBufferSize sets the buffer size for reading TSDB info, digest and checkpoint files.
	SetInfoReaderBufferSize(value int) Options

	// InfoReaderBufferSize returns the buffer size for reading TSDB info, digest and checkpoint files.
	InfoReaderBufferSize() int

	// SetDataReaderBufferSize sets the buffer size for reading TSDB data and index files.
	SetDataReaderBufferSize(value int) Options

	// DataReaderBufferSize returns the buffer size for reading TSDB data and index files.
	DataReaderBufferSize() int

	// SetSeekReaderBufferSize size sets the buffer size for seeking TSDB files.
	SetSeekReaderBufferSize(value int) Options

	// SeekReaderBufferSize size returns the buffer size for seeking TSDB files.
	SeekReaderBufferSize() int

	// SetMmapEnableHugeTLB sets whether mmap huge pages are enabled when running on linux.
	SetMmapEnableHugeTLB(value bool) Options

	// MmapEnableHugeTLB returns whether mmap huge pages are enabled when running on linux.
	MmapEnableHugeTLB() bool

	// SetMmapHugeTLBThreshold sets the threshold when to use mmap huge pages for mmap'd files on linux.
	SetMmapHugeTLBThreshold(value int64) Options

	// MmapHugeTLBThreshold returns the threshold when to use mmap huge pages for mmap'd files on linux.
	MmapHugeTLBThreshold() int64

	// SetTagEncoderPool sets the tag encoder pool.
	SetTagEncoderPool(value serialize.TagEncoderPool) Options

	// TagEncoderPool returns the tag encoder pool.
	TagEncoderPool() serialize.TagEncoderPool

	// SetTagDecoderPool sets the tag decoder pool.
	SetTagDecoderPool(value serialize.TagDecoderPool) Options

	// TagDecoderPool returns the tag decoder pool.
	TagDecoderPool() serialize.TagDecoderPool

	// SetFStOptions sets the fst options.
	SetFSTOptions(value fst.Options) Options

	// FSTOptions returns the fst options.
	FSTOptions() fst.Options
}

Options represents the options for filesystem persistence.

func NewOptions

func NewOptions() Options

NewOptions creates a new set of fs options

type ReadIndexInfoFileResult

type ReadIndexInfoFileResult struct {
	ID   FileSetFileIdentifier
	Info index.IndexInfo
	Err  ReadInfoFileResultError
}

ReadIndexInfoFileResult is the result of reading an info file

func ReadIndexInfoFiles

func ReadIndexInfoFiles(
	filePathPrefix string,
	namespace ident.ID,
	readerBufferSize int,
) []ReadIndexInfoFileResult

ReadIndexInfoFiles reads all the valid index info entries. Even if ReadIndexInfoFiles returns an error, there may be some valid entries in the returned slice.

type ReadIndexSegmentsOptions

type ReadIndexSegmentsOptions struct {
	// ReaderOptions is the index file set reader options.
	ReaderOptions IndexReaderOpenOptions

	// FilesystemOptions is the filesystem options which is
	// required for reading index segments.
	FilesystemOptions Options
	// contains filtered or unexported fields
}

ReadIndexSegmentsOptions is a set of options used when reading index segments.

type ReadInfoFileResult

type ReadInfoFileResult struct {
	Info schema.IndexInfo
	Err  ReadInfoFileResultError
}

ReadInfoFileResult is the result of reading an info file

func ReadInfoFiles

func ReadInfoFiles(
	filePathPrefix string,
	namespace ident.ID,
	shard uint32,
	readerBufferSize int,
	decodingOpts msgpack.DecodingOptions,
) []ReadInfoFileResult

ReadInfoFiles reads all the valid info entries. Even if ReadInfoFiles returns an error, there may be some valid entries in the returned slice.

type ReadInfoFileResultError

type ReadInfoFileResultError interface {
	Error() error
	Filepath() string
}

ReadInfoFileResultError is the interface for obtaining information about an error that occurred trying to read an info file

type ReaderOpenOptionsMatcher

type ReaderOpenOptionsMatcher struct {
	ID          FileSetFileIdentifier
	FileSetType persist.FileSetType
}

ReaderOpenOptionsMatcher is a matcher for the DataReaderOpenOptions struct

func (ReaderOpenOptionsMatcher) Matches

func (m ReaderOpenOptionsMatcher) Matches(x interface{}) bool

Matches determine whether m matches a DataWriterOpenOptions

func (ReaderOpenOptionsMatcher) String

func (m ReaderOpenOptionsMatcher) String() string

type RetrievableDataBlockSegmentReader

type RetrievableDataBlockSegmentReader interface {
	xio.SegmentReader
}

RetrievableDataBlockSegmentReader is a retrievable block reader

type RetrieveRequestPool

type RetrieveRequestPool interface {
	Init()
	Get() *retrieveRequest
	Put(req *retrieveRequest)
}

RetrieveRequestPool is the retrieve request pool.

func NewRetrieveRequestPool

func NewRetrieveRequestPool(
	segmentReaderPool xio.SegmentReaderPool,
	opts pool.ObjectPoolOptions,
) RetrieveRequestPool

NewRetrieveRequestPool returns a new retrieve request pool.

type ReusableSeekerResources

type ReusableSeekerResources struct {
	// contains filtered or unexported fields
}

ReusableSeekerResources is a collection of reusable resources that the seeker requires for seeking. It can be pooled by callers using the seeker so that expensive resources don't need to be maintained for each seeker, especially when only a few are generally being used at a time due to the FetchConcurrency.

func NewReusableSeekerResources

func NewReusableSeekerResources(opts Options) ReusableSeekerResources

NewReusableSeekerResources creates a new ReusableSeekerResources.

type SnapshotMetadata

type SnapshotMetadata struct {
	ID                  SnapshotMetadataIdentifier
	CommitlogIdentifier persist.CommitLogFile
	MetadataFilePath    string
	CheckpointFilePath  string
}

SnapshotMetadata represents a SnapshotMetadata file, along with its checkpoint file, as well as all the information contained within the metadata file and paths to the physical files on disk.

func (SnapshotMetadata) AbsoluteFilepaths

func (s SnapshotMetadata) AbsoluteFilepaths() []string

AbsoluteFilepaths returns a slice of all the absolute filepaths associated with a snapshot metadata.

type SnapshotMetadataErrorWithPaths

type SnapshotMetadataErrorWithPaths struct {
	Error              error
	MetadataFilePath   string
	CheckpointFilePath string
}

SnapshotMetadataErrorWithPaths contains an error that occurred while trying to read a snapshot metadata file, as well as paths for the metadata file path and the checkpoint file path so that they can be cleaned up. The checkpoint file may not exist if only the metadata file was written out (due to sudden node failure) or if the metadata file name was structured incorrectly (should never happen.)

type SnapshotMetadataFileReader

type SnapshotMetadataFileReader interface {
	Read(id SnapshotMetadataIdentifier) (SnapshotMetadata, error)
}

SnapshotMetadataFileReader reads snapshot metadata files.

type SnapshotMetadataFileWriter

type SnapshotMetadataFileWriter interface {
	Write(args SnapshotMetadataWriteArgs) error
}

SnapshotMetadataFileWriter writes out snapshot metadata files.

type SnapshotMetadataIdentifier

type SnapshotMetadataIdentifier struct {
	Index int64
	UUID  uuid.UUID
}

SnapshotMetadataIdentifier is an identifier for a snapshot metadata file

type SnapshotMetadataReader

type SnapshotMetadataReader struct {
	// contains filtered or unexported fields
}

SnapshotMetadataReader is a reader for SnapshotMetadata.

func NewSnapshotMetadataReader

func NewSnapshotMetadataReader(opts Options) *SnapshotMetadataReader

NewSnapshotMetadataReader returns a new SnapshotMetadataReader.

func (*SnapshotMetadataReader) Read

type SnapshotMetadataWriteArgs

type SnapshotMetadataWriteArgs struct {
	ID                  SnapshotMetadataIdentifier
	CommitlogIdentifier persist.CommitLogFile
}

SnapshotMetadataWriteArgs are the arguments for SnapshotMetadataWriter.Write.

type SnapshotMetadataWriter

type SnapshotMetadataWriter struct {
	// contains filtered or unexported fields
}

SnapshotMetadataWriter is a writer for SnapshotMetadata.

func NewSnapshotMetadataWriter

func NewSnapshotMetadataWriter(opts Options) *SnapshotMetadataWriter

NewSnapshotMetadataWriter constructs a new snapshot metadata writer.

func (*SnapshotMetadataWriter) Write

func (w *SnapshotMetadataWriter) Write(args SnapshotMetadataWriteArgs) (finalErr error)

Directories

Path Synopsis
Package commitlog is a generated GoMock package.
Package commitlog is a generated GoMock package.

Jump to

Keyboard shortcuts

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