Documentation
¶
Overview ¶
Package Cassandra contains code for integration or inter-operation with Cassandra DB.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
ClusterHosts []string
// Keyspace to be used when doing I/O to cassandra.
Keyspace string
// Consistency
Consistency gocql.Consistency
}
type Connection ¶
func GetConnection ¶
func GetConnection(config Config) (*Connection, error)
GetConnection will create(& return) a new Connection to Cassandra if there is not one yet, otherwise, will just return existing singleton connection.
type StoreRepository ¶
type StoreRepository interface {
// Fetch store info with name.
Get(context.Context, ...string) ([]btree.StoreInfo, error)
// Add store info. Add all or nothing.
Add(context.Context, ...btree.StoreInfo) error
// Update store info. Update all or nothing.
// Update should also merge the Count of items between the incoming store info
// and the target store info on the backend, as they may differ. It should use
// StoreInfo.CountDelta to reconcile the two.
Update(context.Context, ...btree.StoreInfo) error
// Remove store info with name. Remove all or nothing.
Remove(context.Context, ...string) error
}
StoreRepository interface specifies the store repository. Stores are readonly after creation, thus, no update method.
func NewStoreRepository ¶
func NewStoreRepository() StoreRepository
NewStoreRepository manages the StoreInfo in Cassandra table.
type VirtualIdRegistry ¶
type VirtualIdRegistry interface {
Get(context.Context, ...btree.UUID) ([]sop.Handle, error)
Add(context.Context, ...sop.Handle) error
Update(context.Context, ...sop.Handle) error
Remove(context.Context, ...btree.UUID) error
}
Virtual Id registry is essential in our support for all or nothing (sub)feature, which is essential in "fault tolerant" & "self healing" feature.
All methods are taking in a set of items and need to be implemented to do all or nothing feature, e.g. wrapped in transaction in Cassandra.
func NewVirtualIdRegistry ¶
func NewVirtualIdRegistry() VirtualIdRegistry
TODO: NewVirtualIdRegistry manages the Handle in Cassandra table, cached in Redis.