lookup

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package lookup is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Series series.DatabaseSeries
	Index  uint64
	// contains filtered or unexported fields
}

Entry is the entry in the shard ident.ID -> series map. It has additional members to track lifecycle and minimize indexing overhead. NB: users are expected to use `NewEntry` to construct these objects.

func NewEntry

func NewEntry(opts NewEntryOptions) *Entry

NewEntry returns a new Entry.

func (*Entry) DecrementReaderWriterCount

func (entry *Entry) DecrementReaderWriterCount()

DecrementReaderWriterCount decrements the ref count on the Entry.

func (*Entry) IncrementReaderWriterCount

func (entry *Entry) IncrementReaderWriterCount()

IncrementReaderWriterCount increments the ref count on the Entry.

func (*Entry) IndexedForBlockStart

func (entry *Entry) IndexedForBlockStart(indexBlockStart xtime.UnixNano) bool

IndexedForBlockStart returns a bool to indicate if the Entry has been successfully indexed for the given index blockstart.

func (*Entry) LoadBlock added in v1.0.0

func (entry *Entry) LoadBlock(
	block block.DatabaseBlock,
	writeType series.WriteType,
) error

LoadBlock loads a single block into the series.

func (*Entry) NeedsIndexUpdate

func (entry *Entry) NeedsIndexUpdate(indexBlockStartForWrite xtime.UnixNano) bool

NeedsIndexUpdate returns a bool to indicate if the Entry needs to be indexed for the provided blockStart. It only allows a single index attempt at a time for a single entry. NB(prateek): NeedsIndexUpdate is a CAS, i.e. when this method returns true, it also sets state on the entry to indicate that a write for the given blockStart is going to be sent to the index, and other go routines should not attempt the same write. Callers are expected to ensure they follow this guideline. Further, every call to NeedsIndexUpdate which returns true needs to have a corresponding OnIndexFinalze() call. This is required for correct lifecycle maintenance.

func (*Entry) OnIndexFinalize

func (entry *Entry) OnIndexFinalize(blockStartNanos xtime.UnixNano)

OnIndexFinalize marks any attempt for the given block start as finished and decrements the entry ref count.

func (*Entry) OnIndexPrepare

func (entry *Entry) OnIndexPrepare()

OnIndexPrepare prepares the Entry to be handed off to the indexing sub-system. NB(prateek): we retain the ref count on the entry while the indexing is pending, the callback executed on the entry once the indexing is completed releases this reference.

func (*Entry) OnIndexSuccess

func (entry *Entry) OnIndexSuccess(blockStartNanos xtime.UnixNano)

OnIndexSuccess marks the given block start as successfully indexed.

func (*Entry) OnReleaseReadWriteRef added in v0.15.0

func (entry *Entry) OnReleaseReadWriteRef()

OnReleaseReadWriteRef decrements a read/write ref, it's named differently to decouple the concrete task needed when a ref is released and the intent to release the ref (simpler for caller readability/reasoning).

func (*Entry) ReaderWriterCount

func (entry *Entry) ReaderWriterCount() int32

ReaderWriterCount returns the current ref count on the Entry.

func (*Entry) Write added in v1.0.0

func (entry *Entry) Write(
	ctx context.Context,
	timestamp time.Time,
	value float64,
	unit xtime.Unit,
	annotation []byte,
	wOpts series.WriteOptions,
) (bool, series.WriteType, error)

Write writes a new value.

type IndexWriter added in v1.0.0

type IndexWriter interface {
	// WritePending indexes the provided pending entries.
	WritePending(
		pending []writes.PendingIndexInsert,
	) error

	// BlockStartForWriteTime returns the index block start
	// time for the given writeTime.
	BlockStartForWriteTime(
		writeTime time.Time,
	) xtime.UnixNano
}

IndexWriter accepts index inserts.

type MockIndexWriter added in v1.0.0

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

MockIndexWriter is a mock of IndexWriter interface

func NewMockIndexWriter added in v1.0.0

func NewMockIndexWriter(ctrl *gomock.Controller) *MockIndexWriter

NewMockIndexWriter creates a new mock instance

func (*MockIndexWriter) BlockStartForWriteTime added in v1.0.0

func (m *MockIndexWriter) BlockStartForWriteTime(arg0 time.Time) time0.UnixNano

BlockStartForWriteTime mocks base method

func (*MockIndexWriter) EXPECT added in v1.0.0

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

func (*MockIndexWriter) WritePending added in v1.0.0

func (m *MockIndexWriter) WritePending(arg0 []writes.PendingIndexInsert) error

WritePending mocks base method

type MockIndexWriterMockRecorder added in v1.0.0

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

MockIndexWriterMockRecorder is the mock recorder for MockIndexWriter

func (*MockIndexWriterMockRecorder) BlockStartForWriteTime added in v1.0.0

func (mr *MockIndexWriterMockRecorder) BlockStartForWriteTime(arg0 interface{}) *gomock.Call

BlockStartForWriteTime indicates an expected call of BlockStartForWriteTime

func (*MockIndexWriterMockRecorder) WritePending added in v1.0.0

func (mr *MockIndexWriterMockRecorder) WritePending(arg0 interface{}) *gomock.Call

WritePending indicates an expected call of WritePending

type MockOnReleaseReadWriteRef added in v0.15.0

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

MockOnReleaseReadWriteRef is a mock of OnReleaseReadWriteRef interface

func NewMockOnReleaseReadWriteRef added in v0.15.0

func NewMockOnReleaseReadWriteRef(ctrl *gomock.Controller) *MockOnReleaseReadWriteRef

NewMockOnReleaseReadWriteRef creates a new mock instance

func (*MockOnReleaseReadWriteRef) EXPECT added in v0.15.0

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

func (*MockOnReleaseReadWriteRef) OnReleaseReadWriteRef added in v0.15.0

func (m *MockOnReleaseReadWriteRef) OnReleaseReadWriteRef()

OnReleaseReadWriteRef mocks base method

type MockOnReleaseReadWriteRefMockRecorder added in v0.15.0

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

MockOnReleaseReadWriteRefMockRecorder is the mock recorder for MockOnReleaseReadWriteRef

func (*MockOnReleaseReadWriteRefMockRecorder) OnReleaseReadWriteRef added in v0.15.0

func (mr *MockOnReleaseReadWriteRefMockRecorder) OnReleaseReadWriteRef() *gomock.Call

OnReleaseReadWriteRef indicates an expected call of OnReleaseReadWriteRef

type NewEntryOptions added in v1.0.0

type NewEntryOptions struct {
	Series      series.DatabaseSeries
	Index       uint64
	IndexWriter IndexWriter
	NowFn       clock.NowFn
}

NewEntryOptions supplies options for a new entry.

type OnReleaseReadWriteRef added in v0.15.0

type OnReleaseReadWriteRef interface {
	OnReleaseReadWriteRef()
}

OnReleaseReadWriteRef is a callback that can release a strongly held series read/write ref.

Jump to

Keyboard shortcuts

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