Documentation
¶
Index ¶
- Constants
- func BuildCLIOptions() *cli.App
- func CheckCompatibleVersion(cfg config.Cassandra, expectedVersion string, ...) error
- func RunTool(args []string) error
- func SetupSchema(config *SetupSchemaConfig) error
- func VerifyCompatibleVersion(cfg config.Persistence, expectedConsistency gocql.Consistency) error
- type CQLClientConfig
- type CqlClient
- type CqlClientImpl
- func (client *CqlClientImpl) Close()
- func (client *CqlClientImpl) CreateDatabase(name string) error
- func (client *CqlClientImpl) CreateKeyspace(name string) error
- func (client *CqlClientImpl) CreateNTSKeyspace(name string, datacenter string) error
- func (client *CqlClientImpl) CreateSchemaVersionTables() error
- func (client *CqlClientImpl) DropAllTables() error
- func (client *CqlClientImpl) DropAllTablesTypes() error
- func (client *CqlClientImpl) DropDatabase(name string) error
- func (client *CqlClientImpl) DropKeyspace(name string) error
- func (client *CqlClientImpl) DropTable(name string) error
- func (client *CqlClientImpl) DropType(name string) error
- func (client *CqlClientImpl) ExecDDLQuery(stmt string, args ...interface{}) error
- func (client *CqlClientImpl) ListTables() ([]string, error)
- func (client *CqlClientImpl) ListTypes() ([]string, error)
- func (client *CqlClientImpl) ReadSchemaVersion() (string, error)
- func (client *CqlClientImpl) UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error
- func (client *CqlClientImpl) WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error
- type SetupSchemaConfig
Constants ¶
const ( DefaultTimeout = 30 // Timeout in seconds DefaultConnectTimeout = 2 // Connect timeout in seconds DefaultCassandraPort = 9042 SystemKeyspace = "system" )
const ( // Retry policy constants ClientCreationRetryInitialInterval = time.Second ClientCreationRetryMaximumInterval = 10 * time.Second ClientCreationRetryMaximumAttempts = 3 )
Variables ¶
This section is empty.
Functions ¶
func BuildCLIOptions ¶ added in v0.21.0
func CheckCompatibleVersion ¶ added in v0.3.3
func CheckCompatibleVersion( cfg config.Cassandra, expectedVersion string, expectedConsistency gocql.Consistency, ) error
CheckCompatibleVersion check the version compatibility
func SetupSchema ¶
func SetupSchema(config *SetupSchemaConfig) error
SetupSchema setups the cassandra schema
func VerifyCompatibleVersion ¶ added in v0.3.6
func VerifyCompatibleVersion( cfg config.Persistence, expectedConsistency gocql.Consistency, ) error
VerifyCompatibleVersion ensures that the installed version of cadence and visibility keyspaces is greater than or equal to the expected version. In most cases, the versions should match. However if after a schema upgrade there is a code rollback, the code version (expected version) would fall lower than the actual version in cassandra.
Types ¶
type CQLClientConfig ¶ added in v0.5.7
type CQLClientConfig struct {
Hosts string
Port int
User string
Password string
AllowedAuthenticators []string
Keyspace string
Timeout int
ConnectTimeout int
NumReplicas int
ProtoVersion int
TLS *config.TLS
}
CQLClientConfig contains the configuration for cql client
type CqlClient ¶ added in v0.21.0
type CqlClient interface {
CreateDatabase(name string) error
DropDatabase(name string) error
CreateKeyspace(name string) error
CreateNTSKeyspace(name string, datacenter string) error
DropKeyspace(name string) error
DropAllTables() error
CreateSchemaVersionTables() error
ReadSchemaVersion() (string, error)
UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error
WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error
ExecDDLQuery(stmt string, args ...interface{}) error
Close()
ListTables() ([]string, error)
ListTypes() ([]string, error)
DropTable(name string) error
DropType(name string) error
DropAllTablesTypes() error
}
func NewCQLClient ¶ added in v0.21.0
func NewCQLClient(cfg *CQLClientConfig, expectedConsistency gocql.Consistency) (CqlClient, error)
func NewCQLClientWithRetry ¶ added in v1.3.1
func NewCQLClientWithRetry(cfg *CQLClientConfig, expectedConsistency gocql.Consistency, cassClient gocql.Client, retrier *backoff.ThrottleRetry) (CqlClient, error)
NewCQLClient returns a new instance of CQLClient
type CqlClientImpl ¶ added in v1.0.0
type CqlClientImpl struct {
// contains filtered or unexported fields
}
func (*CqlClientImpl) Close ¶ added in v1.0.0
func (client *CqlClientImpl) Close()
Close closes the cql client
func (*CqlClientImpl) CreateDatabase ¶ added in v1.0.0
func (client *CqlClientImpl) CreateDatabase(name string) error
func (*CqlClientImpl) CreateKeyspace ¶ added in v1.0.0
func (client *CqlClientImpl) CreateKeyspace(name string) error
CreateNTSKeyspace creates a cassandra Keyspace if it doesn't exist using network topology strategy
func (*CqlClientImpl) CreateNTSKeyspace ¶ added in v1.0.0
func (client *CqlClientImpl) CreateNTSKeyspace(name string, datacenter string) error
CreateNTSKeyspace creates a cassandra Keyspace if it doesn't exist using network topology strategy
func (*CqlClientImpl) CreateSchemaVersionTables ¶ added in v1.0.0
func (client *CqlClientImpl) CreateSchemaVersionTables() error
CreateSchemaVersionTables sets up the schema version tables
func (*CqlClientImpl) DropAllTables ¶ added in v1.0.0
func (client *CqlClientImpl) DropAllTables() error
func (*CqlClientImpl) DropAllTablesTypes ¶ added in v1.0.0
func (client *CqlClientImpl) DropAllTablesTypes() error
DropAllTablesTypes deletes all tables/types in the Keyspace without deleting the Keyspace
func (*CqlClientImpl) DropDatabase ¶ added in v1.0.0
func (client *CqlClientImpl) DropDatabase(name string) error
func (*CqlClientImpl) DropKeyspace ¶ added in v1.0.0
func (client *CqlClientImpl) DropKeyspace(name string) error
DropKeyspace drops a Keyspace
func (*CqlClientImpl) DropTable ¶ added in v1.0.0
func (client *CqlClientImpl) DropTable(name string) error
DropTable drops a given table from the Keyspace
func (*CqlClientImpl) DropType ¶ added in v1.0.0
func (client *CqlClientImpl) DropType(name string) error
DropType drops a given type from the Keyspace
func (*CqlClientImpl) ExecDDLQuery ¶ added in v1.0.0
func (client *CqlClientImpl) ExecDDLQuery(stmt string, args ...interface{}) error
ExecDDLQuery executes a cql statement
func (*CqlClientImpl) ListTables ¶ added in v1.0.0
func (client *CqlClientImpl) ListTables() ([]string, error)
ListTables lists the table names in a Keyspace
func (*CqlClientImpl) ListTypes ¶ added in v1.0.0
func (client *CqlClientImpl) ListTypes() ([]string, error)
ListTypes lists the User defined types in a Keyspace.
func (*CqlClientImpl) ReadSchemaVersion ¶ added in v1.0.0
func (client *CqlClientImpl) ReadSchemaVersion() (string, error)
ReadSchemaVersion returns the current schema version for the Keyspace
func (*CqlClientImpl) UpdateSchemaVersion ¶ added in v1.0.0
func (client *CqlClientImpl) UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error
UpdateSchemaVersion updates the schema version for the Keyspace
func (*CqlClientImpl) WriteSchemaUpdateLog ¶ added in v1.0.0
func (client *CqlClientImpl) WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error
WriteSchemaUpdateLog adds an entry to the schema update history table
type SetupSchemaConfig ¶
type SetupSchemaConfig struct {
CQLClientConfig
schema.SetupConfig
}
SetupSchemaConfig contains the configuration params needed to setup schema tables