indexer

package
v1.1.1442 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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) (chan jetstream.KeyValueEntry, error)

Fetch - fetches all keys with a key prefix

func (*Index) Start

func (idx *Index) Start() error

Start starts the indexer

type IndexFn

type IndexFn func(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