Documentation
¶
Index ¶
- type Driver
- func (d *Driver) Connect(ctx context.Context) error
- func (d *Driver) CreateStore(ctx context.Context, store *m.Store) (*m.Store, error)
- func (d *Driver) DeleteBlobRef(ctx context.Context, key uuid.UUID) error
- func (d *Driver) DeleteRecord(ctx context.Context, storeKey, key string) error
- func (d *Driver) DeleteStore(ctx context.Context, key string) error
- func (d *Driver) Disconnect(ctx context.Context) error
- func (d *Driver) FindStoreByName(ctx context.Context, name string) (*m.Store, error)
- func (d *Driver) GetBlobRef(ctx context.Context, key uuid.UUID) (*m.BlobRef, error)
- func (d *Driver) GetCurrentBlobRef(ctx context.Context, storeKey, recordKey string) (*m.BlobRef, error)
- func (d *Driver) GetRecord(ctx context.Context, storeKey, key string) (*m.Record, error)
- func (d *Driver) GetStore(ctx context.Context, key string) (*m.Store, error)
- func (d *Driver) InsertBlobRef(ctx context.Context, blob *m.BlobRef) (*m.BlobRef, error)
- func (d *Driver) InsertRecord(ctx context.Context, storeKey string, record *m.Record) (*m.Record, error)
- func (d *Driver) ListBlobRefsByStatus(ctx context.Context, status m.BlobRefStatus, olderThan time.Time) (m.BlobRefCursor, error)
- func (d *Driver) PromoteBlobRefToCurrent(ctx context.Context, blob *m.BlobRef) (*m.Record, *m.BlobRef, error)
- func (d *Driver) RemoveBlobFromRecord(ctx context.Context, storeKey string, recordKey string) (*m.Record, *m.BlobRef, error)
- func (d *Driver) TimestampPrecision() time.Duration
- func (d *Driver) UpdateBlobRef(ctx context.Context, blob *m.BlobRef) (*m.BlobRef, error)
- func (d *Driver) UpdateRecord(ctx context.Context, storeKey string, key string, updater m.RecordUpdater) (*m.Record, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver struct { // Datastore namespace for multi-tenancy Namespace string // contains filtered or unexported fields }
Driver is an implementation of the metadb.Driver interface for Google Cloud Datastore. Call NewDriver to create a new driver instance.
func NewDriver ¶
NewDriver creates a new instance of Driver that can be used by metadb.MetaDB. projectID: Google Cloud Platform project ID to use
func (*Driver) CreateStore ¶
CreateStore creates a new store.
func (*Driver) DeleteBlobRef ¶
DeleteBlobRef implements Driver.DeleteBlobRef.
func (*Driver) DeleteRecord ¶
DeleteRecord deletes a record with key in store storeKey. It doesn't return error even if the key is not found in the database.
func (*Driver) DeleteStore ¶
DeleteStore deletes the store with specified key. Returns error if the store has any child records.
func (*Driver) Disconnect ¶
Disconnect terminates the database connection. Make sure to call this method to release resources (e.g. using defer). The MetaDB instance will not be available after Disconnect().
func (*Driver) FindStoreByName ¶
FindStoreByName finds and fetches a store based on the name (complete match).
func (*Driver) GetBlobRef ¶
GetBlobRef implements Driver.GetCurrentBlobRef.
func (*Driver) GetCurrentBlobRef ¶
func (d *Driver) GetCurrentBlobRef(ctx context.Context, storeKey, recordKey string) (*m.BlobRef, error)
GetCurrentBlobRef implements Driver.GetCurrentBlobRef.
func (*Driver) GetRecord ¶
GetRecord fetches and returns a record with key in store storeKey. Returns error if not found.
func (*Driver) GetStore ¶
GetStore fetches a store based on the key provided. Returns error if the key is not found.
func (*Driver) InsertBlobRef ¶
InsertBlobRef implements Driver.InsertBlobRef.
func (*Driver) InsertRecord ¶
func (d *Driver) InsertRecord(ctx context.Context, storeKey string, record *m.Record) (*m.Record, error)
InsertRecord creates a new Record in the store specified with storeKey. Returns error if there is already a record with the same key.
func (*Driver) ListBlobRefsByStatus ¶
func (d *Driver) ListBlobRefsByStatus(ctx context.Context, status m.BlobRefStatus, olderThan time.Time) (m.BlobRefCursor, error)
ListBlobRefsByStatus implements Driver.ListBlobRefsByStatus.
func (*Driver) PromoteBlobRefToCurrent ¶
func (d *Driver) PromoteBlobRefToCurrent(ctx context.Context, blob *m.BlobRef) (*m.Record, *m.BlobRef, error)
PromoteBlobRefToCurrent implements Driver.PromoteBlobRefToCurrent.
func (*Driver) RemoveBlobFromRecord ¶
func (d *Driver) RemoveBlobFromRecord(ctx context.Context, storeKey string, recordKey string) (*m.Record, *m.BlobRef, error)
RemoveBlobFromRecord implements Driver.RemoveBlobFromRecord.
func (*Driver) TimestampPrecision ¶
TimestampPrecision returns the precision of timestamps stored in Cloud Datastore. Currently it's 1 microsecond. https://cloud.google.com/datastore/docs/concepts/entities#date_and_time
func (*Driver) UpdateBlobRef ¶
UpdateBlobRef implements Driver.UpdateBlobRef.