doc

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 32

Documentation

Overview

Package doc is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrEmptyDocument is an error for an empty document.
	ErrEmptyDocument = errors.New("document cannot be empty")
)
View Source
var IDReservedFieldName = []byte("_m3ninx_id")

IDReservedFieldName is the field name reserved for IDs.

Functions

This section is empty.

Types

type Document

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

Document contains either metadata or an encoded metadata but never both.

func NewDocumentFromEncoded added in v1.0.1

func NewDocumentFromEncoded(e Encoded) Document

NewDocumentFromEncoded creates a Document from an Encoded.

func NewDocumentFromMetadata added in v1.0.1

func NewDocumentFromMetadata(m Metadata) Document

NewDocumentFromMetadata creates a Document from a Metadata.

func (*Document) Encoded added in v1.0.1

func (d *Document) Encoded() (Encoded, bool)

Encoded returns the encoded metadata it contains, if it has one. Otherwise returns an empty encoded metadata and false.

func (*Document) Metadata added in v1.0.1

func (d *Document) Metadata() (Metadata, bool)

Metadata returns the metadata it contains, if it has one. Otherwise returns an empty metadata and false.

type DocumentArr added in v0.5.0

type DocumentArr []Document

type DocumentArrPool added in v0.5.0

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

func (*DocumentArrPool) Get added in v0.5.0

func (p *DocumentArrPool) Get() []Document

func (*DocumentArrPool) Init added in v0.5.0

func (p *DocumentArrPool) Init()

func (*DocumentArrPool) Put added in v0.5.0

func (p *DocumentArrPool) Put(arr []Document)

type DocumentArrayPool added in v0.5.0

type DocumentArrayPool interface {
	// Init initializes the array pool, it needs to be called
	// before Get/Put use.
	Init()

	// Get returns the a slice from the pool.
	Get() []Document

	// Put returns the provided slice to the pool.
	Put(elems []Document)
}

DocumentArrayPool provides a pool for document slices.

func NewDocumentArrayPool added in v0.5.0

func NewDocumentArrayPool(opts DocumentArrayPoolOpts) DocumentArrayPool

type DocumentArrayPoolOpts added in v0.5.0

type DocumentArrayPoolOpts struct {
	Options     pool.ObjectPoolOptions
	Capacity    int
	MaxCapacity int
	FinalizeFn  DocumentFinalizeFn
}

type DocumentFinalizeFn added in v0.5.0

type DocumentFinalizeFn func([]Document) []Document

type DocumentMatcher

type DocumentMatcher interface {
	gomock.Matcher
}

DocumentMatcher matches a given document.

func NewDocumentMatcher

func NewDocumentMatcher(d Metadata) DocumentMatcher

NewDocumentMatcher returns a new DocumentMatcher.

type Documents

type Documents []Metadata

Documents is a list of documents.

func (Documents) Len

func (ds Documents) Len() int

func (Documents) Less

func (ds Documents) Less(i, j int) bool

func (Documents) Swap

func (ds Documents) Swap(i, j int)

type Encoded added in v1.0.1

type Encoded struct {
	Bytes []byte
}

Encoded is a serialized document metadata.

type Field

type Field struct {
	Name  []byte
	Value []byte
}

Field represents a field in a document. It is composed of a name and a value.

type Fields

type Fields []Field

Fields is a list of fields.

func (Fields) Len

func (f Fields) Len() int

func (Fields) Less

func (f Fields) Less(i, j int) bool

func (Fields) Swap

func (f Fields) Swap(i, j int)

type Iterator

type Iterator interface {
	// Next returns a bool indicating if the iterator has any more documents
	// to return.
	Next() bool

	// Current returns the current document. It is only safe to call Current immediately
	// after a call to Next confirms there are more elements remaining. The Document
	// returned from Current is only valid until the following call to Next(). Callers
	// should copy the Document if they need it live longer.
	Current() Document

	// Err returns any errors encountered during iteration.
	Err() error

	// Close releases any internal resources used by the iterator.
	Close() error
}

Iterator provides an iterator over a collection of documents. It is NOT safe for multiple goroutines to invoke methods on an Iterator simultaneously.

type Metadata added in v1.0.1

type Metadata struct {
	ID     []byte
	Fields []Field
}

Metadata represents a document to be indexed.

func (Metadata) Compare added in v1.0.1

func (m Metadata) Compare(other Metadata) int

Compare returns an integer comparing two documents. The result will be 0 if the documents are equal, -1 if d is ordered before other, and 1 if d is ordered aftered other.

func (Metadata) Equal added in v1.0.1

func (m Metadata) Equal(other Metadata) bool

Equal returns a bool indicating whether d is equal to other.

func (Metadata) Get added in v1.0.1

func (m Metadata) Get(fieldName []byte) ([]byte, bool)

Get returns the value of the specified field name in the document if it exists.

func (Metadata) HasID added in v1.0.1

func (m Metadata) HasID() bool

HasID returns a bool indicating whether the document has an ID or not.

func (Metadata) String added in v1.0.1

func (m Metadata) String() string

func (Metadata) Validate added in v1.0.1

func (m Metadata) Validate() error

Validate returns a bool indicating whether the document is valid.

type MetadataArr added in v1.0.1

type MetadataArr []Metadata

type MetadataArrPool added in v1.0.1

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

func (*MetadataArrPool) Get added in v1.0.1

func (p *MetadataArrPool) Get() []Metadata

func (*MetadataArrPool) Init added in v1.0.1

func (p *MetadataArrPool) Init()

func (*MetadataArrPool) Put added in v1.0.1

func (p *MetadataArrPool) Put(arr []Metadata)

type MetadataArrayPool added in v1.0.1

type MetadataArrayPool interface {
	// Init initializes the array pool, it needs to be called
	// before Get/Put use.
	Init()

	// Get returns the a slice from the pool.
	Get() []Metadata

	// Put returns the provided slice to the pool.
	Put(elems []Metadata)
}

MetadataArrayPool provides a pool for metadata slices.

func NewMetadataArrayPool added in v1.0.1

func NewMetadataArrayPool(opts MetadataArrayPoolOpts) MetadataArrayPool

type MetadataArrayPoolOpts added in v1.0.1

type MetadataArrayPoolOpts struct {
	Options     pool.ObjectPoolOptions
	Capacity    int
	MaxCapacity int
	FinalizeFn  MetadataFinalizeFn
}

type MetadataFinalizeFn added in v1.0.1

type MetadataFinalizeFn func([]Metadata) []Metadata

type MetadataIterator added in v1.0.1

type MetadataIterator interface {
	// Next returns a bool indicating if the iterator has any more metadata
	// to return.
	Next() bool

	// Current returns the current metadata. It is only safe to call Current immediately
	// after a call to Next confirms there are more elements remaining. The Metadata
	// returned from Current is only valid until the following call to Next(). Callers
	// should copy the Metadata if they need it live longer.
	Current() Metadata

	// Err returns any errors encountered during iteration.
	Err() error

	// Close releases any internal resources used by the iterator.
	Close() error
}

MetadataIterator provides an iterator over a collection of document metadata. It is NOT safe for multiple goroutines to invoke methods on an MetadataIterator simultaneously.

type MockIterator

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

MockIterator is a mock of Iterator interface

func NewMockIterator

func NewMockIterator(ctrl *gomock.Controller) *MockIterator

NewMockIterator creates a new mock instance

func (*MockIterator) Close

func (m *MockIterator) Close() error

Close mocks base method

func (*MockIterator) Current

func (m *MockIterator) Current() Document

Current mocks base method

func (*MockIterator) EXPECT

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

func (*MockIterator) Err

func (m *MockIterator) Err() error

Err mocks base method

func (*MockIterator) Next

func (m *MockIterator) Next() bool

Next mocks base method

type MockIteratorMockRecorder

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

MockIteratorMockRecorder is the mock recorder for MockIterator

func (*MockIteratorMockRecorder) Close

func (mr *MockIteratorMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockIteratorMockRecorder) Current

func (mr *MockIteratorMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current

func (*MockIteratorMockRecorder) Err

Err indicates an expected call of Err

func (*MockIteratorMockRecorder) Next

func (mr *MockIteratorMockRecorder) Next() *gomock.Call

Next indicates an expected call of Next

type MockMetadataIterator added in v1.0.1

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

MockMetadataIterator is a mock of MetadataIterator interface

func NewMockMetadataIterator added in v1.0.1

func NewMockMetadataIterator(ctrl *gomock.Controller) *MockMetadataIterator

NewMockMetadataIterator creates a new mock instance

func (*MockMetadataIterator) Close added in v1.0.1

func (m *MockMetadataIterator) Close() error

Close mocks base method

func (*MockMetadataIterator) Current added in v1.0.1

func (m *MockMetadataIterator) Current() Metadata

Current mocks base method

func (*MockMetadataIterator) EXPECT added in v1.0.1

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

func (*MockMetadataIterator) Err added in v1.0.1

func (m *MockMetadataIterator) Err() error

Err mocks base method

func (*MockMetadataIterator) Next added in v1.0.1

func (m *MockMetadataIterator) Next() bool

Next mocks base method

type MockMetadataIteratorMockRecorder added in v1.0.1

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

MockMetadataIteratorMockRecorder is the mock recorder for MockMetadataIterator

func (*MockMetadataIteratorMockRecorder) Close added in v1.0.1

Close indicates an expected call of Close

func (*MockMetadataIteratorMockRecorder) Current added in v1.0.1

Current indicates an expected call of Current

func (*MockMetadataIteratorMockRecorder) Err added in v1.0.1

Err indicates an expected call of Err

func (*MockMetadataIteratorMockRecorder) Next added in v1.0.1

Next indicates an expected call of Next

Jump to

Keyboard shortcuts

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