Documentation
¶
Overview ¶
Package persistence adds a layer which handles data storage. This package separates the data from the business layer and is responsible for saving and retrieving it.
Index ¶
Constants ¶
View Source
const KeyLength = encryption.KeyLength
KeyLength represents the byte size of the key.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataDescriptor ¶
DataDescriptor is an interface representing data saved in the persistence layer represented by Handle.
type Handle ¶
type Handle interface {
// Save takes the provided data and persists it under the given name in the
// provided directory appropriate for the given persistent storage
// implementation.
Save(data []byte, directory string, name string) error
// ReadAll returns all non-archived data. It returns two channels: the first
// channel returned is a non-buffered channel streaming DataDescriptors of
// all data read. The second channel is a non-buffered channel streaming all
// errors occurred during reading. Returned channels can be integrated
// in a pipeline pattern. The function is non-blocking. Channels are closed
// when there is no more to be read.
ReadAll() (<-chan DataDescriptor, <-chan error)
// Archive marks the entire directory with the name provided as archived
// so that the data in that directory is not returned from ReadAll.
Archive(directory string) error
}
Handle is an interface for data persistence. Underlying implementation can write data e.g. to disk, cache, or hardware module.
func NewDiskHandle ¶
NewDiskHandle creates on-disk data persistence handle
func NewEncryptedPersistence ¶
NewEncryptedPersistence creates an adapter for the disk persistence to store data in an encrypted format
Click to show internal directories.
Click to hide internal directories.