hoard

package
v0.0.0-...-7f3ab3a Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCell

func MakeCell(spec CellSpec) (cells.Cell, error)

func MakeStore

func MakeStore(spec StoreSpec) (cadata.Store, error)

Types

type CellSpec

type CellSpec struct {
	File *string       `json:"file,omitempty"`
	HTTP *HTTPCellSpec `json:"http,omitempty"`
}

type Expr

type Expr = hexpr.Expr

type HTTPCellSpec

type HTTPCellSpec struct {
	URL     string            `json:"url,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

type Hoard

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

func New

func New(params Params) *Hoard

func (*Hoard) Add

func (h *Hoard) Add(ctx context.Context, r io.Reader) (*ID, error)

func (*Hoard) ForEachExpr

func (h *Hoard) ForEachExpr(ctx context.Context, span state.Span[cadata.ID], fn func(id ID, e hexpr.Expr) error) error

func (*Hoard) ForEachKey

func (h *Hoard) ForEachKey(ctx context.Context, index string, fn func(string) error) error

func (*Hoard) ForEachValue

func (h *Hoard) ForEachValue(ctx context.Context, index, tagKey string, fn func([]byte) error) error

func (*Hoard) GetLabels

func (h *Hoard) GetLabels(ctx context.Context, id ID, indexName string) ([]labels.Pair, error)

func (*Hoard) ListIDs

func (h *Hoard) ListIDs(ctx context.Context, span state.Span[cadata.ID]) (ret []ID, _ error)

func (*Hoard) ListIndexes

func (h *Hoard) ListIndexes(ctx context.Context) ([]string, error)

func (*Hoard) NewReader

func (h *Hoard) NewReader(ctx context.Context, id ID) (io.ReadSeeker, error)

func (*Hoard) NewReaderAt

func (h *Hoard) NewReaderAt(ctx context.Context, id ID) (io.ReaderAt, error)

func (*Hoard) Search

func (h *Hoard) Search(ctx context.Context, query labels.Query) (ret []ID, _ error)

type ID

type ID = hcorpus.ID

type IDSpan

type IDSpan = cadata.Span

type Indexer

type Indexer func(ctx context.Context, e hexpr.Expr, cv hexpr.Value) ([]labels.Pair, error)

type Params

type Params struct {
	Volume   Volume
	Indexers map[string]Indexer
}

type State

type State struct {
	Corpus  hcorpus.Root           `json:"corpus"`
	Indexes map[string]hindex.Root `json:"indexes"`
}

type StoreSpec

type StoreSpec struct {
	LocalDir *string `json:"local_dir,omitempty"`
}

type Volume

type Volume struct {
	Cell   cells.Cell
	Corpus cadata.Store
	Index  cadata.Store

	GLFS cadata.Store
}

func MakeVolume

func MakeVolume(spec VolumeSpec) (*Volume, error)

type VolumeSpec

type VolumeSpec struct {
	Cell CellSpec `json:"cell"`

	CorpusStore StoreSpec `json:"corpus_store"`
	GLFSStore   StoreSpec `json:"glfs_store"`
}

Jump to

Keyboard shortcuts

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