Documentation ¶
Overview ¶
Package objectstore defines an interface between the helium services and the session data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBadgerObjectStore ¶
NewBadgerObjectStore creates a new ObjectStore instance.
func NewHybridObjectStore ¶
NewHybridObjectStore creates a new ObjectStore instance.
func NewMemObjectStore ¶
func NewMemObjectStore() *memObjectStore
NewMemObjectStore creates a new ObjectStore instance.
func NewNullObjectStore ¶
func NewNullObjectStore() *nullObjectStore
NewNullObjectStore creates a new ObjectStore instance.
Types ¶
type Config ¶
type Config struct { BackendName string // BackendName is a string defining the ObjectStore implementation to use. DBPath string }
Config represents the ObjectStore configuration.
type ObjectStore ¶
type ObjectStore interface { // Store stores the binary-serializable `object` into the ObjectStore indexing it with the string `objectID`. Store(objectID string, object encoding.BinaryMarshaler) error // Load loads the binary-deserializable `object` from the ObjectStore indexing it with the string `objectID`. // the result is loaded directly into `object` Load(objectID string, object encoding.BinaryUnmarshaler) error // IsPresent checks if the object indexed with the string `objectID` is present in the ObjectStore. IsPresent(objectID string) (bool, error) // Close releases the resources allocated by the ObjectStore. Close() error }
ObjectStore is an interface to store and retrieve session data.
func NewObjectStoreFromConfig ¶
func NewObjectStoreFromConfig(config Config) (objs ObjectStore, err error)
NewObjectStoreFromConfig creates a new ObjectStore instance from the given Config. It accepts the following store backends: - "null": a no-op store that does nothing. - "mem": an in-memory store. - "badgerdb": a persistent store using BadgerDB. - "hybrid": a store that combines an in-memory and a persistent store.