persist

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Overview

Package persist is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// TypeRegex allows what can be used for a IndexSegmentType or
	// IndexSegmentFileType, explicitly cannot use "-" as that can be
	// then used as a separator elsewhere, also it ensures callers must
	// use lower cased strings.
	TypeRegex = regexp.MustCompile("^[a-z_]+$")
)

Functions

func NewSegment

func NewSegment(fileset IndexSegmentFileSet, opts fst.Options) (fst.Segment, error)

NewSegment returns a new fst.Segment backed by the provided fileset. NB: this method takes ownership of the provided fileset files, in case of both errors, and success. i.e. users are not expected to call Close on any of the provided fileset.Files() after invoking this function.

Types

type IndexFileSetReader

type IndexFileSetReader interface {
	// SegmentFileSets returns the number of segment file sets.
	SegmentFileSets() int

	// ReadSegmentFileSet returns the next segment file set or an error.
	// It will return io.EOF error when no more file sets remain.
	// The IndexSegmentFileSet will only be valid before it's closed,
	// after that calls to Read or Bytes on it will have unexpected results.
	ReadSegmentFileSet() (IndexSegmentFileSet, error)

	IndexVolumeType() IndexVolumeType
}

IndexFileSetReader is an index file set reader, it can read many segments.

type IndexFileSetWriter

type IndexFileSetWriter interface {
	// WriteSegmentFileSet writes a index segment file set.
	WriteSegmentFileSet(segmentFileSet IndexSegmentFileSetWriter) error
}

IndexFileSetWriter is an index file set writer, it can write out many segments.

type IndexSegmentFile

type IndexSegmentFile interface {
	io.Reader
	io.Closer

	// SegmentFileType returns the segment file type.
	SegmentFileType() IndexSegmentFileType

	// Mmap will be valid until the segment file is closed.
	Mmap() (mmap.Descriptor, error)
}

IndexSegmentFile is a file in an index segment file set.

type IndexSegmentFileSet

type IndexSegmentFileSet interface {
	SegmentType() IndexSegmentType
	MajorVersion() int
	MinorVersion() int
	SegmentMetadata() []byte
	Files() []IndexSegmentFile
}

IndexSegmentFileSet is an index segment file set.

type IndexSegmentFileSetWriter

type IndexSegmentFileSetWriter interface {
	SegmentType() IndexSegmentType
	MajorVersion() int
	MinorVersion() int
	SegmentMetadata() []byte
	Files() []IndexSegmentFileType
	WriteFile(fileType IndexSegmentFileType, writer io.Writer) error
}

IndexSegmentFileSetWriter is an index segment file set writer.

func NewFSTSegmentDataFileSetWriter added in v0.15.0

func NewFSTSegmentDataFileSetWriter(
	data fst.SegmentData,
) (IndexSegmentFileSetWriter, error)

NewFSTSegmentDataFileSetWriter creates a new file set writer for fst segment data.

type IndexSegmentFileType

type IndexSegmentFileType string

IndexSegmentFileType is the type of a file in an index file set.

const (
	// DocumentDataIndexSegmentFileType is a document data segment file.
	DocumentDataIndexSegmentFileType IndexSegmentFileType = "docdata"

	// DocumentIndexIndexSegmentFileType is a document index segment file.
	DocumentIndexIndexSegmentFileType IndexSegmentFileType = "docidx"

	// PostingsIndexSegmentFileType is a postings List data index segment file.
	PostingsIndexSegmentFileType IndexSegmentFileType = "postingsdata"

	// FSTFieldsIndexSegmentFileType is a FST Fields index segment file.
	FSTFieldsIndexSegmentFileType IndexSegmentFileType = "fstfields"

	// FSTTermsIndexSegmentFileType is a FST Terms index segment file.
	FSTTermsIndexSegmentFileType IndexSegmentFileType = "fstterms"
)

func (IndexSegmentFileType) Validate

func (t IndexSegmentFileType) Validate() error

Validate validates whether the string value is a valid segment file type and contains only lowercase a-z and underscore characters.

type IndexSegmentType

type IndexSegmentType string

IndexSegmentType is the type of an index file set.

const (
	// FSTIndexSegmentType is a FST IndexSegmentType.
	FSTIndexSegmentType IndexSegmentType = "fst"
)

func (IndexSegmentType) Validate

func (t IndexSegmentType) Validate() error

Validate validates whether the string value is a valid segment type and contains only lowercase a-z and underscore characters.

type IndexVolumeType added in v0.15.0

type IndexVolumeType string

IndexVolumeType is the type of an index volume.

const (
	// DefaultIndexVolumeType is a default IndexVolumeType.
	// This is the type if not otherwise specified.
	DefaultIndexVolumeType IndexVolumeType = "default"
)

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) EXPECT

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

func (*MockIndexFileSetReader) IndexVolumeType added in v0.15.0

func (m *MockIndexFileSetReader) IndexVolumeType() IndexVolumeType

IndexVolumeType mocks base method.

func (*MockIndexFileSetReader) ReadSegmentFileSet

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

ReadSegmentFileSet mocks base method.

func (*MockIndexFileSetReader) SegmentFileSets

func (m *MockIndexFileSetReader) SegmentFileSets() int

SegmentFileSets mocks base method.

type MockIndexFileSetReaderMockRecorder

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

MockIndexFileSetReaderMockRecorder is the mock recorder for MockIndexFileSetReader.

func (*MockIndexFileSetReaderMockRecorder) IndexVolumeType added in v0.15.0

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

IndexVolumeType indicates an expected call of IndexVolumeType.

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.

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) EXPECT

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

func (*MockIndexFileSetWriter) WriteSegmentFileSet

func (m *MockIndexFileSetWriter) WriteSegmentFileSet(segmentFileSet 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) WriteSegmentFileSet

func (mr *MockIndexFileSetWriterMockRecorder) WriteSegmentFileSet(segmentFileSet 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) Close

func (m *MockIndexSegmentFile) Close() error

Close mocks base method.

func (*MockIndexSegmentFile) EXPECT

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

func (*MockIndexSegmentFile) Mmap added in v0.15.0

Mmap mocks base method.

func (*MockIndexSegmentFile) Read

func (m *MockIndexSegmentFile) Read(p []byte) (int, error)

Read mocks base method.

func (*MockIndexSegmentFile) SegmentFileType

func (m *MockIndexSegmentFile) SegmentFileType() IndexSegmentFileType

SegmentFileType mocks base method.

type MockIndexSegmentFileMockRecorder

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

MockIndexSegmentFileMockRecorder is the mock recorder for MockIndexSegmentFile.

func (*MockIndexSegmentFileMockRecorder) Close

Close indicates an expected call of Close.

func (*MockIndexSegmentFileMockRecorder) Mmap added in v0.15.0

Mmap indicates an expected call of Mmap.

func (*MockIndexSegmentFileMockRecorder) Read

func (mr *MockIndexSegmentFileMockRecorder) Read(p interface{}) *gomock.Call

Read indicates an expected call of Read.

func (*MockIndexSegmentFileMockRecorder) SegmentFileType

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

SegmentFileType indicates an expected call of SegmentFileType.

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

func (m *MockIndexSegmentFileSet) SegmentType() IndexSegmentType

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

func (m *MockIndexSegmentFileSetWriter) WriteFile(fileType IndexSegmentFileType, writer io.Writer) error

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(fileType, writer interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile.

type MockMutableSegmentFileSetWriter

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

MockMutableSegmentFileSetWriter is a mock of MutableSegmentFileSetWriter interface.

func NewMockMutableSegmentFileSetWriter

func NewMockMutableSegmentFileSetWriter(ctrl *gomock.Controller) *MockMutableSegmentFileSetWriter

NewMockMutableSegmentFileSetWriter creates a new mock instance.

func (*MockMutableSegmentFileSetWriter) EXPECT

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

func (*MockMutableSegmentFileSetWriter) Files

Files mocks base method.

func (*MockMutableSegmentFileSetWriter) MajorVersion

func (m *MockMutableSegmentFileSetWriter) MajorVersion() int

MajorVersion mocks base method.

func (*MockMutableSegmentFileSetWriter) MinorVersion

func (m *MockMutableSegmentFileSetWriter) MinorVersion() int

MinorVersion mocks base method.

func (*MockMutableSegmentFileSetWriter) Reset

Reset mocks base method.

func (*MockMutableSegmentFileSetWriter) SegmentMetadata

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

SegmentMetadata mocks base method.

func (*MockMutableSegmentFileSetWriter) SegmentType

SegmentType mocks base method.

func (*MockMutableSegmentFileSetWriter) WriteFile

func (m *MockMutableSegmentFileSetWriter) WriteFile(fileType IndexSegmentFileType, writer io.Writer) error

WriteFile mocks base method.

type MockMutableSegmentFileSetWriterMockRecorder

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

MockMutableSegmentFileSetWriterMockRecorder is the mock recorder for MockMutableSegmentFileSetWriter.

func (*MockMutableSegmentFileSetWriterMockRecorder) Files

Files indicates an expected call of Files.

func (*MockMutableSegmentFileSetWriterMockRecorder) MajorVersion

MajorVersion indicates an expected call of MajorVersion.

func (*MockMutableSegmentFileSetWriterMockRecorder) MinorVersion

MinorVersion indicates an expected call of MinorVersion.

func (*MockMutableSegmentFileSetWriterMockRecorder) Reset

func (mr *MockMutableSegmentFileSetWriterMockRecorder) Reset(arg0 interface{}) *gomock.Call

Reset indicates an expected call of Reset.

func (*MockMutableSegmentFileSetWriterMockRecorder) SegmentMetadata

SegmentMetadata indicates an expected call of SegmentMetadata.

func (*MockMutableSegmentFileSetWriterMockRecorder) SegmentType

SegmentType indicates an expected call of SegmentType.

func (*MockMutableSegmentFileSetWriterMockRecorder) WriteFile

func (mr *MockMutableSegmentFileSetWriterMockRecorder) WriteFile(fileType, writer interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile.

type MutableSegmentFileSetWriter

type MutableSegmentFileSetWriter interface {
	IndexSegmentFileSetWriter

	// Reset resets the writer to write the provided mutable segment.
	Reset(segment.Builder) error
}

MutableSegmentFileSetWriter is a new IndexSegmentFileSetWriter for writing out Mutable Segments.

func NewMutableSegmentFileSetWriter

func NewMutableSegmentFileSetWriter(
	fstOpts fst.WriterOptions,
) (MutableSegmentFileSetWriter, error)

NewMutableSegmentFileSetWriter returns a new IndexSegmentFileSetWriter for writing out the provided Mutable Segment.

Jump to

Keyboard shortcuts

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