schema

package
v1.2.15-prerelease07 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2024 License: MIT Imports: 20 Imported by: 4

Documentation

Overview

Package schema is a generated GoMock package.

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"
	// CLIOptAllowedAuthenticatorsis the cli option for cassandra allowed authenticators
	CLIOptAllowedAuthenticators = "allowed-authenticators"
	// CLIOptTimeout is the cli option for timeout
	CLIOptTimeout = "timeout"
	// CLIOptConnectTimeout is the cli option for connection timeout
	CLIOptConnectTimeout = "connect-timeout"
	// CLIOptKeyspace is the cli option for keyspace
	CLIOptKeyspace = "keyspace"
	// CLIOptDatabase is the cli option for datacenter
	CLIOptDatacenter = "datacenter"
	// CLIOptDatabase is the cli option for database
	CLIOptDatabase = "database"
	// 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"
	// CLIOptDryrun is the cli option for enabling dryrun
	CLIOptDryrun = "dryrun"
	// CLIOptSchemaDir is the cli option for schema directory
	CLIOptSchemaDir = "schema-dir"
	// CLIOptReplicationFactor is the cli option for replication factor
	CLIOptReplicationFactor = "replication-factor"
	// CLIOptQuiet is the cli option for quiet mode
	CLIOptQuiet = "quiet"
	// CLIOptProtoVersion is the cli option for protocol version
	CLIOptProtoVersion = "protocol-version"

	// CLIFlagEndpoint is the cli flag for endpoint
	CLIFlagEndpoint = CLIOptEndpoint
	// CLIFlagPort is the cli flag for port
	CLIFlagPort = CLIOptPort
	// CLIFlagUser is the cli flag for user
	CLIFlagUser = CLIOptUser
	// CLIFlagPassword is the cli flag for password
	CLIFlagPassword = CLIOptPassword
	// CLIFlagAllowedAuthenticators is the cli flag for whitelisting custom authenticators
	CLIFlagAllowedAuthenticators = CLIOptAllowedAuthenticators
	// CLIFlagConnectTimeout is the cli flag for connection timeout
	CLIFlagConnectTimeout = CLIOptConnectTimeout
	// CLIFlagTimeout is the cli flag for timeout
	CLIFlagTimeout = CLIOptTimeout
	// CLIFlagKeyspace is the cli flag for keyspace
	CLIFlagKeyspace = CLIOptKeyspace
	// CLIFlagDatacenter is the cli flag for datacenter
	CLIFlagDatacenter = CLIOptDatacenter
	// CLIFlagDatabase is the cli flag for database
	CLIFlagDatabase = CLIOptDatabase
	// CLIFlagPluginName is the cli flag for plugin name
	CLIFlagPluginName = CLIOptPluginName
	// CLIFlagConnectAttributes allows arbitrary connect attributes
	CLIFlagConnectAttributes = CLIOptConnectAttributes
	// CLIFlagVersion is the cli flag for version
	CLIFlagVersion = CLIOptVersion
	// CLIFlagSchemaFile is the cli flag for schema file
	CLIFlagSchemaFile = CLIOptSchemaFile
	// CLIFlagOverwrite is the cli flag for overwrite
	CLIFlagOverwrite = CLIOptOverwrite
	// CLIFlagDisableVersioning is the cli flag for disabling versioning
	CLIFlagDisableVersioning = CLIOptDisableVersioning
	// CLIFlagTargetVersion is the cli flag for target version
	CLIFlagTargetVersion = CLIOptTargetVersion
	// CLIFlagDryrun is the cli flag for dryrun
	CLIFlagDryrun = CLIOptDryrun
	// CLIFlagSchemaDir is the cli flag for schema directory
	CLIFlagSchemaDir = CLIOptSchemaDir
	// CLIFlagReplicationFactor is the cli flag for replication factor
	CLIFlagReplicationFactor = CLIOptReplicationFactor
	// CLIFlagQuiet is the cli flag for quiet mode
	CLIFlagQuiet = CLIOptQuiet
	// CLIFlagProtoVersion is the cli flag for protocol version
	CLIFlagProtoVersion = CLIOptProtoVersion

	// 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"
	// CLIFlagTLSEnableHostVerification enables tls host verification (tls must be enabled)
	CLIFlagTLSEnableHostVerification = "tls-enable-host-verification"
	// CLIFlagTLSServerName is the Server Name Indication to verify the hostname on the returned certificates.
	// It is also included in the client's handshake to support virtual hosting unless it is an IP address.
	CLIFlagTLSServerName = "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 ParseFile

func ParseFile(file fs.File) ([]string, error)

ParseFile takes a cql / sql file as input and returns an array of cql / sql statements on success.

func Setup

func Setup(cli *cli.Context, db SchemaClient) error

Setup sets up schema tables

func SetupFromConfig

func SetupFromConfig(config *SetupConfig, db SchemaClient) error

SetupFromConfig sets up schema tables based on the given config

func Update

func Update(cli *cli.Context, db SchemaClient) error

Update updates the schema for the specified database

func UpdateFromConfig added in v0.25.0

func UpdateFromConfig(config *UpdateConfig, db SchemaClient) error

UpdateFromConfig updates the schema for the specified database based on the given config

func VerifyCompatibleVersion

func VerifyCompatibleVersion(
	db SchemaClient,
	dbName string,
	expectedVersion string,
) error

VerifyCompatibleVersion ensures that the installed version is greater than or equal to the expected version.

Types

type ChangeSet added in v1.0.0

type ChangeSet struct {
	Version string

	CqlStmts []string
	// contains filtered or unexported fields
}

ChangeSet represents all the changes corresponding to a single schema version

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 MockSchemaClient

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

MockSchemaClient is a mock of SchemaClient interface.

func NewMockSchemaClient

func NewMockSchemaClient(ctrl *gomock.Controller) *MockSchemaClient

NewMockSchemaClient creates a new mock instance.

func (*MockSchemaClient) Close

func (m *MockSchemaClient) Close()

Close mocks base method.

func (*MockSchemaClient) CreateSchemaVersionTables

func (m *MockSchemaClient) CreateSchemaVersionTables() error

CreateSchemaVersionTables mocks base method.

func (*MockSchemaClient) DropAllTables

func (m *MockSchemaClient) DropAllTables() error

DropAllTables mocks base method.

func (*MockSchemaClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSchemaClient) ExecDDLQuery

func (m *MockSchemaClient) ExecDDLQuery(stmt string, args ...interface{}) error

ExecDDLQuery mocks base method.

func (*MockSchemaClient) ReadSchemaVersion

func (m *MockSchemaClient) ReadSchemaVersion() (string, error)

ReadSchemaVersion mocks base method.

func (*MockSchemaClient) UpdateSchemaVersion

func (m *MockSchemaClient) UpdateSchemaVersion(newVersion, minCompatibleVersion string) error

UpdateSchemaVersion mocks base method.

func (*MockSchemaClient) WriteSchemaUpdateLog

func (m *MockSchemaClient) WriteSchemaUpdateLog(oldVersion, newVersion, manifestMD5, desc string) error

WriteSchemaUpdateLog mocks base method.

type MockSchemaClientMockRecorder

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

MockSchemaClientMockRecorder is the mock recorder for MockSchemaClient.

func (*MockSchemaClientMockRecorder) Close

Close indicates an expected call of Close.

func (*MockSchemaClientMockRecorder) CreateSchemaVersionTables

func (mr *MockSchemaClientMockRecorder) CreateSchemaVersionTables() *gomock.Call

CreateSchemaVersionTables indicates an expected call of CreateSchemaVersionTables.

func (*MockSchemaClientMockRecorder) DropAllTables

func (mr *MockSchemaClientMockRecorder) DropAllTables() *gomock.Call

DropAllTables indicates an expected call of DropAllTables.

func (*MockSchemaClientMockRecorder) ExecDDLQuery

func (mr *MockSchemaClientMockRecorder) ExecDDLQuery(stmt interface{}, args ...interface{}) *gomock.Call

ExecDDLQuery indicates an expected call of ExecDDLQuery.

func (*MockSchemaClientMockRecorder) ReadSchemaVersion

func (mr *MockSchemaClientMockRecorder) ReadSchemaVersion() *gomock.Call

ReadSchemaVersion indicates an expected call of ReadSchemaVersion.

func (*MockSchemaClientMockRecorder) UpdateSchemaVersion

func (mr *MockSchemaClientMockRecorder) UpdateSchemaVersion(newVersion, minCompatibleVersion interface{}) *gomock.Call

UpdateSchemaVersion indicates an expected call of UpdateSchemaVersion.

func (*MockSchemaClientMockRecorder) WriteSchemaUpdateLog

func (mr *MockSchemaClientMockRecorder) WriteSchemaUpdateLog(oldVersion, newVersion, manifestMD5, desc interface{}) *gomock.Call

WriteSchemaUpdateLog indicates an expected call of WriteSchemaUpdateLog.

type SchemaClient added in v0.24.0

type SchemaClient interface {
	// ExecDDLQuery executes a schema statement
	ExecDDLQuery(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()
}

SchemaClient 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
	SchemaFS      fs.FS
	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 NewUpdateSchemaTask added in v1.0.0

func NewUpdateSchemaTask(db SchemaClient, config *UpdateConfig) *UpdateTask

NewUpdateSchemaTask returns a new instance of UpdateTask.

func (*UpdateTask) BuildChangeSet added in v1.0.0

func (task *UpdateTask) BuildChangeSet(currVer string) ([]ChangeSet, error)

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