Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemFileStore ¶
type MemFileStore struct { *MemStore // contains filtered or unexported fields }
MemFileStore is just like MemStore, but with node data backed by the file system. Only the node metadata will be kept in memory and in the append-only logs, while the node data itself will be saved to disk, in files named after each node's path.
The result is that MemFileStore produces a file hierarchy that matches exactly what is in the database, and can thus be used by external programs.
func NewMemFileStore ¶
func NewMemFileStore(path string) (*MemFileStore, error)
NewMemFileStore creates a new MemFileStore based at 'path'. The database will be stored in a subdirectory of path called '.db'.
func (*MemFileStore) TreeDiff ¶
func (m *MemFileStore) TreeDiff(summary *pb.NodeStateSummary, prefix string) []*pb.Node
type MemStore ¶
type MemStore struct {
// contains filtered or unexported fields
}
MemStore is an in-memory database of Node objects, indexed by their path. It utilizes a radix tree (compressed trie) to organize the nodes, so that scanning by path prefix is fast.
In-memory data is persisted to disk using an append-only log, checkpointed on startup and auto-rotated.
func NewMemStore ¶
NewMemStore returns a MemStore backed by an append-only log at the specified path (which must be a directory). The log directory is created if it does not exist.
func (*MemStore) AddNode ¶
AddNode adds a node to the database. Attempts to add nodes which have newer versions in the database will be ignored. The function returns true if the database was actually modified.
func (*MemStore) Close ¶
func (m *MemStore) Close()
Close the data store and all its associated resources.
func (*MemStore) Summary ¶
func (m *MemStore) Summary() *pb.NodeStateSummary
Summary returns a NodeStateSummary with all the metadata of the Node objects in the database.