indexer

package
v1.1.1492 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FetchOpts added in v1.1.1492

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

FetchOpts specifies options for fetching key-value entries. The `skip` field determines the number of entries to skip. The `take` field specifies the number of entries to retrieve.

type FetchOptsFn added in v1.1.1492

type FetchOptsFn func(opts *FetchOpts)

FetchOptsFn is a function type that modifies FetchOpts when fetching key-value entries.

func Skip added in v1.1.1492

func Skip(n int) FetchOptsFn

Skip skips the first n entries when fetching key-value entries.

func Take added in v1.1.1492

func Take(n int) FetchOptsFn

Take sets the number of key-value entries to take when fetching.

type Index

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

Index - A badger prefix based indexer for NATS KV

func New

func New(ctx context.Context, kv jetstream.KeyValue, options *IndexOptions, indexFn IndexFn) (*Index, error)

New creates a new instance of the indexer.

func (*Index) Fetch

func (idx *Index) Fetch(ctx context.Context, prefix []byte, opts ...FetchOptsFn) (chan jetstream.KeyValueEntry, chan error)

Fetch - fetches all keys with a key prefix

func (*Index) KV added in v1.1.1492

func (idx *Index) KV() jetstream.KeyValue

KV returns the underlying jetstream.KeyValue interface from the Index.

func (*Index) Start

func (idx *Index) Start() error

Start starts the indexer

type IndexFn

type IndexFn func(kvName string, entry jetstream.KeyValueEntry) [][]byte

IndexFn takes a KeyValueEntry, and returns a set of badger keys.

type IndexOptions

type IndexOptions struct {
	IndexToDisk bool          // IndexToDisk creates an index on disk if true.
	Path        string        // Path on disk for the index files.  This must be ephemeral, or externally deleted before calling Start().
	WarmupDelay time.Duration // WarmupDelay is the time that the index waits before allowing queries.
	Ready       func()        // Ready function is called once the warmup delay has passed.
}

IndexOptions holds configuration options for the indexing process.

Jump to

Keyboard shortcuts

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