search

package
v0.0.0-...-66acf6f Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 License: BSD-3-Clause, BSD-3-Clause Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context, kbCtx libkbfs.Context, params libkbfs.InitParams,
	keybaseServiceCn libkbfs.KeybaseServiceCn,
	log logger.Logger, vlogLevel string) (
	context.Context, libkbfs.Config, error)

Init initializes a context and a libkbfs.Config for search operations. The config should be shutdown when it is done being used.

func Params

func Params(kbCtx libkbfs.Context, storageRoot string, uid keybase1.UID) (
	params libkbfs.InitParams, err error)

Params returns a set of default parameters for search-related operations.

Types

type DbClosedError

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

DbClosedError indicates that the DB has been closed, and thus isn't accepting any more operations.

func (DbClosedError) Error

func (e DbClosedError) Error() string

Error implements the error interface for DbClosedError.

type DocDb

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

DocDb is a database that holds metadata about indexed documents.

func (*DocDb) Delete

func (db *DocDb) Delete(
	ctx context.Context, docID string) error

Delete removes the metadata for the TLF from the DB.

func (*DocDb) Get

func (db *DocDb) Get(ctx context.Context, docID string) (
	parentDocID, name string, err error)

Get returns the info for the given doc.

func (*DocDb) Put

func (db *DocDb) Put(
	ctx context.Context, docID, parentDocID, name string) error

Put saves the revisions for the given TLF.

func (*DocDb) Shutdown

func (db *DocDb) Shutdown(ctx context.Context)

Shutdown closes this db.

type IndexedBlockDb

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

IndexedBlockDb is a database that holds metadata about indexed blocks.

func (*IndexedBlockDb) ClearMemory

func (db *IndexedBlockDb) ClearMemory() error

ClearMemory clears out the buffered puts from memory.

func (*IndexedBlockDb) Delete

func (db *IndexedBlockDb) Delete(
	ctx context.Context, tlfID tlf.ID, ptr data.BlockPointer) error

Delete removes the metadata for the block pointer from the DB.

func (*IndexedBlockDb) Get

func (db *IndexedBlockDb) Get(
	ctx context.Context, ptr data.BlockPointer) (
	indexVersion uint64, docID string, dirDone bool, err error)

Get returns the version and doc ID for the given block.

func (*IndexedBlockDb) GetNextDocIDs

func (db *IndexedBlockDb) GetNextDocIDs(n int) ([]string, error)

GetNextDocIDs generates and reserves the next N doc IDs.

func (*IndexedBlockDb) Put

func (db *IndexedBlockDb) Put(
	ctx context.Context, tlfID tlf.ID, ptr data.BlockPointer,
	indexVersion uint64, docID string, dirDone bool) error

Put saves the version and doc ID for the given block.

func (*IndexedBlockDb) PutMemory

func (db *IndexedBlockDb) PutMemory(
	ctx context.Context, tlfID tlf.ID, ptr data.BlockPointer,
	indexVersion uint64, docID string, dirDone bool) (
	flushFn func() error, err error)

PutMemory saves the data to memory, and returns a function that will flush it to disk when the caller is ready.

func (*IndexedBlockDb) Shutdown

func (db *IndexedBlockDb) Shutdown(ctx context.Context)

Shutdown closes this db.

type IndexedTlfDb

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

IndexedTlfDb is a database that holds metadata about indexed TLFs.

func (*IndexedTlfDb) Delete

func (db *IndexedTlfDb) Delete(
	ctx context.Context, tlfID tlf.ID) error

Delete removes the metadata for the TLF from the DB.

func (*IndexedTlfDb) Get

func (db *IndexedTlfDb) Get(
	ctx context.Context, tlfID tlf.ID) (
	indexedRev, startedRev kbfsmd.Revision, err error)

Get returns the revisions for the given TLF.

func (*IndexedTlfDb) Put

func (db *IndexedTlfDb) Put(
	ctx context.Context, tlfID tlf.ID,
	indexedRev, startedRev kbfsmd.Revision) error

Put saves the revisions for the given TLF.

func (*IndexedTlfDb) Shutdown

func (db *IndexedTlfDb) Shutdown(ctx context.Context)

Shutdown closes this db.

type Indexer

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

Indexer can index and search KBFS TLFs.

func NewIndexer

func NewIndexer(config libkbfs.Config) (*Indexer, error)

NewIndexer creates a new instance of an Indexer.

func (*Indexer) FullSyncStarted

func (i *Indexer) FullSyncStarted(
	ctx context.Context, tlfID tlf.ID, rev kbfsmd.Revision,
	waitCh <-chan struct{})

FullSyncStarted implements the libkbfs.SyncedTlfObserver interface for Indexer.

func (*Indexer) Progress

func (i *Indexer) Progress() *Progress

Progress returns the progress instance of this indexer.

func (*Indexer) ResetIndex

func (i *Indexer) ResetIndex(ctx context.Context) (err error)

ResetIndex shuts down the current indexer, completely removes its on-disk presence, and then restarts it as a blank index.

func (*Indexer) Search

func (i *Indexer) Search(
	ctx context.Context, query string, numResults, startingResult int) (
	results []Result, nextResult int, err error)

Search executes the given query and returns the results in the form of full KBFS paths to each hit. `numResults` limits the number of returned results, and `startingResult` indicates the number of results that have been previously fetched -- basically it indicates the starting index number of the next page of desired results. The return parameter `nextResult` indicates what `startingResult` could be set to next time, to get more results, where -1 indicates that there are no more results.

func (*Indexer) Shutdown

func (i *Indexer) Shutdown(ctx context.Context) error

Shutdown shuts down this indexer.

func (*Indexer) SyncModeChanged

func (i *Indexer) SyncModeChanged(
	ctx context.Context, tlfID tlf.ID, newMode keybase1.FolderSyncMode)

SyncModeChanged implements the libkbfs.SyncedTlfObserver interface for Indexer.

func (*Indexer) UserChanged

func (i *Indexer) UserChanged(
	ctx context.Context, oldName, newName kbname.NormalizedUsername)

UserChanged implements the libfs.RemoteStatusUpdater for Indexer.

type OldPtrNotFound

type OldPtrNotFound struct {
	OldPtr data.BlockPointer
}

OldPtrNotFound indicates that the old pointer for a given file couldn't be found in the index.

func (OldPtrNotFound) Error

func (e OldPtrNotFound) Error() string

type Progress

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

Progress represents the current state of the indexer, and how far along the indexing is.

func NewProgress

func NewProgress(clock libkbfs.Clock) *Progress

NewProgress creates a new Progress instance.

func (*Progress) GetStatus

func (p *Progress) GetStatus() (
	currProgress, overallProgress keybase1.IndexProgressRecord,
	currTlf tlf.ID, queuedTlfs []tlf.ID)

GetStatus returns the current progress status.

type Result

type Result struct {
	Path string
}

Result indicates a single document that matches a search query.

type RevisionGCdError

type RevisionGCdError struct {
	TlfID     tlf.ID
	Rev       kbfsmd.Revision
	LastGCRev kbfsmd.Revision
}

RevisionGCdError indicates that a revision has been garbage-collected and cannot be indexed.

func (RevisionGCdError) Error

func (e RevisionGCdError) Error() string

Jump to

Keyboard shortcuts

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