Documentation ¶
Index ¶
- Constants
- type MultiDimLockableStore
- type MultiDimLockableStoreImpl
- func (s *MultiDimLockableStoreImpl) Lock(ctx context.Context, path ...interface{}) (func(), error)
- func (s *MultiDimLockableStoreImpl) NewTransaction(ctx context.Context, readOnly bool) (Transaction, error)
- func (s *MultiDimLockableStoreImpl) RLock(ctx context.Context, path ...interface{}) (func(), error)
- func (s *MultiDimLockableStoreImpl) Shutdown(ctx context.Context) error
- type Query
- type QueryResults
- type RWLock
- type Read
- type Transaction
- type TransactionImpl
- func (t *TransactionImpl) Commit(ctx context.Context) error
- func (t *TransactionImpl) Delete(ctx context.Context, path ...interface{}) error
- func (t *TransactionImpl) Discard(ctx context.Context)
- func (t *TransactionImpl) Get(ctx context.Context, path ...interface{}) ([]byte, error)
- func (t *TransactionImpl) GetChildren(ctx context.Context, path ...interface{}) (map[string]bool, error)
- func (t *TransactionImpl) Has(ctx context.Context, path ...interface{}) (bool, error)
- func (t *TransactionImpl) Put(ctx context.Context, value []byte, path ...interface{}) error
- func (t *TransactionImpl) Query(ctx context.Context, query Query, path ...interface{}) (QueryResults, error)
- type Write
Constants ¶
const (
DatastoreKeySeperator = "/"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiDimLockableStore ¶
type MultiDimLockableStore interface { RWLock // NewTransaction creates a new transaction. // // @input - context, boolean indicating if only read operations will be accessed. // // @output - transaction, error. NewTransaction(ctx context.Context, readOnly bool) (Transaction, error) }
MultiDimLockableStore is the interface for a multi-dimensional lockable datastore. Every opetation needs to be done via transaction.
type MultiDimLockableStoreImpl ¶
type MultiDimLockableStoreImpl struct {
// contains filtered or unexported fields
}
MultiDimLockableStoreImpl is the implementation of the MultiDimLockableStore interface.
func NewMultiDimLockableStoreImpl ¶
func NewMultiDimLockableStoreImpl(ctx context.Context, path string) (*MultiDimLockableStoreImpl, error)
NewMultiDimLockableStoreImpl creates a new MultiDimLockableStore.
@input - context, path.
@output - store, error.
func (*MultiDimLockableStoreImpl) Lock ¶
func (s *MultiDimLockableStoreImpl) Lock(ctx context.Context, path ...interface{}) (func(), error)
Lock is used to write lock a given path.
@input - context, path.
@output - function to release lock, error.
func (*MultiDimLockableStoreImpl) NewTransaction ¶
func (s *MultiDimLockableStoreImpl) NewTransaction(ctx context.Context, readOnly bool) (Transaction, error)
NewTransaction creates a new transaction.
@input - context, boolean indicating if only read operations will be accessed.
@output - transaction, error.
type Query ¶
type Query struct { Filters []dsquery.Filter // filter results. apply sequentially Orders []dsquery.Order // order results. apply hierarchically Limit int // maximum number of results Offset int // skip given number of results KeysOnly bool // return only keys. ReturnExpirations bool // return expirations (see TTLDatastore) ReturnsSizes bool // always return sizes. If not set, datastore impl can return }
Query is a wrapper over the dsquery.Query.
type QueryResults ¶
QueryResults is a wrapper over the dsquery.Query.
type RWLock ¶
type RWLock interface { // RLock is used to read lock a given path. // // @input - context, path. // // @output - function to release lock, error. RLock(ctx context.Context, path ...interface{}) (func(), error) // Lock is used to write lock a given path. // // @input - context, path. // // @output - function to release lock, error. Lock(ctx context.Context, path ...interface{}) (func(), error) }
RWLock is the interface to do read/write lock.
type Read ¶
type Read interface { // Get gets the value for a given path. // // @input - context, path. // // @output - value, error. Get(ctx context.Context, path ...interface{}) ([]byte, error) // GetChildren gets the children for a given path. // // @input - context, path. // // @output - children, error. GetChildren(ctx context.Context, path ...interface{}) (map[string]bool, error) // Has checks if given path exists. // // @input - context, path. // // @output - boolean indicating if given path exists, error. Has(ctx context.Context, path ...interface{}) (bool, error) // Query queries the datastore for given path. // // @input - context, query, path. // // @output - query results, error. Query(ctx context.Context, query Query, path ...interface{}) (QueryResults, error) }
Read is the interface to query datastore.
type Transaction ¶
type Transaction interface { Read Write // Commit commits a transaction. Push all changes to the datastore. // // @input - context. // // @output - error. Commit(ctx context.Context) error // Discard discards a transaction. // // @input - context. Discard(ctx context.Context) }
Transaction is used to batch queries and mutations to a datastore into atomic groups.
type TransactionImpl ¶
type TransactionImpl struct {
// contains filtered or unexported fields
}
TransactionImpl is the implementation of the Transaction interface.
func (*TransactionImpl) Commit ¶
func (t *TransactionImpl) Commit(ctx context.Context) error
Commit commits a transaction. Push all changes to the datastore.
@input - context.
@output - error.
func (*TransactionImpl) Delete ¶
func (t *TransactionImpl) Delete(ctx context.Context, path ...interface{}) error
Delete deletes a given path.
@input - context, path.
@output - error.
func (*TransactionImpl) Discard ¶
func (t *TransactionImpl) Discard(ctx context.Context)
Discard discards a transaction.
@input - context.
func (*TransactionImpl) Get ¶
func (t *TransactionImpl) Get(ctx context.Context, path ...interface{}) ([]byte, error)
Get gets the value for a given path.
@input - context, path.
@output - data, error.
func (*TransactionImpl) GetChildren ¶
func (t *TransactionImpl) GetChildren(ctx context.Context, path ...interface{}) (map[string]bool, error)
GetChildren gets the children for a given path.
@input - context, path.
@output - children, error.
func (*TransactionImpl) Has ¶
func (t *TransactionImpl) Has(ctx context.Context, path ...interface{}) (bool, error)
Has checks if given path exists.
@input - context, path.
@output - boolean indicating if given path exists, error.
func (*TransactionImpl) Put ¶
func (t *TransactionImpl) Put(ctx context.Context, value []byte, path ...interface{}) error
Put puts the value for a given path.
@input - context, value, path.
@output - error.
func (*TransactionImpl) Query ¶
func (t *TransactionImpl) Query(ctx context.Context, query Query, path ...interface{}) (QueryResults, error)
Query queries the datastore for given path.
@input - context, query, path.
@output - query results, error.
type Write ¶
type Write interface { // Put puts the value for a given path. // // @input - context, value, path. // // @output - error. Put(ctx context.Context, value []byte, path ...interface{}) error // Delete deletes a given path. // // @input - context, path. // // @output - error. Delete(ctx context.Context, path ...interface{}) error }
Write is the interface to mutate datastore.