Documentation ¶
Overview ¶
Package cockroach provides an implementation of a scd.Store on top of a cockroach DB instance.
Index ¶
- Variables
- type Store
- func (s *Store) Bootstrap(ctx context.Context) error
- func (s *Store) Close() error
- func (s *Store) DeleteOperation(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner) (*scdmodels.Operation, []*scdmodels.Subscription, error)
- func (c *Store) DeleteSubscription(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner, ...) (*scdmodels.Subscription, error)
- func (s *Store) GetOperation(ctx context.Context, id scdmodels.ID) (*scdmodels.Operation, error)
- func (c *Store) GetSubscription(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner) (*scdmodels.Subscription, error)
- func (s *Store) SearchOperations(ctx context.Context, v4d *dssmodels.Volume4D, owner dssmodels.Owner) ([]*scdmodels.Operation, error)
- func (c *Store) SearchSubscriptions(ctx context.Context, cells s2.CellUnion, owner dssmodels.Owner) ([]*scdmodels.Subscription, error)
- func (s *Store) UpsertOperation(ctx context.Context, operation *scdmodels.Operation, key []scdmodels.OVN) (*scdmodels.Operation, []*scdmodels.Subscription, error)
- func (c *Store) UpsertSubscription(ctx context.Context, s *scdmodels.Subscription) (*scdmodels.Subscription, []*scdmodels.Operation, error)
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultClock is what is used as the Store's clock, returned from Dial. DefaultClock = clockwork.NewRealClock() )
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store is an implementation of dss.Store using Cockroach DB as its backend store.
func (*Store) Bootstrap ¶
Bootstrap bootstraps the underlying database with required tables.
TODO: We should handle database migrations properly, but bootstrap both us *and* the database with this manual approach here.
func (*Store) DeleteOperation ¶
func (s *Store) DeleteOperation(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner) (*scdmodels.Operation, []*scdmodels.Subscription, error)
DeleteOperation deletes an operation for the given ID from CockroachDB
func (*Store) DeleteSubscription ¶
func (c *Store) DeleteSubscription(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner, version scdmodels.Version) (*scdmodels.Subscription, error)
DeleteSubscription deletes the subscription identified by "id" and returns the deleted subscription.
func (*Store) GetOperation ¶
GetOperation returns an operation for the given ID from CockroachDB
func (*Store) GetSubscription ¶
func (c *Store) GetSubscription(ctx context.Context, id scdmodels.ID, owner dssmodels.Owner) (*scdmodels.Subscription, error)
GetSubscription returns the subscription identified by "id".
func (*Store) SearchOperations ¶
func (s *Store) SearchOperations(ctx context.Context, v4d *dssmodels.Volume4D, owner dssmodels.Owner) ([]*scdmodels.Operation, error)
SearchOperations returns operations within the 4D volume from CockroachDB
func (*Store) SearchSubscriptions ¶
func (c *Store) SearchSubscriptions(ctx context.Context, cells s2.CellUnion, owner dssmodels.Owner) ([]*scdmodels.Subscription, error)
SearchSubscriptions returns all subscriptions in "cells".
func (*Store) UpsertOperation ¶
func (s *Store) UpsertOperation(ctx context.Context, operation *scdmodels.Operation, key []scdmodels.OVN) (*scdmodels.Operation, []*scdmodels.Subscription, error)
UpsertOperation inserts or updates an operation in CockroachDB
func (*Store) UpsertSubscription ¶
func (c *Store) UpsertSubscription(ctx context.Context, s *scdmodels.Subscription) (*scdmodels.Subscription, []*scdmodels.Operation, error)
UpsertSubscription upserts subscription into the store and returns the resulting subscription including its ID.