storage

package
v0.0.0-...-90229f9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocalStorage

func NewLocalStorage(ctx context.Context, path string) (linker.Storage, error)

NewLocalStorage opens a boltdb at path and provides the linker.Storage interface

Types

type Local

type Local struct {
	*bolt.DB
	// contains filtered or unexported fields
}

Local wraps around boltdb and stow to persist linker data

func (*Local) Documents

func (l *Local) Documents(ctx context.Context) (map[string]*document.Document, error)

Documents takes all documents currently stored in stow and returns them as hash map

func (*Local) InsertDocument

func (l *Local) InsertDocument(ctx context.Context, doc *document.Document)

InsertDocument into stow by its hash

func (l *Local) InsertLink(ctx context.Context, link *linker.Edge)

InsertLink into stow by its hash

func (*Local) InsertSegment

func (l *Local) InsertSegment(ctx context.Context, seg *linker.Segment)

InsertSegment into stow by its hash

func (l *Local) Links(ctx context.Context) (map[string]*linker.Edge, error)

Links takes all links currently stored in stow and returns them as hash map

func (*Local) Metadata

func (l *Local) Metadata(ctx context.Context) (*linker.Metadata, error)

Metadata retrieves the stored metadata and returns it as pointer

func (*Local) Segments

func (l *Local) Segments(ctx context.Context) (map[string]*linker.Segment, error)

Segments takes all segments currently stored in stow and returns them as hash map

func (*Local) SetMetadata

func (l *Local) SetMetadata(ctx context.Context, meta *linker.Metadata)

SetMetadata into stow by its hash

type LocalManager

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

LocalManager provides helpers for managing a local storage collection

func NewLocalManager

func NewLocalManager(ctx context.Context, root string) *LocalManager

NewLocalManager with root path

func (*LocalManager) List

func (m *LocalManager) List(ctx context.Context) (map[string]linker.Storage, error)

List all instances of LocalStorage under the managers path

func (*LocalManager) New

func (m *LocalManager) New(ctx context.Context, id string) (linker.Storage, error)

New LocalStorage for the provided id

Jump to

Keyboard shortcuts

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