bolt

package
v0.0.0-...-4f898de Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

A Store implements several docshelf interfaces using boltdb as the backend.

func New

func New(filename string, fs docshelf.FileStore, ti docshelf.TextIndex) (Store, error)

New returns a new boltdb Store. This Store can fulfill the interfaces for UserStore, GroupStore, DocStore, and PolicyStore.

func (Store) Close

func (s Store) Close() error

Close closes the bolt DB file. It currently omits the error for convenience, but that should maybe change in the future.

func (Store) GetDoc

func (s Store) GetDoc(ctx context.Context, path string) (docshelf.Doc, error)

GetDoc fetches a docshelf Document from bolt. It will also read and package the Content from an underlying FileStore.

func (Store) GetGroup

func (s Store) GetGroup(ctx context.Context, id string) (docshelf.Group, error)

GetGroup fetches an existing docshelf Group from boltdb.

func (Store) GetPolicy

func (s Store) GetPolicy(ctx context.Context, id string) (docshelf.Policy, error)

GetPolicy fetches an existing docshelf Policy from boltdb.

func (Store) GetUser

func (s Store) GetUser(ctx context.Context, id string) (docshelf.User, error)

GetUser fetches an existing docshelf User from boltdb.

func (Store) ListDocs

func (s Store) ListDocs(ctx context.Context, query string, tags ...string) ([]docshelf.Doc, error)

ListDocs fetches a slice of docshelf Document metadata from bolt. If a query is provided, then the configured docshelf.TextIndex will be used to get a set of document paths. If tags are also provided, then they will be used to further filter down the results. If no query is provided, but tags are, then the tags will filter down the entire set of documents stored.

func (Store) ListUsers

func (s Store) ListUsers(ctx context.Context) ([]docshelf.User, error)

ListUsers returns all docshelf Users stored in bolt db.

func (Store) PutDoc

func (s Store) PutDoc(ctx context.Context, doc docshelf.Doc) (string, error)

PutDoc creates or updates an existing docshelf Doc in bolt. It will also store the Content in an underlying FileStore.

func (Store) PutGroup

func (s Store) PutGroup(ctx context.Context, group docshelf.Group) (string, error)

PutGroup creates a new docshelf Group or updates an existing one in boltdb.

func (Store) PutPolicy

func (s Store) PutPolicy(ctx context.Context, policy docshelf.Policy) (string, error)

PutPolicy creates a new docshelf Policy or updates an existing one in boltdb.

func (Store) PutUser

func (s Store) PutUser(ctx context.Context, user docshelf.User) (string, error)

PutUser creates a new docshelf User or updates an existing one in boltdb.

func (Store) RemoveDoc

func (s Store) RemoveDoc(ctx context.Context, path string) error

RemoveDoc removes a docshelf Doc from bolt as well as the underlying FileStore.

func (Store) RemoveGroup

func (s Store) RemoveGroup(ctx context.Context, id string) error

RemoveGroup deletes a docshelf Group from boltdb.

func (Store) RemovePolicy

func (s Store) RemovePolicy(ctx context.Context, id string) error

RemovePolicy deletes a policy from boltdb.

func (Store) RemoveUser

func (s Store) RemoveUser(ctx context.Context, id string) error

RemoveUser marks a user as deleted in boltdb.

func (Store) TagDoc

func (s Store) TagDoc(ctx context.Context, path string, tags ...string) error

TagDoc tags an existing document with the given tags.

Jump to

Keyboard shortcuts

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