metadata

package
v0.0.0-...-976bbae Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IndexCatalogTableName = "sdb_indexes"

	IcatIndexTypeField = "indextype"
	IcatIndexNameField = "indexname"
	IcatTableNameField = "tablename"
	IcatFieldNameField = "fieldname"
)
View Source
const (
	MaxTableNameLength = 32

	TableCatalogTableName = "sdb_tables"

	TcatTableNameField = "tblname"
	TcatSlotsizeField  = "slotsize"

	FcatTableNameField = "tblname"
	FcatFieldNameField = "fldname"
	FcatTypeField      = "type"
	FcatLengthField    = "length"
	FcatOffsetField    = "offset"
)
View Source
const (
	MaxViewNameLength = MaxTableNameLength
	MaxViewsDefLength = 200

	VcatViewNameField = "viewname"
	VcatViewDefField  = "viewdef"
)
View Source
const RefreshStatCalls = 100

Variables

View Source
var (
	ErrMetadata               = errors.New("metadata error")
	ErrTablesMetadata         = errors.Wrap(ErrMetadata, "tables error")
	ErrFailedToCreateTable    = errors.Wrap(ErrMetadata, "failed to create table")
	ErrTableNotFound          = errors.Wrap(ErrTablesMetadata, "table not found")
	ErrTableExists            = errors.Wrap(ErrTablesMetadata, "table already exists")
	ErrTableSchemaNotFound    = errors.Wrap(ErrTablesMetadata, "table schema not found")
	ErrViewsMetadata          = errors.Wrap(ErrMetadata, "views error")
	ErrViewNotFound           = errors.Wrap(ErrViewsMetadata, "view not found")
	ErrViewExists             = errors.Wrap(ErrViewsMetadata, "view already exists")
	ErrStatsMetadata          = errors.Wrap(ErrMetadata, "stats error")
	ErrsStatsUnknownFieldType = errors.Wrap(ErrStatsMetadata, "unknown field type")
	ErrIndexesMetadata        = errors.Wrap(ErrMetadata, "indexes error")
	ErrIndexExists            = errors.Wrap(ErrIndexesMetadata, "index already exists")
	ErrFieldIndexed           = errors.Wrap(ErrIndexesMetadata, "field already indexed")
	ErrFailedToOpenIndex      = errors.Wrap(ErrIndexesMetadata, "failed to open index")
)

Functions

This section is empty.

Types

type IndexInfo

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

func NewIndexInfo

func NewIndexInfo(idxName string, tableName string, idxType indexes.IndexType, fieldName string, schema records.Schema, trx scan.TRXInt, si StatInfo) *IndexInfo

func (*IndexInfo) BlocksAccessed

func (ii *IndexInfo) BlocksAccessed() int64

func (*IndexInfo) DistinctValues

func (ii *IndexInfo) DistinctValues(fieldName string) int64

func (*IndexInfo) Open

func (ii *IndexInfo) Open() (indexes.Index, error)

func (*IndexInfo) Records

func (ii *IndexInfo) Records() int64

func (*IndexInfo) String

func (ii *IndexInfo) String() string

type Indexes

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

func NewIndexes

func NewIndexes(tables *Tables, isNew bool, stats *Stats, trx scan.TRXInt) (*Indexes, error)

func (*Indexes) CreateIndex

func (i *Indexes) CreateIndex(idxName string, tableName string, idxType indexes.IndexType, fieldName string, trx scan.TRXInt) error

func (*Indexes) NewIndexCatalogTableScan

func (i *Indexes) NewIndexCatalogTableScan(trx scan.TRXInt) (*scan.TableScan, error)

func (*Indexes) TableIndexes

func (i *Indexes) TableIndexes(tableName string, trx scan.TRXInt) (IndexesMap, error)

type IndexesMap

type IndexesMap map[string]*IndexInfo

type Manager

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

func NewManager

func NewManager(isNew bool, trx scan.TRXInt) (*Manager, error)

func (*Manager) CreateIndex

func (m *Manager) CreateIndex(idxName string, tableName string, idxType indexes.IndexType, fieldName string, trx scan.TRXInt) error

func (*Manager) CreateTable

func (m *Manager) CreateTable(tableName string, schema records.Schema, trx scan.TRXInt) error

func (*Manager) CreateView

func (m *Manager) CreateView(viewName string, viewDef string, trx scan.TRXInt) error

func (*Manager) ForEachTables

func (m *Manager) ForEachTables(trx scan.TRXInt, call func(tableName string) (stop bool, err error)) error

func (*Manager) GetStatInfo

func (m *Manager) GetStatInfo(tableName string, layout records.Layout, trx scan.TRXInt) (StatInfo, error)

func (*Manager) Layout

func (m *Manager) Layout(tableName string, trx scan.TRXInt) (records.Layout, error)

func (*Manager) TableIndexes

func (m *Manager) TableIndexes(tableName string, trx scan.TRXInt) (IndexesMap, error)

func (*Manager) ViewDef

func (m *Manager) ViewDef(viewName string, trx scan.TRXInt) (string, error)

type StatInfo

type StatInfo struct {
	Blocks  int64
	Records int64
	// contains filtered or unexported fields
}

func NewStatInfo

func NewStatInfo(schema records.Schema) StatInfo

func (StatInfo) DistinctValues

func (si StatInfo) DistinctValues(fieldName string) (int64, bool)

func (StatInfo) String

func (si StatInfo) String() string

func (*StatInfo) UpdateDistincValues

func (si *StatInfo) UpdateDistincValues(fieldName string, value []byte)

type Stats

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

func NewStats

func NewStats(tables *Tables, trx scan.TRXInt) (*Stats, error)

func (*Stats) GetStatInfo

func (s *Stats) GetStatInfo(tableName string, layout records.Layout, trx scan.TRXInt) (StatInfo, error)

func (*Stats) HasStatInfo

func (s *Stats) HasStatInfo(tableName string) bool

type Tables

type Tables struct {
	TcatTable string
	FcatTable string

	TcatLayout records.Layout
	FcatLayout records.Layout
}

func NewTables

func NewTables(isNew bool, trx scan.TRXInt) (*Tables, error)

func (*Tables) CreateTable

func (t *Tables) CreateTable(tableName string, schema records.Schema, trx scan.TRXInt) error

func (*Tables) ForEachTables

func (t *Tables) ForEachTables(trx scan.TRXInt, call func(tableName string) (stop bool, err error)) error

func (*Tables) Layout

func (t *Tables) Layout(tableName string, trx scan.TRXInt) (records.Layout, error)

func (*Tables) NewCatalogTableScan

func (t *Tables) NewCatalogTableScan(trx scan.TRXInt) (*scan.TableScan, *scan.TableScan, error)

func (*Tables) NewFieldsCatalogTableScan

func (t *Tables) NewFieldsCatalogTableScan(trx scan.TRXInt) (*scan.TableScan, error)

func (*Tables) NewTableCatalogTableScan

func (t *Tables) NewTableCatalogTableScan(trx scan.TRXInt) (*scan.TableScan, error)

func (*Tables) TableExists

func (t *Tables) TableExists(tableName string, trx scan.TRXInt) (stop bool, err error)

type TablesManager

type TablesManager interface {
	CreateTable(tableName string, schema records.Schema, trx scan.TRXInt) error
	Layout(tableName string, trx scan.TRXInt) (records.Layout, error)
}

type Views

type Views struct {
	VcatTableName string
	VcatLayout    records.Layout
	// contains filtered or unexported fields
}

func NewViews

func NewViews(tables TablesManager, isNew bool, trx scan.TRXInt) (*Views, error)

func (*Views) CreateView

func (v *Views) CreateView(viewName string, viewDef string, trx scan.TRXInt) error

func (*Views) ViewDef

func (v *Views) ViewDef(viewName string, trx scan.TRXInt) (string, error)

func (*Views) ViewExists

func (v *Views) ViewExists(viewName string, trx scan.TRXInt) (stop bool, err error)

Jump to

Keyboard shortcuts

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