sqlobjectstore

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event added in v0.19.0

type Event struct {
	Action     EventAction
	ObjectHash tilde.Digest
}

type EventAction added in v0.19.0

type EventAction string
const (
	ObjectInserted EventAction = "objectInserted"
	ObjectRemoved  EventAction = "objectRemoved"
	ObjectPinned   EventAction = "objectPinned"
	ObjectUnpinned EventAction = "objectUnpinned"
)

type FilterOption added in v0.15.6

type FilterOption func(*FilterOptions)

FilterOptions

func FilterByHash

func FilterByHash(hs ...tilde.Digest) FilterOption

func FilterByObjectType

func FilterByObjectType(typePatterns ...string) FilterOption

func FilterByOwner

func FilterByOwner(owners ...did.DID) FilterOption

func FilterByStreamHash

func FilterByStreamHash(hs ...tilde.Digest) FilterOption

func FilterLimit added in v0.15.6

func FilterLimit(limit, offset int) FilterOption

func FilterOrderBy added in v0.15.6

func FilterOrderBy(orderBy string) FilterOption

func FilterOrderDir added in v0.15.6

func FilterOrderDir(orderDir string) FilterOption

type FilterOptions added in v0.15.6

type FilterOptions struct {
	// Filters are used to perform db queries for these filters
	// TODO find a better name for this
	Filters struct {
		ObjectHashes []tilde.Digest
		StreamHashes []tilde.Digest
		ContentTypes []string
		Owners       []string
		OrderBy      string
		OrderDir     string
		Limit        *int
		Offset       *int
	}
}

FilterOptions

type Store

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

func New

func New(
	db *sql.DB,
) (*Store, error)

func (*Store) Close

func (st *Store) Close() error

func (*Store) Filter

func (st *Store) Filter(
	filterOptions ...FilterOption,
) (object.ReadCloser, error)

func (*Store) Get

func (st *Store) Get(
	hash tilde.Digest,
) (*object.Object, error)

func (*Store) GetByStream added in v0.11.0

func (st *Store) GetByStream(
	streamRootHash tilde.Digest,
) (object.ReadCloser, error)

func (*Store) GetByType added in v0.11.0

func (st *Store) GetByType(
	objectType string,
) (object.ReadCloser, error)

func (*Store) GetKey added in v0.19.0

func (st *Store) GetKey(
	publicKeyDigest tilde.Digest,
) (*crypto.PrivateKey, error)

func (*Store) GetPinned added in v0.8.0

func (st *Store) GetPinned() ([]tilde.Digest, error)

func (*Store) GetRelations

func (st *Store) GetRelations(
	parent tilde.Digest,
) ([]tilde.Digest, error)

func (*Store) GetStreamLeaves added in v0.14.0

func (st *Store) GetStreamLeaves(
	streamRootHash tilde.Digest,
) ([]tilde.Digest, error)

func (*Store) IsPinned added in v0.18.0

func (st *Store) IsPinned(hash tilde.Digest) (bool, error)

func (*Store) ListHashes added in v0.19.0

func (st *Store) ListHashes() ([]tilde.Digest, error)

func (*Store) ListenForUpdates added in v0.19.0

func (st *Store) ListenForUpdates() (
	updates <-chan Event,
	cancel func(),
)

func (*Store) Pin added in v0.18.0

func (st *Store) Pin(
	hash tilde.Digest,
) error

func (*Store) Put

func (st *Store) Put(
	obj *object.Object,
) error

func (*Store) PutKey added in v0.19.0

func (st *Store) PutKey(
	privateKey crypto.PrivateKey,
) error

func (*Store) PutWithTTL added in v0.14.0

func (st *Store) PutWithTTL(
	obj *object.Object,
	ttl time.Duration,
) error

func (*Store) Remove

func (st *Store) Remove(
	hash tilde.Digest,
) error

func (*Store) RemovePin added in v0.18.0

func (st *Store) RemovePin(
	hash tilde.Digest,
) error

func (*Store) UpdateTTL

func (st *Store) UpdateTTL(
	hash tilde.Digest,
	minutes int,
) error

Jump to

Keyboard shortcuts

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