store

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BoltDBFile is the filename to store the boltdb database
	BoltDBFile = "store.db"
	// BucketName is the bucket name to save the sote
	BucketName = "store"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EntryType

type EntryType struct {
	Path        hash.Hash   `json:"path"`         // Path of the entry
	Parent      *hash.Hash  `json:"parent"`       // path of the parent, or nil when it's the root
	Data        []byte      `json:"data"`         // actual (encrypted) data
	Timestamp   int64       `json:"timestamp"`    // Timestamp of this entry, or the highest timestamp of any entry below
	HasChildren bool        `json:"has_children"` // True when this entry has children
	Children    []EntryType `json:"entries"`      // Child entries (when recursive)
	Signature   []byte      `json:"signature"`    // Signature for this entry
}

EntryType is the structure that defines the output of a store entry (collection)

func NewEntry

func NewEntry(data []byte) EntryType

NewEntry creates a new entry

func (*EntryType) MarshalBinary

func (e *EntryType) MarshalBinary() (data []byte, err error)

MarshalBinary converts a storeentrytype to binary format so it can be stored in Redis

func (*EntryType) UnmarshalBinary

func (e *EntryType) UnmarshalBinary(data []byte) error

UnmarshalBinary converts binary to a ticket so it can be fetched from Redis

type Repository

type Repository interface {
	HasEntry(account, path hash.Hash) bool
	RemoveEntry(account, path hash.Hash, recursive bool) error
	GetEntry(account, path hash.Hash, recursive bool, since time.Time) (*EntryType, error)
	SetEntry(account hash.Hash, entry EntryType) error

	OpenDb(account hash.Hash) error
	CloseDb(account hash.Hash) error
}

Repository is a store repository to fetch and store tickets

func NewBoltRepository

func NewBoltRepository(accountsPath string) Repository

NewBoltRepository initializes a new repository

Jump to

Keyboard shortcuts

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