ddl

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
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

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

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

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

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

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 (*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 (*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

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

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.

Jump to

Keyboard shortcuts

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