tikvidx

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareAsc

func CompareAsc(a int64, b int64) bool

func CompareClosest

func CompareClosest(ts int64) func(int64, int64) bool

func CompareDesc

func CompareDesc(a int64, b int64) bool

Types

type DB

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

func NewDB

func NewDB(options ...Option) (db *DB, err error)

func (*DB) Close

func (db *DB) Close()

Close stops the batch workers and closes the index databases.

func (*DB) Closest

func (db *DB) Closest(ctx context.Context, req index.Request, res chan<- index.CdxResponse) error

Closest returns the first closest cdx value(s).

func (*DB) GetFileInfo

func (db *DB) GetFileInfo(_ context.Context, filename string) (*schema.Fileinfo, error)

func (*DB) GetStorageRef

func (db *DB) GetStorageRef(ctx context.Context, id string) (string, error)

func (*DB) Index

func (db *DB) Index(path string) error

func (*DB) List

func (db *DB) List(ctx context.Context, limit int, res chan<- index.CdxResponse) error

func (*DB) ListFileInfo

func (db *DB) ListFileInfo(ctx context.Context, limit int, res chan<- index.FileInfoResponse) error

func (*DB) ListStorageRef

func (db *DB) ListStorageRef(ctx context.Context, limit int, res chan<- index.IdResponse) error

func (*DB) Resolve

func (db *DB) Resolve(ctx context.Context, warcId string) (string, error)

Resolve looks up warcId in the id index of the database and returns corresponding storageRef, or an error if not found.

func (*DB) ResolvePath

func (db *DB) ResolvePath(filename string) (filePath string, err error)

ResolvePath looks up filename in file index and returns the path field.

func (*DB) Search

func (db *DB) Search(ctx context.Context, req index.Request, res chan<- index.CdxResponse) error

func (*DB) Write

func (db *DB) Write(rec index.Record) error

type KV

type KV struct {
	K, V []byte
}

KV represents a Key-Value pair.

func (KV) String

func (kv KV) String() string

type Option

type Option func(opts *Options)

func WithBatchMaxSize

func WithBatchMaxSize(size int) Option

func WithBatchMaxWait

func WithBatchMaxWait(t time.Duration) Option

func WithDatabase

func WithDatabase(db string) Option

func WithPDAddress

func WithPDAddress(pdAddr []string) Option

func WithReadOnly

func WithReadOnly(readOnly bool) Option

type Options

type Options struct {
	BatchMaxSize    int
	BatchMaxWait    time.Duration
	BatchMaxRetries int
	ReadOnly        bool
	PdAddr          []string
	Database        string
}

Jump to

Keyboard shortcuts

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