postings

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: 6 Imported by: 26

Documentation

Overview

Package postings is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyList is the error returned when a postings list is unexpectedly empty.
	ErrEmptyList = errors.New("postings list is empty")
)

Functions

This section is empty.

Types

type AtomicID

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

AtomicID is an atomic ID.

func NewAtomicID

func NewAtomicID(id ID) AtomicID

NewAtomicID creates a new AtomicID.

func (AtomicID) Add

func (id AtomicID) Add(n uint32) ID

Add atomically adds n to the ID and returns the new ID.

func (AtomicID) Inc

func (id AtomicID) Inc() ID

Inc atomically increments the ID and returns the new value.

func (AtomicID) Load

func (id AtomicID) Load() ID

Load atomically loads the ID.

type ID

type ID uint32

ID is the unique identifier of an element in the postings list. TODO: Use a uint64, currently we only use uint32 because we use Roaring Bitmaps for the implementation of the postings list. Pilosa has an implementation of Roaring Bitmaps using uint64s.

const (
	// MaxID is the maximum possible value for a postings ID.
	// TODO: Update these use uint64 when we update ID.
	MaxID ID = ID(math.MaxUint32)
)

type Iterator

type Iterator interface {
	// Next returns whether the iterator has another postings ID.
	Next() bool

	// Current returns the current postings ID. It is only safe to call Current immediately
	// after a call to Next confirms there are more IDs remaining.
	Current() ID

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

	// Close closes the iterator.
	Close() error
}

Iterator is an iterator over a postings list. The iterator is guaranteed to return IDs in increasing order. It is not safe for concurrent access.

func NewRangeIterator

func NewRangeIterator(startInclusive, endExclusive ID) Iterator

NewRangeIterator returns a new Iterator over the specified range.

type List

type List interface {
	// Contains returns whether the specified ID is contained in this postings list.
	Contains(id ID) bool

	// IsEmpty returns whether the postings list is empty. Some posting lists have an
	// optimized implementation to determine if they are empty which is faster than
	// calculating the size of the postings list.
	IsEmpty() bool

	// Max returns the maximum ID in the postings list or an error if it is empty.
	Max() (ID, error)

	// Len returns the numbers of IDs in the postings list.
	Len() int

	// Iterator returns an iterator over the IDs in the postings list.
	Iterator() Iterator

	// CloneAsMutable returns a mutable deep copy of the postings list.
	CloneAsMutable() MutableList

	// Equal returns whether this postings list contains the same posting IDs as other.
	Equal(other List) bool

	// Intersect returns a new postings list containing only those DocIDs which are
	// in both this postings list and other.
	Intersect(other List) (List, error)

	// Difference returns a new postings list containing only those DocIDs which are
	// in this postings list but not other.
	Difference(other List) (List, error)
}

List is a collection of docIDs. The interface only supports immutable methods.

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() ID

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 MockList

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

MockList is a mock of List interface.

func NewMockList

func NewMockList(ctrl *gomock.Controller) *MockList

NewMockList creates a new mock instance.

func (*MockList) CloneAsMutable added in v1.4.2

func (m *MockList) CloneAsMutable() MutableList

CloneAsMutable mocks base method.

func (*MockList) Contains

func (m *MockList) Contains(id ID) bool

Contains mocks base method.

func (*MockList) Difference added in v1.4.2

func (m *MockList) Difference(other List) (List, error)

Difference mocks base method.

func (*MockList) EXPECT

func (m *MockList) EXPECT() *MockListMockRecorder

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

func (*MockList) Equal

func (m *MockList) Equal(other List) bool

Equal mocks base method.

func (*MockList) Intersect added in v1.4.2

func (m *MockList) Intersect(other List) (List, error)

Intersect mocks base method.

func (*MockList) IsEmpty

func (m *MockList) IsEmpty() bool

IsEmpty mocks base method.

func (*MockList) Iterator

func (m *MockList) Iterator() Iterator

Iterator mocks base method.

func (*MockList) Len

func (m *MockList) Len() int

Len mocks base method.

func (*MockList) Max

func (m *MockList) Max() (ID, error)

Max mocks base method.

type MockListMockRecorder

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

MockListMockRecorder is the mock recorder for MockList.

func (*MockListMockRecorder) CloneAsMutable added in v1.4.2

func (mr *MockListMockRecorder) CloneAsMutable() *gomock.Call

CloneAsMutable indicates an expected call of CloneAsMutable.

func (*MockListMockRecorder) Contains

func (mr *MockListMockRecorder) Contains(id interface{}) *gomock.Call

Contains indicates an expected call of Contains.

func (*MockListMockRecorder) Difference added in v1.4.2

func (mr *MockListMockRecorder) Difference(other interface{}) *gomock.Call

Difference indicates an expected call of Difference.

func (*MockListMockRecorder) Equal

func (mr *MockListMockRecorder) Equal(other interface{}) *gomock.Call

Equal indicates an expected call of Equal.

func (*MockListMockRecorder) Intersect added in v1.4.2

func (mr *MockListMockRecorder) Intersect(other interface{}) *gomock.Call

Intersect indicates an expected call of Intersect.

func (*MockListMockRecorder) IsEmpty

func (mr *MockListMockRecorder) IsEmpty() *gomock.Call

IsEmpty indicates an expected call of IsEmpty.

func (*MockListMockRecorder) Iterator

func (mr *MockListMockRecorder) Iterator() *gomock.Call

Iterator indicates an expected call of Iterator.

func (*MockListMockRecorder) Len

func (mr *MockListMockRecorder) Len() *gomock.Call

Len indicates an expected call of Len.

func (*MockListMockRecorder) Max

func (mr *MockListMockRecorder) Max() *gomock.Call

Max indicates an expected call of Max.

type MockMutableList

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

MockMutableList is a mock of MutableList interface.

func NewMockMutableList

func NewMockMutableList(ctrl *gomock.Controller) *MockMutableList

NewMockMutableList creates a new mock instance.

func (*MockMutableList) AddIterator

func (m *MockMutableList) AddIterator(iter Iterator) error

AddIterator mocks base method.

func (*MockMutableList) AddRange

func (m *MockMutableList) AddRange(min, max ID) error

AddRange mocks base method.

func (*MockMutableList) CloneAsMutable added in v1.4.2

func (m *MockMutableList) CloneAsMutable() MutableList

CloneAsMutable mocks base method.

func (*MockMutableList) Contains

func (m *MockMutableList) Contains(id ID) bool

Contains mocks base method.

func (*MockMutableList) Difference

func (m *MockMutableList) Difference(other List) (List, error)

Difference mocks base method.

func (*MockMutableList) EXPECT

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

func (*MockMutableList) Equal

func (m *MockMutableList) Equal(other List) bool

Equal mocks base method.

func (*MockMutableList) Insert

func (m *MockMutableList) Insert(i ID) error

Insert mocks base method.

func (*MockMutableList) Intersect

func (m *MockMutableList) Intersect(other List) (List, error)

Intersect mocks base method.

func (*MockMutableList) IsEmpty

func (m *MockMutableList) IsEmpty() bool

IsEmpty mocks base method.

func (*MockMutableList) Iterator

func (m *MockMutableList) Iterator() Iterator

Iterator mocks base method.

func (*MockMutableList) Len

func (m *MockMutableList) Len() int

Len mocks base method.

func (*MockMutableList) Max

func (m *MockMutableList) Max() (ID, error)

Max mocks base method.

func (*MockMutableList) RemoveRange

func (m *MockMutableList) RemoveRange(min, max ID) error

RemoveRange mocks base method.

func (*MockMutableList) Reset

func (m *MockMutableList) Reset()

Reset mocks base method.

func (*MockMutableList) UnionInPlace added in v1.4.2

func (m *MockMutableList) UnionInPlace(other List) error

UnionInPlace mocks base method.

func (*MockMutableList) UnionManyInPlace added in v1.4.2

func (m *MockMutableList) UnionManyInPlace(others []List) error

UnionManyInPlace mocks base method.

type MockMutableListMockRecorder

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

MockMutableListMockRecorder is the mock recorder for MockMutableList.

func (*MockMutableListMockRecorder) AddIterator

func (mr *MockMutableListMockRecorder) AddIterator(iter interface{}) *gomock.Call

AddIterator indicates an expected call of AddIterator.

func (*MockMutableListMockRecorder) AddRange

func (mr *MockMutableListMockRecorder) AddRange(min, max interface{}) *gomock.Call

AddRange indicates an expected call of AddRange.

func (*MockMutableListMockRecorder) CloneAsMutable added in v1.4.2

func (mr *MockMutableListMockRecorder) CloneAsMutable() *gomock.Call

CloneAsMutable indicates an expected call of CloneAsMutable.

func (*MockMutableListMockRecorder) Contains

func (mr *MockMutableListMockRecorder) Contains(id interface{}) *gomock.Call

Contains indicates an expected call of Contains.

func (*MockMutableListMockRecorder) Difference

func (mr *MockMutableListMockRecorder) Difference(other interface{}) *gomock.Call

Difference indicates an expected call of Difference.

func (*MockMutableListMockRecorder) Equal

func (mr *MockMutableListMockRecorder) Equal(other interface{}) *gomock.Call

Equal indicates an expected call of Equal.

func (*MockMutableListMockRecorder) Insert

func (mr *MockMutableListMockRecorder) Insert(i interface{}) *gomock.Call

Insert indicates an expected call of Insert.

func (*MockMutableListMockRecorder) Intersect

func (mr *MockMutableListMockRecorder) Intersect(other interface{}) *gomock.Call

Intersect indicates an expected call of Intersect.

func (*MockMutableListMockRecorder) IsEmpty

func (mr *MockMutableListMockRecorder) IsEmpty() *gomock.Call

IsEmpty indicates an expected call of IsEmpty.

func (*MockMutableListMockRecorder) Iterator

func (mr *MockMutableListMockRecorder) Iterator() *gomock.Call

Iterator indicates an expected call of Iterator.

func (*MockMutableListMockRecorder) Len

Len indicates an expected call of Len.

func (*MockMutableListMockRecorder) Max

Max indicates an expected call of Max.

func (*MockMutableListMockRecorder) RemoveRange

func (mr *MockMutableListMockRecorder) RemoveRange(min, max interface{}) *gomock.Call

RemoveRange indicates an expected call of RemoveRange.

func (*MockMutableListMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockMutableListMockRecorder) UnionInPlace added in v1.4.2

func (mr *MockMutableListMockRecorder) UnionInPlace(other interface{}) *gomock.Call

UnionInPlace indicates an expected call of UnionInPlace.

func (*MockMutableListMockRecorder) UnionManyInPlace added in v1.4.2

func (mr *MockMutableListMockRecorder) UnionManyInPlace(others interface{}) *gomock.Call

UnionManyInPlace indicates an expected call of UnionManyInPlace.

type MockPool

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

MockPool is a mock of Pool interface.

func NewMockPool

func NewMockPool(ctrl *gomock.Controller) *MockPool

NewMockPool creates a new mock instance.

func (*MockPool) EXPECT

func (m *MockPool) EXPECT() *MockPoolMockRecorder

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

func (*MockPool) Get

func (m *MockPool) Get() MutableList

Get mocks base method.

func (*MockPool) Put

func (m *MockPool) Put(pl MutableList)

Put mocks base method.

type MockPoolMockRecorder

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

MockPoolMockRecorder is the mock recorder for MockPool.

func (*MockPoolMockRecorder) Get

func (mr *MockPoolMockRecorder) Get() *gomock.Call

Get indicates an expected call of Get.

func (*MockPoolMockRecorder) Put

func (mr *MockPoolMockRecorder) Put(pl interface{}) *gomock.Call

Put indicates an expected call of Put.

type MutableList

type MutableList interface {
	List

	// Insert inserts the given ID into the postings list.
	Insert(i ID) error

	// UnionInPlace updates this postings list in place to contain those DocIDs which are in either
	// this postings list or other.
	UnionInPlace(other List) error

	// UnionManyInPlace updates this postings list in place to contain those DocIDs which are in
	// either this postings list or multiple others.
	UnionManyInPlace(others []List) error

	// AddIterator adds all IDs contained in the iterator.
	AddIterator(iter Iterator) error

	// AddRange adds all IDs between [min, max) to this postings list.
	AddRange(min, max ID) error

	// RemoveRange removes all IDs between [min, max) from this postings list.
	RemoveRange(min, max ID) error

	// Reset resets the internal state of the postings list.
	Reset()
}

MutableList is a postings list implementation which also supports mutable operations.

type Pool

type Pool interface {
	// Get retrieves a MutableList.
	Get() MutableList

	// Put releases the provided MutableList back to the pool.
	Put(pl MutableList)
}

Pool provides a pool for MutableLists.

func NewPool

func NewPool(
	opts xpool.ObjectPoolOptions,
	allocator PoolAllocateFn,
) Pool

NewPool returns a new Pool.

type PoolAllocateFn

type PoolAllocateFn func() MutableList

PoolAllocateFn returns a new MutableList.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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