Documentation
¶
Overview ¶
Package storage provides the storage engine for XxSql.
Index ¶
- func ParseColumnDefs(defs []struct{ ... }) []*types.ColumnInfo
- func ValidateValues(columns []*types.ColumnInfo, values []types.Value) error
- type Engine
- func (e *Engine) BeginTransaction() error
- func (e *Engine) ClearTempTables()
- func (e *Engine) Close() error
- func (e *Engine) CommitTransaction() error
- func (e *Engine) CreateIndex(tableName, indexName string, columns []string, unique bool) error
- func (e *Engine) CreateSavepoint(name string) error
- func (e *Engine) CreateTable(name string, columns []*types.ColumnInfo) error
- func (e *Engine) CreateTempTable(name string, columns []*types.ColumnInfo) error
- func (e *Engine) CreateTrigger(name string, timing, event int, tableName string, granularity int, ...) error
- func (e *Engine) CreateView(name, query string, columns []string, checkOption string) error
- func (e *Engine) DropIndex(tableName, indexName string) error
- func (e *Engine) DropTable(name string) error
- func (e *Engine) DropTableOrTemp(name string) error
- func (e *Engine) DropTempTable(name string) error
- func (e *Engine) DropTrigger(name string) error
- func (e *Engine) DropView(name string) error
- func (e *Engine) EstimateSelectivity(tableName, indexName string) int
- func (e *Engine) Flush() error
- func (e *Engine) GetCatalog() *catalog.Catalog
- func (e *Engine) GetDataDir() string
- func (e *Engine) GetFTSManager() *fts.FTSManager
- func (e *Engine) GetIndexForColumn(tableName, columnName string) (string, bool)
- func (e *Engine) GetIndexForColumns(tableName string, columns []string) (string, bool, int)
- func (e *Engine) GetRowsByRowIDs(tableName string, rowIDs []row.RowID) (map[row.RowID]*row.Row, error)
- func (e *Engine) GetTable(name string) (*table.Table, error)
- func (e *Engine) GetTableOrTemp(name string) (*table.Table, bool, error)
- func (e *Engine) GetTempTable(name string) (*table.Table, error)
- func (e *Engine) GetTrigger(name string) (*catalog.TriggerInfo, error)
- func (e *Engine) GetTriggersForTable(tableName string, event int) []*catalog.TriggerInfo
- func (e *Engine) GetView(name string) (*catalog.ViewInfo, error)
- func (e *Engine) IndexPointLookup(tableName, indexName string, value types.Value) ([]row.RowID, error)
- func (e *Engine) IndexRangeScan(tableName, indexName string, startValue, endValue types.Value, ...) ([]row.RowID, error)
- func (e *Engine) Insert(tableName string, values []types.Value) (row.RowID, error)
- func (e *Engine) ListTables() []string
- func (e *Engine) ListTempTables() []string
- func (e *Engine) ListTriggers() []string
- func (e *Engine) ListViews() []string
- func (e *Engine) Open() error
- func (e *Engine) ReleaseSavepoint(name string) error
- func (e *Engine) RenameTable(oldName, newName string) error
- func (e *Engine) ResetToInitialState(dataDir string) map[string]interface{}
- func (e *Engine) RollbackToSavepoint(name string) error
- func (e *Engine) RollbackTransaction() error
- func (e *Engine) Scan(tableName string) ([]*row.Row, error)
- func (e *Engine) Stats() *Stats
- func (e *Engine) TableExists(name string) bool
- func (e *Engine) TableOrTempExists(name string) bool
- func (e *Engine) TempTableExists(name string) bool
- func (e *Engine) TriggerExists(name string) bool
- func (e *Engine) ViewExists(name string) bool
- type Stats
- type TableStats
- type TransactionState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseColumnDefs ¶
func ParseColumnDefs(defs []struct {
Name string
Type string
Size int
Nullable bool
Default interface{}
Primary bool
AutoIncr bool
}) []*types.ColumnInfo
ParseColumnDefs parses SQL column definitions to storage types.
func ValidateValues ¶
func ValidateValues(columns []*types.ColumnInfo, values []types.Value) error
ValidateValues validates values against column definitions.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine represents the storage engine.
func (*Engine) BeginTransaction ¶ added in v0.0.5
BeginTransaction starts a new transaction. For this implementation, we track transaction state in memory. Full rollback support would require WAL replay.
func (*Engine) ClearTempTables ¶ added in v0.0.5
func (e *Engine) ClearTempTables()
ClearTempTables clears all temporary tables. Called when session ends.
func (*Engine) CommitTransaction ¶ added in v0.0.5
CommitTransaction commits the current transaction.
func (*Engine) CreateIndex ¶
CreateIndex creates an index on a table.
func (*Engine) CreateSavepoint ¶ added in v0.0.5
CreateSavepoint creates a savepoint within the current transaction.
func (*Engine) CreateTable ¶
func (e *Engine) CreateTable(name string, columns []*types.ColumnInfo) error
CreateTable creates a new table.
func (*Engine) CreateTempTable ¶ added in v0.0.5
func (e *Engine) CreateTempTable(name string, columns []*types.ColumnInfo) error
CreateTempTable creates a temporary table. Temp tables are session-scoped and not persisted to disk. A temp table can shadow a regular table with the same name.
func (*Engine) CreateTrigger ¶ added in v0.0.5
func (e *Engine) CreateTrigger(name string, timing, event int, tableName string, granularity int, whenClause, body string) error
CreateTrigger creates a new trigger.
func (*Engine) CreateView ¶ added in v0.0.5
CreateView creates a new view.
func (*Engine) DropTableOrTemp ¶ added in v0.0.5
DropTableOrTemp drops a table (regular or temp).
func (*Engine) DropTempTable ¶ added in v0.0.5
DropTempTable drops a temporary table.
func (*Engine) DropTrigger ¶ added in v0.0.5
DropTrigger drops a trigger.
func (*Engine) EstimateSelectivity ¶ added in v0.0.5
EstimateSelectivity estimates the selectivity of an index scan.
func (*Engine) GetCatalog ¶
GetCatalog returns the catalog.
func (*Engine) GetDataDir ¶
GetDataDir returns the data directory path.
func (*Engine) GetFTSManager ¶ added in v0.0.5
func (e *Engine) GetFTSManager() *fts.FTSManager
GetFTSManager returns the FTS manager.
func (*Engine) GetIndexForColumn ¶ added in v0.0.5
GetIndexForColumn returns the best index for a column.
func (*Engine) GetIndexForColumns ¶ added in v0.0.5
GetIndexForColumns returns the best index for multiple columns.
func (*Engine) GetRowsByRowIDs ¶ added in v0.0.5
func (e *Engine) GetRowsByRowIDs(tableName string, rowIDs []row.RowID) (map[row.RowID]*row.Row, error)
GetRowsByRowIDs fetches rows by their row IDs.
func (*Engine) GetTableOrTemp ¶ added in v0.0.5
GetTableOrTemp returns a table by name, checking both regular and temp tables. Temp tables have priority over regular tables with the same name.
func (*Engine) GetTempTable ¶ added in v0.0.5
GetTempTable returns a temporary table by name.
func (*Engine) GetTrigger ¶ added in v0.0.5
func (e *Engine) GetTrigger(name string) (*catalog.TriggerInfo, error)
GetTrigger returns a trigger by name.
func (*Engine) GetTriggersForTable ¶ added in v0.0.5
func (e *Engine) GetTriggersForTable(tableName string, event int) []*catalog.TriggerInfo
GetTriggersForTable returns all triggers for a specific table and event.
func (*Engine) IndexPointLookup ¶ added in v0.0.5
func (e *Engine) IndexPointLookup(tableName, indexName string, value types.Value) ([]row.RowID, error)
IndexPointLookup performs an index point lookup.
func (*Engine) IndexRangeScan ¶ added in v0.0.5
func (e *Engine) IndexRangeScan(tableName, indexName string, startValue, endValue types.Value, includeStart, includeEnd bool) ([]row.RowID, error)
IndexRangeScan performs an index range scan.
func (*Engine) ListTables ¶
ListTables returns all table names.
func (*Engine) ListTempTables ¶ added in v0.0.5
ListTempTables returns all temporary table names.
func (*Engine) ListTriggers ¶ added in v0.0.5
ListTriggers returns all trigger names.
func (*Engine) ReleaseSavepoint ¶ added in v0.0.5
ReleaseSavepoint releases a savepoint within the current transaction.
func (*Engine) RenameTable ¶
RenameTable renames a table.
func (*Engine) ResetToInitialState ¶ added in v0.0.7
ResetToInitialState resets the server to its initial state. It drops all user tables (keeping _sys_ms, _sys_projects), clears _sys_projects, and deletes all files in the projects/ directory. Returns a map with details about what was reset.
func (*Engine) RollbackToSavepoint ¶ added in v0.0.5
RollbackToSavepoint rolls back to a savepoint within the current transaction. Note: This is a simplified implementation. Full savepoint rollback would require tracking changes since the savepoint and undoing them.
func (*Engine) RollbackTransaction ¶ added in v0.0.5
RollbackTransaction rolls back the current transaction. Note: This is a simplified implementation. Full rollback would require WAL replay to restore the state before the transaction started.
func (*Engine) TableExists ¶
TableExists checks if a table exists.
func (*Engine) TableOrTempExists ¶ added in v0.0.5
TableOrTempExists checks if a table exists (regular or temp).
func (*Engine) TempTableExists ¶ added in v0.0.5
TempTableExists checks if a temporary table exists.
func (*Engine) TriggerExists ¶ added in v0.0.5
TriggerExists checks if a trigger exists.
func (*Engine) ViewExists ¶ added in v0.0.5
ViewExists checks if a view exists.
type Stats ¶
type Stats struct {
TableCount int `json:"table_count"`
Tables []TableStats `json:"tables"`
}
Stats represents storage engine statistics.
type TableStats ¶
type TableStats struct {
Name string `json:"name"`
RowCount uint64 `json:"row_count"`
PageCount int `json:"page_count"`
}
TableStats represents table statistics.
type TransactionState ¶ added in v0.0.5
TransactionState tracks the state of a transaction
Directories
¶
| Path | Synopsis |
|---|---|
|
Package btree provides B+ tree index implementation for XxSql.
|
Package btree provides B+ tree index implementation for XxSql. |
|
Package buffer provides buffer pool management for XxSql storage engine.
|
Package buffer provides buffer pool management for XxSql storage engine. |
|
Package catalog provides catalog management for XxSql storage engine.
|
Package catalog provides catalog management for XxSql storage engine. |
|
Package checkpoint provides checkpoint management for XxSql storage engine.
|
Package checkpoint provides checkpoint management for XxSql storage engine. |
|
Package fts provides full-text search functionality for XxSQL.
|
Package fts provides full-text search functionality for XxSQL. |
|
Package lock provides deadlock detection for XxSql storage engine.
|
Package lock provides deadlock detection for XxSql storage engine. |
|
Package page provides page management for XxSql storage engine.
|
Package page provides page management for XxSql storage engine. |
|
Package recovery provides crash recovery for XxSql storage engine.
|
Package recovery provides crash recovery for XxSql storage engine. |
|
Package row provides row serialization for XxSql storage engine.
|
Package row provides row serialization for XxSql storage engine. |
|
Package sequence provides atomic sequence counters for XxSql.
|
Package sequence provides atomic sequence counters for XxSql. |
|
Package table provides table management for XxSql storage engine.
|
Package table provides table management for XxSql storage engine. |
|
Package types provides data type definitions for XxSql storage engine.
|
Package types provides data type definitions for XxSql storage engine. |
|
Package wal provides Write-Ahead Logging for XxSql storage engine.
|
Package wal provides Write-Ahead Logging for XxSql storage engine. |