Documentation ¶
Index ¶
- func Count(ctx context.Context, s *Store, funcName string) api.Decorator
- func CreateStoreSession(storeConfig *CassandraConn, keySpace string) (*gocql.Session, error)
- func Decorate(ef api.FuncType, decorators ...api.Decorator) api.FuncType
- func Safeguard(s *Store) api.Decorator
- func Trace(ctx context.Context, funcName string) api.Decorator
- type CASExecutor
- type CASResultSet
- func (rs *CASResultSet) All(ctx context.Context) ([]map[string]interface{}, error)
- func (rs *CASResultSet) Applied() bool
- func (rs *CASResultSet) Next(ctx context.Context) (map[string]interface{}, error)
- func (rs *CASResultSet) One(ctx context.Context, dest ...interface{}) bool
- func (rs *CASResultSet) PagingState() []byte
- type CassandraConn
- type Executor
- type ExecutorBase
- type Metrics
- type QueryBuilder
- type ReadExecutor
- type ResultSet
- func (rs *ResultSet) All(ctx context.Context) ([]map[string]interface{}, error)
- func (rs *ResultSet) Applied() bool
- func (rs *ResultSet) Close() error
- func (rs *ResultSet) Next(ctx context.Context) (map[string]interface{}, error)
- func (rs *ResultSet) One(ctx context.Context, dest ...interface{}) bool
- func (rs *ResultSet) PagingState() []byte
- type Store
- func (s *Store) Execute(ctx context.Context, stmt api.Statement) (api.ResultSet, error)
- func (s *Store) ExecuteBatch(ctx context.Context, stmts []api.Statement) error
- func (s *Store) Name() string
- func (s *Store) NewEntity() api.Table
- func (s *Store) NewQuery() api.QueryBuilder
- func (s *Store) String() string
- type WriteExecutor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateStoreSession ¶
func CreateStoreSession( storeConfig *CassandraConn, keySpace string) (*gocql.Session, error)
CreateStoreSession is to create clusters and connections
func Decorate ¶
Decorate invokes all the decorators on the function, usage: Decorate(aFunc, Instrument(s), Trace(c, "execute"))()
Types ¶
type CASExecutor ¶
type CASExecutor struct {
WriteExecutor
}
CASExecutor compare and set
func (CASExecutor) ExecuteBatch ¶
func (c CASExecutor) ExecuteBatch(ctx context.Context, stmts []api.Statement) (api.ResultSet, error)
ExecuteBatch is not supported with CAS
type CASResultSet ¶
type CASResultSet struct { ResultSet // contains filtered or unexported fields }
CASResultSet is returned from a Compare-and-Set operation
func (*CASResultSet) All ¶
func (rs *CASResultSet) All(ctx context.Context) ([]map[string]interface{}, error)
All returns a single result for non-applied CAS operations
func (*CASResultSet) Applied ¶
func (rs *CASResultSet) Applied() bool
Applied shows whether a set was done in a compare-and-set operation
func (*CASResultSet) Next ¶
func (rs *CASResultSet) Next(ctx context.Context) (map[string]interface{}, error)
Next returns the result if cas was not applied
func (*CASResultSet) One ¶
func (rs *CASResultSet) One(ctx context.Context, dest ...interface{}) bool
One is deprecated
func (*CASResultSet) PagingState ¶
func (rs *CASResultSet) PagingState() []byte
PagingState has no value for CAS operations
type CassandraConn ¶
type CassandraConn struct { ContactPoints []string `yaml:"contactPoints"` Port int `yaml:"port"` Username string `yaml:"username"` Password string `yaml:"password"` Consistency string `yaml:"consistency"` ConnectionsPerHost int `yaml:"connectionsPerHost"` Timeout time.Duration `yaml:"timeout"` SocketKeepalive time.Duration `yaml:"socketKeepalive"` ProtoVersion int `yaml:"protoVersion"` TTL time.Duration `yaml:"ttl"` LocalDCOnly bool `yaml:"localDCOnly"` // deprecated DataCenter string `yaml:"dataCenter"` // data center filter PageSize int `yaml:"pageSize"` RetryCount int `yaml:"retryCount"` HostPolicy string `yaml:"hostPolicy"` TimeoutLimit int `yaml:"timeoutLimit"` // number of timeouts allowed CQLVersion string `yaml:"cqlVersion"` // set only on C* 3.x MaxGoRoutines int `yaml:"maxGoroutines"` // a capacity limit }
CassandraConn describes the properties to manage a Cassandra connection.
type Executor ¶
type Executor interface { Execute(ctx context.Context, stmt api.Statement) (api.ResultSet, error) ExecuteBatch(ctx context.Context, stmts []api.Statement) (api.ResultSet, error) }
Executor interface. execution sequence is Allowed->{Execute, ExecuteBatch}->PostExecute
type ExecutorBase ¶
type ExecutorBase struct {
// contains filtered or unexported fields
}
ExecutorBase base for all executors
type Metrics ¶
type Metrics struct { ExecuteSuccess tally.Counter ExecuteFail tally.Counter ExecuteBatchSuccess tally.Counter ExecuteBatchFail tally.Counter }
Metrics is a struct for tracking execute statement / executeBatch statements failure / success counters
func NewMetrics ¶
NewMetrics function creates a Metrics struct
type QueryBuilder ¶
type QueryBuilder struct { }
QueryBuilder is responsible for building queries
func (*QueryBuilder) Delete ¶
func (s *QueryBuilder) Delete(from string) qb.DeleteBuilder
Delete returns a delete query
func (*QueryBuilder) Insert ¶
func (s *QueryBuilder) Insert(into string) qb.InsertBuilder
Insert returns an insert query
func (*QueryBuilder) Select ¶
func (s *QueryBuilder) Select(columns ...string) qb.SelectBuilder
Select returns a select query
func (*QueryBuilder) Update ¶
func (s *QueryBuilder) Update(table string) qb.UpdateBuilder
Update returns a update query
type ReadExecutor ¶
type ReadExecutor struct {
ExecutorBase
}
ReadExecutor supports select
func (ReadExecutor) ExecuteBatch ¶
func (r ReadExecutor) ExecuteBatch(ctx context.Context, stmts []api.Statement) (api.ResultSet, error)
ExecuteBatch is not supported on Read
type ResultSet ¶
type ResultSet struct {
// contains filtered or unexported fields
}
ResultSet is the result of a executed query
func (*ResultSet) All ¶
All returns all results in a SliceMap and cleans up itself. Client will not be able to use the ResultSet after this call.
func (*ResultSet) Close ¶
Close closes the iterator and returns any errors that happened during the query or the iteration.
func (*ResultSet) Next ¶
Next returns the next row out of the ResultSet. an empty map is returned if there is nothing left.
func (*ResultSet) PagingState ¶
PagingState returns the pagination token as opaque bytes so that caller can pass in for future queries.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store represents connections with Cassandra server nodes. the store object is used by multiple go routines. concurrency represents number of active go routines using the store.
func CreateStore ¶
CreateStore is to create clusters and connections
func (*Store) ExecuteBatch ¶
ExecuteBatch make a single RPC call for multiple statement execution. It ensures all statements are eventually executed
func (*Store) NewQuery ¶
func (s *Store) NewQuery() api.QueryBuilder
NewQuery creates a QueryBuilder object
type WriteExecutor ¶
type WriteExecutor struct {
ExecutorBase
}
WriteExecutor supports insert/update/delete
func (WriteExecutor) ExecuteBatch ¶
func (w WriteExecutor) ExecuteBatch(ctx context.Context, stmts []api.Statement) (api.ResultSet, error)
ExecuteBatch sends batch of write operations