Documentation
¶
Index ¶
- Constants
- type DB
- func (db *DB) AddTask(id string, cancel context.CancelFunc)
- func (db *DB) CancelReport(ctx context.Context, id string) error
- func (db *DB) Close()
- func (db *DB) CreateReport(ctx context.Context, req index.Request) (*schema.Report, error)
- func (db *DB) Debug(ctx context.Context, req keyvalue.DebugRequest, ...) error
- func (db *DB) Delete(ctx context.Context) error
- func (db *DB) DeleteReport(ctx context.Context, id string) error
- func (db *DB) DeleteTask(id string)
- func (db *DB) FlushBatch()
- func (db *DB) GetCdx(key string) (*schema.Cdx, error)
- func (db *DB) GetFileInfo(_ context.Context, filename string) (*schema.FileInfo, error)
- func (db *DB) GetReport(ctx context.Context, id string) (*schema.Report, error)
- func (db *DB) GetStorageRef(ctx context.Context, warcId string) (string, error)
- func (db *DB) Index(path string) error
- func (db *DB) ListFileInfo(ctx context.Context, req index.Request, results chan<- index.FileInfoResponse) error
- func (db *DB) ListReports(ctx context.Context, req index.Request, results chan<- index.ReportResponse) error
- func (db *DB) ListStorageRef(ctx context.Context, req index.Request, results chan<- index.IdResponse) error
- func (db *DB) Resolve(_ context.Context, warcId string) (storageRef string, err error)
- func (db *DB) ResolvePath(filename string) (filePath string, err error)
- func (db *DB) SaveReport(ctx context.Context, report *schema.Report) error
- func (db *DB) Search(ctx context.Context, search index.Request, results chan<- index.CdxResponse) error
- func (db *DB) Write(rec index.Record) error
- type Option
- func WithBatchMaxSize(size int) Option
- func WithBatchMaxWait(t time.Duration) Option
- func WithCompression(c string) Option
- func WithDatabase(db string) Option
- func WithDir(d string) Option
- func WithGcInterval(t time.Duration) Option
- func WithIndexer(indexer index.Indexer) Option
- func WithReadOnly(readOnly bool) Option
- func WithoutBadgerLogging() Option
- type Options
Constants ¶
View Source
const ( SnappyCompression = "snappy" NoCompression = "none" ZstdCompression = "zstd" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct { // IdIndex maps record id to storage ref IdIndex *badger.DB // FileIndex maps filepath to fileinfo FileIndex *badger.DB // CdxIndex maps cdx key to cdx record CdxIndex *badger.DB // ReportIndex maps report id to report ReportIndex *badger.DB // contains filtered or unexported fields }
func (*DB) CancelReport ¶ added in v0.4.0
func (*DB) Close ¶
func (db *DB) Close()
Close stops the gc and batch workers and closes the index databases.
func (*DB) CreateReport ¶ added in v0.4.0
func (*DB) Debug ¶ added in v0.4.0
func (db *DB) Debug(ctx context.Context, req keyvalue.DebugRequest, results chan<- keyvalue.CdxResponse) error
func (*DB) DeleteReport ¶ added in v0.4.0
func (*DB) DeleteTask ¶ added in v0.4.0
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) GetStorageRef ¶
func (*DB) ListFileInfo ¶
func (*DB) ListReports ¶ added in v0.4.0
func (*DB) ListStorageRef ¶
func (*DB) Resolve ¶
Resolve looks up warcId in the id index of the database and returns corresponding storageRef, or an error if not found.
func (*DB) ResolvePath ¶
ResolvePath looks up filename in file index and returns the path field.
func (*DB) SaveReport ¶ added in v0.4.0
type Option ¶
type Option func(opts *Options)
func WithBatchMaxSize ¶
func WithBatchMaxWait ¶
func WithCompression ¶
func WithDatabase ¶
func WithGcInterval ¶
func WithIndexer ¶
func WithReadOnly ¶
func WithoutBadgerLogging ¶ added in v0.4.0
func WithoutBadgerLogging() Option
Click to show internal directories.
Click to hide internal directories.