Documentation
¶
Overview ¶
Package Cassandra contains code for integration or inter-operation with SOP's Cassandra DB. This package manage contents on tables like Registry, StoreRepository, Transaction Log.
Index ¶
- Constants
- Variables
- func CloseConnection()
- func IsConnectionInstantiated() bool
- func IsNil(id gocql.UUID) bool
- func NewBlobStore() sop.BlobStore
- func NewRegistry() sop.Registry
- func NewStoreRepository(manageBlobStore sop.ManageStore) sop.StoreRepository
- func NewTransactionLog() sop.TransactionLog
- type Config
- type Connection
- type ConsistencyBook
Constants ¶
const (
// DateHourLayout format mask string.
DateHourLayout = "2006-01-02T15"
)
Variables ¶
var NilUUID = gocql.UUID(sop.NilUUID)
NilUUID with gocql.UUID type.
var Now = time.Now
Now lambda to allow unit test to inject replayable time.Now.
Functions ¶
func IsConnectionInstantiated ¶
func IsConnectionInstantiated() bool
Returns true if connection instance is valid.
func NewBlobStore ¶
NewBlobStore instantiates a new BlobStore instance.
func NewRegistry ¶
NewRegistry manages the Handle in the store's Cassandra registry table.
func NewStoreRepository ¶
func NewStoreRepository(manageBlobStore sop.ManageStore) sop.StoreRepository
NewStoreRepository manages the StoreInfo in Cassandra table. Passing in nil to "managedBlobStore" will use default implementation in StoreRepository itself for managing Blob Store table in Cassandra.
func NewTransactionLog ¶
func NewTransactionLog() sop.TransactionLog
NewBlobStore instantiates a new BlobStore instance.
Types ¶
type Config ¶
type Config struct { // Cassandra hosts cluster. ClusterHosts []string // Keyspace to be used when doing I/O to cassandra. Keyspace string // Default Consistency level. Consistency gocql.Consistency // Connection Timeout. ConnectionTimeout time.Duration // Authenticator. Authenticator gocql.Authenticator // Defaults to "simple strategy & replication factor of 1". ReplicationClause string // ConsistencyBook should be used to specify consistency level to use for a given // API, e.g. one for RegistryAdd, another for StoreAdd, etc... if you so choose to. // // You can leave it default and the API will use the default Consistency level // for the cluster (defaults to local quorum). ConsistencyBook ConsistencyBook }
Config contains the this Cassandra package configuration or configurable variables.
type Connection ¶
Connection has the Session and the config used to open/create a session.
func OpenConnection ¶
func OpenConnection(config Config) (*Connection, error)
OpenConnection will create(& return) a new Connection to Cassandra if there is not one yet, otherwise, will just return existing singleton connection.
type ConsistencyBook ¶
type ConsistencyBook struct { RegistryAdd gocql.Consistency RegistryUpdate gocql.Consistency RegistryGet gocql.Consistency RegistryRemove gocql.Consistency StoreAdd gocql.Consistency StoreUpdate gocql.Consistency StoreGet gocql.Consistency StoreRemove gocql.Consistency // Blob Store Consistency configs are only used if Blob Store backend is Cassandra, // not used in others like File System. BlobStoreAdd gocql.Consistency BlobStoreGet gocql.Consistency BlobStoreUpdate gocql.Consistency BlobStoreRemove gocql.Consistency }
Lists all the available API's consistency level that are settable in this package.