Documentation ¶
Overview ¶
Package dsstore is a Datastore-based storage for DAM/IC.
Index ¶
- type Entity
- type History
- type Key
- type Lock
- type Meta
- type Store
- func (s *Store) Delete(datatype, realm, user, id string, rev int64) error
- func (s *Store) DeleteTx(datatype, realm, user, id string, rev int64, tx storage.Tx) (ferr error)
- func (s *Store) Exists(datatype, realm, user, id string, rev int64) (bool, error)
- func (s *Store) Info() map[string]string
- func (s *Store) Init(ctx context.Context) error
- func (s *Store) LockTx(lockName string, minFrequency time.Duration, tx storage.Tx) storage.Tx
- func (s *Store) MultiDeleteTx(datatype, realm, user string, tx storage.Tx) error
- func (s *Store) MultiReadTx(datatype, realm, user string, filters [][]storage.Filter, offset, pageSize int, ...) (_ int, ferr error)
- func (s *Store) Read(datatype, realm, user, id string, rev int64, content proto.Message) error
- func (s *Store) ReadHistory(datatype, realm, user, id string, content *[]proto.Message) error
- func (s *Store) ReadHistoryTx(datatype, realm, user, id string, content *[]proto.Message, tx storage.Tx) (ferr error)
- func (s *Store) ReadTx(datatype, realm, user, id string, rev int64, content proto.Message, ...) (ferr error)
- func (s *Store) Tx(update bool) (storage.Tx, error)
- func (s *Store) Wipe(realm string) error
- func (s *Store) Write(datatype, realm, user, id string, rev int64, content proto.Message, ...) error
- func (s *Store) WriteTx(datatype, realm, user, id string, rev int64, content proto.Message, ...) (ferr error)
- type Tx
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶ added in v0.8.7
type Entity struct { Key *datastore.Key `datastore:"__key__"` Service string `datastore:"service"` Datatype string `datastore:"type"` Realm string `datastore:"realm"` User string `datastore:"user_id"` ID string `datastore:"id"` Rev int64 `datastore:"rev"` Version string `datastore:"version,noindex"` Modified int64 `datastore:"modified"` Content string `datastore:"content,noindex"` }
Entity is a datastore entity for data.
type History ¶ added in v0.8.7
type History struct { Key *datastore.Key `datastore:"__key__"` Service string `datastore:"service"` Datatype string `datastore:"type"` Realm string `datastore:"realm"` User string `datastore:"user_id"` ID string `datastore:"id"` Rev int64 `datastore:"rev"` Version string `datastore:"version,noindex"` Modified int64 `datastore:"modified"` Content string `datastore:"content,noindex"` }
History is an datastore entity for history.
type Key ¶ added in v0.8.7
type Key struct { Datatype string `datastore:"type"` Realm string `datastore:"realm"` User string `datastore:"user_id"` ID string `datastore:"id"` Rev int64 `datastore:"rev"` }
Key is the key for items.
type Lock ¶ added in v0.8.6
type Lock struct {
// contains filtered or unexported fields
}
Lock is the data for a lock.
func (*Lock) Acquire ¶ added in v0.8.6
Acquire attempts to acquire the lock until the specified time. Warning: The times used are local times, be careful with cross process clock skew, stop assuming that you hold the lock slightly before you
type Meta ¶ added in v0.8.7
type Meta struct { Key *datastore.Key `datastore:"__key__"` Name string `datastore:"name"` Value string `datastore:"value,noindex"` }
Meta is a datastore entity for meta.
type Store ¶ added in v0.8.7
type Store struct {
// contains filtered or unexported fields
}
Store is a datastore based implementation of storage.
func NewStore ¶ added in v0.8.7
NewStore creates a new datastore storace and initilizes it. TODO: create the client for datastore in the main and inject it.
func (*Store) Info ¶ added in v0.8.7
Info returns some information about the store. TODO: delete this and pass the information directly rather than through store.
func (*Store) Init ¶ added in v0.8.7
Init initilizes the store. It creates some metadata information about the store on datastore. If metada information already exists on datastore, it comapres to see if they are compatible with the metadata information of the current store.
func (*Store) LockTx ¶ added in v0.8.7
LockTx returns a storage-wide lock by the given name. Only one such lock should be requested at a time. If Tx is provided, it must be an update Tx. TODO: get rid of this function and fix the code using it. Note: This doesn't provide distributed mutual exclusion, don't use this.
func (*Store) MultiDeleteTx ¶ added in v0.8.7
MultiDeleteTx deletes all records of a certain data type within a realm. If user is "", deletes for all users.
func (*Store) MultiReadTx ¶ added in v0.8.7
func (s *Store) MultiReadTx(datatype, realm, user string, filters [][]storage.Filter, offset, pageSize int, content map[string]map[string]proto.Message, typ proto.Message, tx storage.Tx) (_ int, ferr error)
MultiReadTx reads a set of data entities matching the filters. MultiReadTx will not see the writes inside the transaction. If realm is "" reads all realms. if user is "" reads all users. Returns the number of items matching the filter. content is a map of user and id to values.
func (*Store) ReadHistory ¶ added in v0.8.7
ReadHistory reads the history.
func (*Store) ReadHistoryTx ¶ added in v0.8.7
func (s *Store) ReadHistoryTx(datatype, realm, user, id string, content *[]proto.Message, tx storage.Tx) (ferr error)
ReadHistoryTx reads the history inside a transaction.
func (*Store) ReadTx ¶ added in v0.8.7
func (s *Store) ReadTx(datatype, realm, user, id string, rev int64, content proto.Message, tx storage.Tx) (ferr error)
ReadTx reads a data entity inside a transaction. ReadTx will not see the writes inside the transaction.
func (*Store) Wipe ¶ added in v0.8.7
Wipe deletes all data and history within a realm. If realm is "" deletes for all realms.
type Tx ¶ added in v0.8.7
type Tx struct { Tx *datastore.Transaction // contains filtered or unexported fields }
Tx is a transaction.
func (*Tx) MakeUpdate ¶ added in v0.8.8
MakeUpdate will upgrade a read-only transaction to an update transaction.