Documentation ¶
Index ¶
- Variables
- func ApplyMessage(store VersionedStore, in message.Message) (out message.Message)
- type BlobStore
- type BlobStoreWrapper
- type BoltStore
- type Builder
- type ChangeListener
- type DiskStore
- type DynamoDBStore
- type DynamoDBVersionedStore
- type InMemoryStore
- type Option
- type Paired
- type RemoteStore
- type RemoteVersionedStore
- type S3Store
- type Store
- type VersionedStore
- type VersionedWrapper
Constants ¶
This section is empty.
Variables ¶
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 = errors.New("request timed out")
)
Functions ¶
func ApplyMessage ¶
func ApplyMessage(store VersionedStore, in message.Message) (out message.Message)
Types ¶
type BlobStoreWrapper ¶
type BlobStoreWrapper struct {
// contains filtered or unexported fields
}
BlobStore wraps a Store to make sure content is never overwritten, by using as key for a value the SHA1 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
type ChangeListener ¶
type DiskStore ¶
type DiskStore struct {
// contains filtered or unexported fields
}
DiskStore implements Store.
func NewDiskStore ¶
type DynamoDBStore ¶
type DynamoDBStore struct {
// contains filtered or unexported fields
}
func NewDynamoDBStore ¶
func NewDynamoDBStore(profile, region, table string) (*DynamoDBStore, error)
func (*DynamoDBStore) Put ¶
func (s *DynamoDBStore) Put(key, value []byte) (err error)
type DynamoDBVersionedStore ¶
type DynamoDBVersionedStore struct {
// contains filtered or unexported fields
}
func NewDynamoDBVersionedStore ¶
func NewDynamoDBVersionedStore(profile, region, table string, opts ...Option) (*DynamoDBVersionedStore, error)
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 S3Store ¶
type S3Store struct {
// contains filtered or unexported fields
}
S3Store is an implementation of Store backed by AWS S3.
func NewS3Store ¶
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.
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