schema

package
v1.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CLIOptEndpoint is the cli option for endpoint
	CLIOptEndpoint = "endpoint"
	// CLIOptPort is the cli option for port
	CLIOptPort = "port"
	// CLIOptUser is the cli option for user
	CLIOptUser = "user"
	// CLIOptPassword is the cli option for password
	CLIOptPassword = "password"
	// CLIOptTimeout is the cli option for timeout
	CLIOptTimeout = "timeout"
	// CLIOptKeyspace is the cli option for keyspace
	CLIOptKeyspace = "keyspace"
	// CLIOptDatabase is the cli option for database
	CLIOptDatabase = "database"
	// CLIOptDefaultDb is the cli option used as defaultdb to connect to
	CLIOptDefaultDb = "defaultdb"
	// CLIOptPluginName is the cli option for plugin name
	CLIOptPluginName = "plugin"
	// CLIOptConnectAttributes is the cli option for connect attributes (key/values via a url query string)
	CLIOptConnectAttributes = "connect-attributes"
	// CLIOptVersion is the cli option for version
	CLIOptVersion = "version"
	// CLIOptSchemaFile is the cli option for schema file
	CLIOptSchemaFile = "schema-file"
	// CLIOptOverwrite is the cli option for overwrite
	CLIOptOverwrite = "overwrite"
	// CLIOptDisableVersioning is the cli option to disabling versioning
	CLIOptDisableVersioning = "disable-versioning"
	// CLIOptTargetVersion is the cli option for target version
	CLIOptTargetVersion = "version"
	// CLIOptSchemaDir is the cli option for schema directory
	CLIOptSchemaDir = "schema-dir"
	// CLIOptReplicationFactor is the cli option for replication factor
	CLIOptReplicationFactor = "replication-factor"
	// CLIOptDatacenter is the cli option for NetworkTopologyStrategy datacenter
	CLIOptDatacenter = "datacenter"
	// CLIOptConsistency is the cli option for consistency settings
	CLIOptConsistency = "consistency"
	// CLIOptAddressTranslator is the cli option for address translator for Cassandra
	CLIOptAddressTranslator = "address-translator"
	// CLIOptAddressTranslatorOptions is the cli option for options for address translator
	CLIOptAddressTranslatorOptions = "address-translator-options"
	// CLIOptQuiet is the cli option for quiet mode
	CLIOptQuiet = "quiet"
	// CLIOptForce is the cli option for force mode
	CLIOptForce = "force"

	// CLIFlagEndpoint is the cli flag for endpoint
	CLIFlagEndpoint = CLIOptEndpoint + ", ep"
	// CLIFlagPort is the cli flag for port
	CLIFlagPort = CLIOptPort + ", p"
	// CLIFlagUser is the cli flag for user
	CLIFlagUser = CLIOptUser + ", u"
	// CLIFlagPassword is the cli flag for password
	CLIFlagPassword = CLIOptPassword + ", pw"
	// CLIFlagTimeout is the cli flag for timeout
	CLIFlagTimeout = CLIOptTimeout + ", t"
	// CLIFlagKeyspace is the cli flag for keyspace
	CLIFlagKeyspace = CLIOptKeyspace + ", k"
	// CLIFlagDatabase is the cli flag for database
	CLIFlagDatabase = CLIOptDatabase + ", db"
	// CLIFlagPluginName is the cli flag for plugin name
	CLIFlagPluginName = CLIOptPluginName + ", pl"
	// CLIFlagConnectAttributes allows arbitrary connect attributes
	CLIFlagConnectAttributes = CLIOptConnectAttributes + ", ca"
	// CLIFlagVersion is the cli flag for version
	CLIFlagVersion = CLIOptVersion + ", v"
	// CLIFlagSchemaFile is the cli flag for schema file
	CLIFlagSchemaFile = CLIOptSchemaFile + ", f"
	// CLIFlagOverwrite is the cli flag for overwrite
	CLIFlagOverwrite = CLIOptOverwrite + ", o"
	// CLIFlagDisableVersioning is the cli flag for disabling versioning
	CLIFlagDisableVersioning = CLIOptDisableVersioning + ", d"
	// CLIFlagTargetVersion is the cli flag for target version
	CLIFlagTargetVersion = CLIOptTargetVersion + ", v"
	// CLIFlagSchemaDir is the cli flag for schema directory
	CLIFlagSchemaDir = CLIOptSchemaDir + ", d"
	// CLIFlagReplicationFactor is the cli flag for replication factor
	CLIFlagReplicationFactor = CLIOptReplicationFactor + ", rf"
	// CLIFlagDatacenter is the cli option for NetworkTopologyStrategy datacenter
	CLIFlagDatacenter = CLIOptDatacenter + ", dc"
	// CLIFlagAddressTranslator is the cli option for address translator for Cassandra
	CLIFlagAddressTranslator = CLIOptAddressTranslator + ", at"
	// CLIFlagAddressTranslatorOptions is the cli option for address translator of Cassandra
	CLIFlagAddressTranslatorOptions
	// CLIFlagQuiet is the cli flag for quiet mode
	CLIFlagQuiet = CLIOptQuiet + ", q"
	// CLIFlagForce is the cli flag for force mode
	CLIFlagForce = CLIOptForce + ", f"
	// CLIFlagDisableInitialHostLookup is the cli flag for only using supplied hosts to connect to the database
	CLIFlagDisableInitialHostLookup = "disable-initial-host-lookup"

	// CLIFlagEnableTLS enables cassandra client TLS
	CLIFlagEnableTLS = "tls"
	// CLIFlagTLSCertFile is the optional tls cert file (tls must be enabled)
	CLIFlagTLSCertFile = "tls-cert-file"
	// CLIFlagTLSKeyFile is the optional tls key file (tls must be enabled)
	CLIFlagTLSKeyFile = "tls-key-file"
	// CLIFlagTLSCaFile is the optional tls CA file (tls must be enabled)
	CLIFlagTLSCaFile = "tls-ca-file"
	// CLIFlagTLSDisableHostVerification disable tls host verification (tls must be enabled)
	CLIFlagTLSDisableHostVerification = "tls-disable-host-verification"
	// CLIFlagTLSHostName specifies the host name for host name verification
	CLIFlagTLSHostName = "tls-server-name"
)

Variables

This section is empty.

Functions

func NewConfigError

func NewConfigError(msg string) error

NewConfigError creates and returns an instance of ConfigError

func Setup

func Setup(cli *cli.Context, db DB, logger log.Logger) error

Setup sets up schema tables

func Update

func Update(cli *cli.Context, db DB, logger log.Logger) error

Update updates the schema for the specified database

Types

type ConfigError

type ConfigError struct {
	// contains filtered or unexported fields
}

ConfigError is an error type that represents a problem with the config

func (*ConfigError) Error

func (e *ConfigError) Error() string

Error returns a string representation of this error

type DB

type DB interface {
	// Exec executes a cql statement
	Exec(stmt string, args ...interface{}) error
	// DropAllTables drops all tables
	DropAllTables() error
	// CreateSchemaVersionTables sets up the schema version tables
	CreateSchemaVersionTables() error
	// ReadSchemaVersion returns the current schema version for the keyspace
	ReadSchemaVersion() (string, error)
	// UpdateSchemaVersion updates the schema version for the keyspace
	UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error
	// WriteSchemaUpdateLog adds an entry to the schema update history table
	WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error
	// Close gracefully closes the client object
	Close()
}

DB is the database interface that's required to be implemented for the schema-tool to work

type SetupConfig

type SetupConfig struct {
	SchemaFilePath    string
	InitialVersion    string
	Overwrite         bool // overwrite previous data
	DisableVersioning bool // do not use schema versioning
}

SetupConfig holds the config params need by the SetupTask

type SetupTask

type SetupTask struct {
	// contains filtered or unexported fields
}

SetupTask represents a task that sets up cassandra schema on a specified keyspace

func (*SetupTask) Run

func (task *SetupTask) Run() error

Run executes the task

type UpdateConfig

type UpdateConfig struct {
	DBName        string
	TargetVersion string
	SchemaDir     string
	IsDryRun      bool
}

UpdateConfig holds the config params for executing a UpdateTask

type UpdateTask

type UpdateTask struct {
	// contains filtered or unexported fields
}

UpdateTask represents a task that executes a cassandra schema upgrade

func (*UpdateTask) Run

func (task *UpdateTask) Run() error

Run executes the task

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL