Documentation
¶
Index ¶
- Constants
- type CreateDatabaseConstantAction
- type CreateSchemaConstantAction
- type DropDatabaseConstantAction
- type DropSchemaConstantAction
- type DropSchemaTemplateConstantAction
- type RecordLayerConfig
- type RecordLayerMetadataOperationsFactory
- func (f *RecordLayerMetadataOperationsFactory) CreateDatabase(dbPath string, _ api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) CreateSchema(dbPath, schemaName, templateID string, _ api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) DropDatabase(dbPath string, throwIfDoesNotExist bool, options api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) DropSchema(dbPath, schemaName string, _ api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) DropSchemaTemplate(templateID string, throwIfDoesNotExist bool, _ api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) SaveSchemaTemplate(template api.SchemaTemplate, _ api.Options) apiddl.ConstantAction
- func (f *RecordLayerMetadataOperationsFactory) SetStoreState(dbPath, schemaName string, config RecordLayerConfig) apiddl.ConstantAction
- type SaveSchemaTemplateConstantAction
- type SetStoreStateConstantAction
Constants ¶
const ( // SysDatabasePath is the protected system database. DDL operations // that could break the catalog are rejected for this path. SysDatabasePath = "/__SYS" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateDatabaseConstantAction ¶
type CreateDatabaseConstantAction struct {
// contains filtered or unexported fields
}
CreateDatabaseConstantAction creates a new database entry in the catalog. Mirrors Java's CreateDatabaseConstantAction.
func NewCreateDatabaseConstantAction ¶
func NewCreateDatabaseConstantAction(dbPath string, catalog api.StoreCatalog) *CreateDatabaseConstantAction
func (*CreateDatabaseConstantAction) Execute ¶
func (a *CreateDatabaseConstantAction) Execute(txn api.Transaction) error
type CreateSchemaConstantAction ¶
type CreateSchemaConstantAction struct {
// contains filtered or unexported fields
}
CreateSchemaConstantAction creates a new schema in the catalog and, when a keyspace is provided, also creates the underlying FDB record store. Mirrors Java's RecordLayerCreateSchemaConstantAction.
func NewCreateSchemaConstantAction ¶
func NewCreateSchemaConstantAction( dbPath, schemaName, templateID string, cat api.StoreCatalog, ks *keyspace.RelationalKeyspace, ) *CreateSchemaConstantAction
func (*CreateSchemaConstantAction) Execute ¶
func (a *CreateSchemaConstantAction) Execute(txn api.Transaction) error
Execute runs Java's RecordLayerCreateSchemaConstantAction.execute, in its order and with its messages: the database exists (UNDEFINED_DATABASE); the template's latest version loads (UNKNOWN_SCHEMA_TEMPLATE); the catalog saves the schema with ERROR, which refuses a stored schema of that name with SCHEMA_ALREADY_EXISTS (and one bound to a gone template version with UNKNOWN_SCHEMA_TEMPLATE, as its load fails first); then the record store is created, and a store already there is SCHEMA_ALREADY_EXISTS.
type DropDatabaseConstantAction ¶
type DropDatabaseConstantAction struct {
// contains filtered or unexported fields
}
DropDatabaseConstantAction removes a database and all its schemas. Mirrors Java's DropDatabaseConstantAction.
func NewDropDatabaseConstantAction ¶
func NewDropDatabaseConstantAction( dbPath string, throwIfDoesNotExist bool, catalog api.StoreCatalog, opsFactory apiddl.MetadataOperationsFactory, options api.Options, ) *DropDatabaseConstantAction
func (*DropDatabaseConstantAction) Execute ¶
func (a *DropDatabaseConstantAction) Execute(txn api.Transaction) error
type DropSchemaConstantAction ¶
type DropSchemaConstantAction struct {
// contains filtered or unexported fields
}
DropSchemaConstantAction removes one schema from the catalog and, when a keyspace is provided, also deletes the underlying FDB record store. Mirrors Java's DropSchemaConstantAction.
func NewDropSchemaConstantAction ¶
func NewDropSchemaConstantAction( dbPath, schemaName string, cat api.StoreCatalog, ks *keyspace.RelationalKeyspace, ) *DropSchemaConstantAction
func (*DropSchemaConstantAction) Execute ¶
func (a *DropSchemaConstantAction) Execute(txn api.Transaction) error
type DropSchemaTemplateConstantAction ¶
type DropSchemaTemplateConstantAction struct {
// contains filtered or unexported fields
}
DropSchemaTemplateConstantAction removes all versions of a schema template. Mirrors Java's DropSchemaTemplateConstantAction (implied by MetadataOperationsFactory).
func NewDropSchemaTemplateConstantAction ¶
func NewDropSchemaTemplateConstantAction(templateID string, throwIfDoesNotExist bool, catalog api.SchemaTemplateCatalog) *DropSchemaTemplateConstantAction
func (*DropSchemaTemplateConstantAction) Execute ¶
func (a *DropSchemaTemplateConstantAction) Execute(txn api.Transaction) error
type RecordLayerConfig ¶
type RecordLayerConfig struct {
IndexStates map[string]recordlayer.IndexState
FormatVersion int32
}
RecordLayerConfig is the part of Java's RecordLayerConfig a store-state action reads: the index states to force and the format version to open at.
type RecordLayerMetadataOperationsFactory ¶
type RecordLayerMetadataOperationsFactory struct {
// contains filtered or unexported fields
}
RecordLayerMetadataOperationsFactory is the concrete MetadataOperationsFactory backed by a StoreCatalog. When ks is non-nil, CreateSchema and DropSchema also create/delete the underlying FDB record store. Mirrors Java's RecordLayerMetadataOperationsFactory.
func NewRecordLayerMetadataOperationsFactory ¶
func NewRecordLayerMetadataOperationsFactory(catalog api.StoreCatalog) *RecordLayerMetadataOperationsFactory
NewRecordLayerMetadataOperationsFactory constructs a factory in catalog-only mode (no FDB store creation/deletion).
func NewRecordLayerMetadataOperationsFactoryWithKeyspace ¶
func NewRecordLayerMetadataOperationsFactoryWithKeyspace( cat api.StoreCatalog, ks *keyspace.RelationalKeyspace, ) *RecordLayerMetadataOperationsFactory
NewRecordLayerMetadataOperationsFactoryWithKeyspace constructs a factory that also creates/deletes FDB record stores for schema operations.
func (*RecordLayerMetadataOperationsFactory) CreateDatabase ¶
func (f *RecordLayerMetadataOperationsFactory) CreateDatabase(dbPath string, _ api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) CreateSchema ¶
func (f *RecordLayerMetadataOperationsFactory) CreateSchema(dbPath, schemaName, templateID string, _ api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) DropDatabase ¶
func (f *RecordLayerMetadataOperationsFactory) DropDatabase(dbPath string, throwIfDoesNotExist bool, options api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) DropSchema ¶
func (f *RecordLayerMetadataOperationsFactory) DropSchema(dbPath, schemaName string, _ api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) DropSchemaTemplate ¶
func (f *RecordLayerMetadataOperationsFactory) DropSchemaTemplate(templateID string, throwIfDoesNotExist bool, _ api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) SaveSchemaTemplate ¶
func (f *RecordLayerMetadataOperationsFactory) SaveSchemaTemplate(template api.SchemaTemplate, _ api.Options) apiddl.ConstantAction
func (*RecordLayerMetadataOperationsFactory) SetStoreState ¶
func (f *RecordLayerMetadataOperationsFactory) SetStoreState(dbPath, schemaName string, config RecordLayerConfig) apiddl.ConstantAction
SetStoreState forces a schema store's index states, Java's getSetStoreStateConstantAction (with the config Java's factory carries passed here instead).
type SaveSchemaTemplateConstantAction ¶
type SaveSchemaTemplateConstantAction struct {
// contains filtered or unexported fields
}
SaveSchemaTemplateConstantAction persists a schema template. Mirrors Java's SaveSchemaTemplateConstantAction (api/ddl package), which calls the catalog's createTemplate and nothing else. Go's CreateTemplate also refuses a version at or below the latest stored one, runs the relational evolution validator against it, and carries the stored numbering into a new version (DIVERGENCES.md "CreateTemplate refuses more than an exact duplicate, and carries a new version"); every build-path writer gets those checks there.
func NewSaveSchemaTemplateConstantAction ¶
func NewSaveSchemaTemplateConstantAction(template api.SchemaTemplate, catalog api.SchemaTemplateCatalog) *SaveSchemaTemplateConstantAction
func (*SaveSchemaTemplateConstantAction) Execute ¶
func (a *SaveSchemaTemplateConstantAction) Execute(txn api.Transaction) error
type SetStoreStateConstantAction ¶
type SetStoreStateConstantAction struct {
// contains filtered or unexported fields
}
SetStoreStateConstantAction opens a schema's existing record store and forces its index states. Mirrors Java's RecordLayerSetStoreStateConstantAction, which only the yaml tests' `set schema state` command reaches.
func NewSetStoreStateConstantAction ¶
func NewSetStoreStateConstantAction(dbPath, schemaName string, config RecordLayerConfig, cat api.StoreCatalog, ks *keyspace.RelationalKeyspace) *SetStoreStateConstantAction
NewSetStoreStateConstantAction builds the action; ks must be non-nil.
func (*SetStoreStateConstantAction) Execute ¶
func (a *SetStoreStateConstantAction) Execute(txn api.Transaction) error
Execute opens the store (it must exist) with the schema's catalog metadata at the configured format version, which only ever raises a store's version, and marks each index into its configured state, as Java's action does. Java's action rethrows RecordStoreAlreadyExistsException as SCHEMA_ALREADY_EXISTS; an open of an existing store cannot raise it, so Go has no such arm. A record-layer error is returned unchanged; the connection translates it at the driver boundary, as Java's ExceptionUtil.toRelationalException does here.