Documentation ¶
Index ¶
- Variables
- func ApplyMessage(store VersionedStore, in message.Message) (out message.Message)
- type BitcaskStore
- type BlobStore
- type BlobStoreWrapper
- type ChangeListener
- type DiskStore
- type InMemoryStore
- type Option
- type Paired
- type RemoteStore
- type RemoteVersionedStore
- type Store
- type StoreURI
- type VersionedStore
- type VersionedWrapper
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidStore is returned when calling NewStore() with an invalid or unspproted // store type. Support stores are: memory, disk, bitcask ErrInvalidStore = errors.New("error: invalid or unsupproted store") )
var ( // ErrNotFound indicates a key is not in the store. ErrNotFound = errors.New("not found") )
var ( // ErrStalePut indicates that some client has not see the latest version of the // key-value pair being put. The client should get the current version, decide // if it still wants to do the put, and in that case do the put with the // correct version. ErrStalePut = errors.New("stale put") )
var ( // ErrTimeout is the error returned for when requests time out ErrTimeout = errors.New("request timed out") )
Functions ¶
func ApplyMessage ¶
func ApplyMessage(store VersionedStore, in message.Message) (out message.Message)
ApplyMessage applies the message to the store
Types ¶
type BitcaskStore ¶
type BitcaskStore struct {
// contains filtered or unexported fields
}
BitcaskStore is a bitcask based storage engine
func (*BitcaskStore) Get ¶
func (s *BitcaskStore) Get(key []byte) (value []byte, err error)
Get implements the Store interface
func (*BitcaskStore) Put ¶
func (s *BitcaskStore) Put(key, value []byte) (err error)
Put implements the Store interface
type BlobStore ¶
type BlobStore interface { Get(key []byte) (value []byte, err error) Put(value []byte) (key []byte, err error) }
BlobStore is the interface for storing and retrieving blogs of data
type BlobStoreWrapper ¶
type BlobStoreWrapper struct {
// contains filtered or unexported fields
}
BlobStoreWrapper wraps a Store to make sure content is never overwritten, by using as key for a value the Blake2b hash of the value. Even if there are concurrent writes for the same key, those would write the same contents (with very high probability).
func NewBlobStore ¶
func NewBlobStore(delegate Store) *BlobStoreWrapper
NewBlobStore creates a new blob store with the provided delegate store
type ChangeListener ¶
type DiskStore ¶
type DiskStore struct {
// contains filtered or unexported fields
}
DiskStore implements Store.
func NewDiskStore ¶
NewDiskStore constructs a new Disk backed store
type InMemoryStore ¶
InMemoryStore is a Store implementation powered by a map, to be used for testing or caches.
func NewInMemoryStore ¶
func NewInMemoryStore() *InMemoryStore
func (*InMemoryStore) Put ¶
func (s *InMemoryStore) Put(key, value []byte) (err error)
type Option ¶
type Option func(*options)
func WithAuthKey ¶
func WithChangeListener ¶
func WithChangeListener(value ChangeListener) Option
func WithRequestTimeout ¶
func WithResponseBackoff ¶
type Paired ¶
type Paired struct {
// contains filtered or unexported fields
}
Paired implements Store wrapping a pair of stores, one fast, one slow. It will handle puts storing data in the fast store and syncing that to the slow store in the background. It will handle gets from the fast store if possible, otherwise from the slow store (and in this case also propagate the data from the slow to the fast store, for next time that piece of data is requested).
type RemoteStore ¶
type RemoteStore struct {
// contains filtered or unexported fields
}
RemoteStore implements Store. It requires to connect to a blobserver.
func NewRemoteStore ¶
func NewRemoteStore(address string) *RemoteStore
func (*RemoteStore) Put ¶
func (r *RemoteStore) Put(key, value []byte) (err error)
type RemoteVersionedStore ¶
type RemoteVersionedStore struct {
// contains filtered or unexported fields
}
RemoteVersionedStore is an implementation of VersionedStore, via a client to a remote metadataserver process.
func NewRemoteVersionedStore ¶
func NewRemoteVersionedStore(remote *client.Client, options ...Option) *RemoteVersionedStore
func (*RemoteVersionedStore) Get ¶
func (rs *RemoteVersionedStore) Get(key []byte) (version uint64, value []byte, err error)
func (*RemoteVersionedStore) Put ¶
func (rs *RemoteVersionedStore) Put(version uint64, key []byte, value []byte) (err error)
func (*RemoteVersionedStore) Start ¶
func (rs *RemoteVersionedStore) Start()
func (*RemoteVersionedStore) Stop ¶
func (rs *RemoteVersionedStore) Stop()
type Store ¶
type Store interface { Put(key, value []byte) (err error) // Get should return ErrNotFound if the key is not in the store. Get(key []byte) (value []byte, err error) }
Store represents a key-value store.
func NewBitcaskStore ¶
NewBitcaskStore creates a new store using Bitcask
type StoreURI ¶
StoreURI holds configuration parameters for a store parsed from a string such as <type://<host|path>?<param1>=<value1>
func ParseStoreURI ¶
type VersionedStore ¶
type VersionedStore interface { // Put should return ErrStalePut if the current version is not the version // passed as argument minus one. The client should have to prove that they've // seen the most current version before trying to update it. Put(version uint64, key []byte, value []byte) (err error) // Get should return ErrNotFound if the key is not in the store. Get(key []byte) (version uint64, value []byte, err error) }
type VersionedWrapper ¶
VersionedWrapper is a VersionedStore implementation wraping a given Store implementation. This is the quickest way of building a VersionedStore, but it's alos the slowest, as it serializes all calls to the underlying Store.
func NewVersionedWrapper ¶
func NewVersionedWrapper(delegate Store) *VersionedWrapper