packdb

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0, NCSA Imports: 13 Imported by: 0

Documentation

Overview

Package packdb implements kcd.ReadWriter using an index pack as its backing store. See also: http://www.kythe.io/docs/kythe-index-pack.html.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	Archive   *indexpack.Archive
	FormatKey string                               // default format key
	Revs      []kcd.Revision                       // revision index
	Convert   func(v interface{}) (kcd.Unit, bool) // unit format converter
}

DB implements kcd.ReadWriter using an index pack as its backing store.

An index pack does not record revision and corpus information, so this implementation emulates that with ephemeral data in-memory. Revision markers written will be discarded when the DB is released.

func (DB) Files

func (db DB) Files(ctx context.Context, fileDigests []string, f func(string, []byte) error) error

Files implements a method of kcd.Reader.

func (DB) FilesExist

func (db DB) FilesExist(ctx context.Context, fileDigests []string, f func(string) error) error

FilesExist implements a method of kcd.Reader.

func (DB) Find

func (db DB) Find(ctx context.Context, filter *kcd.FindFilter, f func(string) error) error

Find implements a method of kcd.Reader.

func (DB) Revisions

func (db DB) Revisions(ctx context.Context, want *kcd.RevisionsFilter, f func(kcd.Revision) error) error

Revisions implements a method of kcd.Reader.

func (DB) Units

func (db DB) Units(ctx context.Context, unitDigests []string, f func(digest, key string, data []byte) error) error

Units implements a method of kcd.Reader.

func (*DB) WriteFile

func (db *DB) WriteFile(ctx context.Context, r io.Reader) (string, error)

WriteFile implements a method of kcd.Writer.

func (*DB) WriteRevision

func (db *DB) WriteRevision(_ context.Context, rev kcd.Revision, replace bool) error

WriteRevision implements a method of kcd.Writer. This implementation stores revisions only in memory, they are not persisted in the indexpack.

func (*DB) WriteUnit

func (db *DB) WriteUnit(ctx context.Context, revision, corpus, formatKey string, unit kcd.Unit) (string, error)

WriteUnit implements a method of kcd.Writer.

Jump to

Keyboard shortcuts

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