dynamo

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: 18 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 has methods that know how to interact with docshelf data in Dynamo.

func New

func New(fs docshelf.FileStore, ti docshelf.TextIndex, logger *logrus.Logger) (Store, error)

New creates a new Store struct.

func (Store) GetDoc

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

GetDoc fetches a docshelf Document from dynamodb. It will also read and package the Content form 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 dynamodb.

func (Store) GetPolicy

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

GetPolicy fetches an existing docshelf Policy from dynamo.

func (Store) GetUser

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

GetUser fetches an existing docshelf User from dynamodb.

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 dynamodb. 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 dynamodb.

func (Store) PutDoc

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

PutDoc creates or updates an existing docshelf Doc in dynamodb. 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 User 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 dynamo.

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 dynamodb.

func (Store) RemoveDoc

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

RemoveDoc removes a docshelf Doc from dynamo 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 dynamo.

func (Store) RemovePolicy

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

RemovePolicy deletes a policy from dynamo.

func (Store) RemoveUser

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

RemoveUser marks a user as deleted in boltdb. TODO (erik): Right now this is pretty lazy. Should come back and write the expression to update only the DeletedAt field rather than overwriting the entire Item.

func (Store) TagDoc

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

TagDoc tags an existing document with the given tags. TODO (erik): This is a mirror of the bolt implementation. Need to research and find out if there's a more efficient way to get this behavior out of dynamo.

type Tag

type Tag struct {
	Tag   string   `json:"tag"`
	Paths []string `json:"paths"`
}

A Tag represents the dynamo data structure of a tag.

Jump to

Keyboard shortcuts

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