Documentation
¶
Index ¶
- Constants
- Variables
- type BoltStore
- func (s *BoltStore[T]) Close() error
- func (s *BoltStore[T]) Count() (int, error)
- func (s *BoltStore[T]) CreateBucket() error
- func (s *BoltStore[T]) Delete(key uuid.UUID) error
- func (s *BoltStore[T]) Get(key uuid.UUID) (*T, error)
- func (s *BoltStore[T]) List() ([]*T, error)
- func (s *BoltStore[T]) Put(key uuid.UUID, value *T) error
- type InMemoryStore
- func (i *InMemoryStore[T]) Close() error
- func (i *InMemoryStore[T]) Count() (int, error)
- func (i *InMemoryStore[T]) Delete(key uuid.UUID) error
- func (i *InMemoryStore[T]) Get(key uuid.UUID) (*T, error)
- func (i *InMemoryStore[T]) List() ([]*T, error)
- func (i *InMemoryStore[T]) Put(key uuid.UUID, value *T) error
- type Keyable
- type SharedBolt
- type Store
Constants ¶
View Source
const ( MemoryType = "memory" BoltType = "bolt" )
Variables ¶
View Source
var ErrNotFound = errors.New("store: key not found")
Get never returns (nil, nil)
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore[T any] struct { Db *bolt.DB DbFile string FileMode os.FileMode Bucket string // contains filtered or unexported fields }
BoltStore is a generic bbolt-backed implementation of Store[T] Values are json-marshalled into a single bucket, keyed by the 16 raw bytes of the value's uuid. In short, key: uuid.UUID; value: T
func NewBoltStore ¶
func (*BoltStore[T]) CreateBucket ¶
type InMemoryStore ¶
type InMemoryStore[T Keyable] struct { // contains filtered or unexported fields }
func NewInMemoryStore ¶
func NewInMemoryStore[T Keyable]() *InMemoryStore[T]
func (*InMemoryStore[T]) Close ¶
func (i *InMemoryStore[T]) Close() error
func (*InMemoryStore[T]) Count ¶
func (i *InMemoryStore[T]) Count() (int, error)
func (*InMemoryStore[T]) List ¶
func (i *InMemoryStore[T]) List() ([]*T, error)
type SharedBolt ¶
type SharedBolt struct {
}
owns a single bbolt file backing several bucket views. bbolt takes an exclusive lock on the file, so a component's stores must all come from one open handle. SharedBolt acts as that handle, and Bucket hands out Store[T] views over its buckets
func OpenSharedBolt ¶
func OpenSharedBolt(file string, mode os.FileMode) (*SharedBolt, error)
func (*SharedBolt) Close ¶
func (s *SharedBolt) Close() error
Click to show internal directories.
Click to hide internal directories.