filetree

package
v0.0.67 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0, NCSA Imports: 10 Imported by: 0

Documentation

Overview

Package filetree implements a lookup table for files in a tree structure.

Table format:

dirs:<corpus>\n<root>\n<path> -> srvpb.FileDirectory
dirs:corpusRoots              -> srvpb.CorpusRoots

Index

Constants

View Source
const (
	// DirTablePrefix is used as the prefix of the keys of a combined serving
	// table.  CorpusRootsPrefixedKey and PrefixedDirKey use this prefix to
	// construct their keys.  Table uses this prefix when PrefixedKeys is true.
	DirTablePrefix = "dirs:"
)

Variables

View Source
var CorpusRootsKey = []byte("corpusRoots")

CorpusRootsKey is the filetree lookup key for the tree's srvpb.CorpusRoots.

View Source
var CorpusRootsPrefixedKey = []byte(DirTablePrefix + "corpusRoots")

CorpusRootsPrefixedKey is the filetree lookup key for the tree's srvpb.CorpusRoots when using PrefixedKeys.

Functions

func DirKey

func DirKey(corpus, root, path string) []byte

DirKey returns the filetree lookup table key for the given corpus path.

func PrefixedDirKey added in v0.0.16

func PrefixedDirKey(corpus, root, path string) []byte

PrefixedDirKey returns the filetree lookup table key for the given corpus path, prefixed by DirTablePrefix.

Types

type Table

type Table struct {
	table.Proto

	// PrefixedKeys indicates whether all keys are prefixed by DirTablePrefix
	// (i.e. when using a combined serving table).
	PrefixedKeys bool
}

Table implements the FileTree interface using a static lookup table.

func (*Table) CorpusRoots

func (t *Table) CorpusRoots(ctx context.Context, req *ftpb.CorpusRootsRequest) (*ftpb.CorpusRootsReply, error)

CorpusRoots implements part of the filetree Service interface.

func (*Table) Directory

func (t *Table) Directory(ctx context.Context, req *ftpb.DirectoryRequest) (*ftpb.DirectoryReply, error)

Directory implements part of the filetree Service interface.

Jump to

Keyboard shortcuts

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