tikvidx

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func NewDB

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

func (*DB) AddTask added in v0.4.0

func (db *DB) AddTask(id string, cancel context.CancelFunc)

func (*DB) CancelReport added in v0.4.0

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

func (*DB) Close

func (db *DB) Close()

Close stops the batch workers and closes the index databases.

func (*DB) CreateReport added in v0.4.0

func (db *DB) CreateReport(ctx context.Context, req index.Request) (*schema.Report, error)

func (*DB) Debug added in v0.4.0

func (db *DB) Debug(ctx context.Context, req keyvalue.DebugRequest, res chan<- keyvalue.CdxResponse) error

func (*DB) Delete added in v0.4.0

func (db *DB) Delete(ctx context.Context) error

Delete removes all data from the database.

func (*DB) DeleteReport added in v0.4.0

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

func (*DB) DeleteTask added in v0.4.0

func (db *DB) DeleteTask(id string)

func (*DB) FlushBatch added in v0.4.0

func (db *DB) FlushBatch()

FlushBatch collects all records in the batch channel and updates the id and cdx indices.

func (*DB) GetFileInfo

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

func (*DB) GetReport added in v0.4.0

func (db *DB) GetReport(ctx context.Context, id string) (*schema.Report, 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) ListFileInfo

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

func (*DB) ListReports added in v0.4.0

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

func (*DB) ListStorageRef

func (db *DB) ListStorageRef(ctx context.Context, req index.Request, 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) SaveReport added in v0.4.0

func (db *DB) SaveReport(ctx context.Context, report *schema.Report) error

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 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