store

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package store provides the store logic for the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltStore

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

BoltStore is a store that uses BoltDB

func (*BoltStore) Backup

func (b *BoltStore) Backup(writer io.Writer) (int, error)

Backup writes a backup of the store to a writer

func (*BoltStore) Clear

func (b *BoltStore) Clear() error

Clear clears the store

func (*BoltStore) Close

func (b *BoltStore) Close() error

Close closes the store

func (*BoltStore) CreateBuckets

func (b *BoltStore) CreateBuckets(conf config.ValidStoreConfig) error

CreateBuckets creates buckets in the store

func (*BoltStore) DeleteObject

func (b *BoltStore) DeleteObject(bucket, key string) error

DeleteObject deletes an object from the store

func (*BoltStore) GetObject

func (b *BoltStore) GetObject(bucket, key string) ([]byte, error)

GetObject gets an object from the store

func (*BoltStore) GetObjectReader

func (b *BoltStore) GetObjectReader(bucket, key string) (io.Reader, error)

GetObjectReader gets an object from the store as a reader

func (*BoltStore) ListBuckets

func (b *BoltStore) ListBuckets() ([]string, error)

ListBuckets lists all buckets in the store

func (*BoltStore) ListObjects

func (b *BoltStore) ListObjects(bucket string) ([]string, error)

ListObjects lists all objects in a bucket

func (*BoltStore) PutObject

func (b *BoltStore) PutObject(bucket, key string, data []byte) error

PutObject puts an object in the store

func (*BoltStore) PutObjectReader

func (b *BoltStore) PutObjectReader(bucket, key string, reader io.Reader) error

PutObjectReader puts an object in the store from a reader

func (*BoltStore) SetupStore

func (b *BoltStore) SetupStore(env string, conf config.ValidStoreConfig) error

SetupStore sets up the BoltStore

type Store

type Store interface {
	SetupStore(env string, conf config.ValidStoreConfig) error
	CreateBuckets(conf config.ValidStoreConfig) error
	PutObject(bucket, key string, data []byte) error
	GetObject(bucket, key string) ([]byte, error)
	PutObjectReader(bucket, key string, reader io.Reader) error
	GetObjectReader(bucket, key string) (io.Reader, error)
	DeleteObject(bucket, key string) error
	ListObjects(bucket string) ([]string, error)
	ListBuckets() ([]string, error)
	Backup(writer io.Writer) (int, error)
	Clear() error
	Close() error
}

Store is the interface for a store

func NewStoreFromConfig

func NewStoreFromConfig(_ config.ValidStoreConfig) (Store, error)

NewStoreFromConfig creates a new store from the configuration

Jump to

Keyboard shortcuts

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