catalog

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SnapshotAttr_SegID           = "segment_id"
	SnapshotAttr_TID             = "table_id"
	SnapshotAttr_DBID            = "db_id"
	SegmentAttr_ID               = "id"
	SegmentAttr_CreateAt         = "create_at"
	SegmentAttr_State            = "state"
	SnapshotAttr_BlockMaxRow     = "block_max_row"
	SnapshotAttr_SegmentMaxBlock = "segment_max_block"
)

+--------+---------+----------+----------+------------+ | ID | Name | CreateAt | DeleteAt | CommitInfo | +--------+---------+----------+----------+------------+ |(uint64)|(varchar)| (uint64) | (uint64) | (varchar) | +--------+---------+----------+----------+------------+

View Source
const (
	CmdUpdateDatabase = int16(256) + iota
	CmdUpdateTable
	CmdUpdateSegment
	CmdUpdateBlock
)
View Source
const (
	PhyAddrColumnName    = catalog.Row_ID
	PhyAddrColumnComment = "Physical address"
	SortKeyNamePrefx     = "_SORT_"

	AttrRowID    = PhyAddrColumnName
	AttrCommitTs = "commit_time"
	AttrAborted  = "aborted"

	TenantSysID              = uint32(0)
	SystemSegment_DB_ID      = uint64(101)
	SystemSegment_Table_ID   = uint64(102)
	SystemSegment_Columns_ID = uint64(103)
	SystemBlock_DB_ID        = uint64(201)
	SystemBlock_Table_ID     = uint64(202)
	SystemBlock_Columns_ID   = uint64(203)
)
View Source
const (
	ModelSchemaName   = "_ModelSchema"
	ModelAttrET       = "ET"
	ModelAttrID       = "ID"
	ModelAttrName     = "NAME"
	ModelAttrTS       = "TS"
	ModelAttrOpT      = "OPT"
	ModelAttrLogIdx   = "LOGIDX"
	ModelAttrInfo     = "INFO"
	ModelAttrParentID = "PARENTID"
)

Variables

View Source
var (
	PhyAddrColumnType types.Type
)

Functions

func ActiveWithNoTxnFilter

func ActiveWithNoTxnFilter(be *MetaBaseEntry) bool

func AppendableBlkFilter

func AppendableBlkFilter(be *BlockEntry) bool

func CmdName

func CmdName(t int16) string

func CompareDBBaseNode added in v0.6.0

func CompareDBBaseNode(e, o txnif.MVCCNode) int

func CompareMetaBaseNode added in v0.6.0

func CompareMetaBaseNode(e, o txnif.MVCCNode) int

func CompareTableBaseNode added in v0.6.0

func CompareTableBaseNode(e, o txnif.MVCCNode) int

func CompareUint64

func CompareUint64(left, right uint64) int

func GetAttrIdx

func GetAttrIdx(attrs []string, name string) int

func MarshalDefault

func MarshalDefault(w *bytes.Buffer, data Default) (err error)

func MarshalOnUpdate added in v0.6.0

func MarshalOnUpdate(w *bytes.Buffer, data OnUpdate) (err error)

func MockBatch

func MockBatch(schema *Schema, rows int) *containers.Batch

func MockTxnFactory

func MockTxnFactory(catalog *Catalog) txnbase.TxnFactory

func MockTxnStoreFactory

func MockTxnStoreFactory(catalog *Catalog) txnbase.TxnStoreFactory

func NewEmptyDBMVCCNode added in v0.6.0

func NewEmptyDBMVCCNode() txnif.MVCCNode

func NewEmptyMetadataMVCCNode added in v0.6.0

func NewEmptyMetadataMVCCNode() txnif.MVCCNode

func NewEmptyTableMVCCNode added in v0.6.0

func NewEmptyTableMVCCNode() txnif.MVCCNode

func NonAppendableBlkFilter

func NonAppendableBlkFilter(be *BlockEntry) bool

func UnMarshalDefault

func UnMarshalDefault(r io.Reader, data *Default) (n int64, err error)

func UnMarshalOnUpdate added in v0.6.0

func UnMarshalOnUpdate(r io.Reader, data *OnUpdate) (n int64, err error)

Types

type BaseEntry

type BaseEntry interface {
	RLock()
	RUnlock()

	String() string
	StringLocked() string
	PPString(common.PPLevel, int, string) string

	GetTxn() txnif.TxnReader
	GetID() uint64
	GetIndexes() []*wal.Index
	GetLogIndex() *wal.Index

	GetLatestNodeLocked() txnif.MVCCNode
	IsVisible(ts types.TS, mu *sync.RWMutex) (ok bool, err error)

	HasCommittedNodeInRange(minTs, MaxTs types.TS) bool
	IsCreatingOrAborted() bool
	IsCommitting() bool
	DeleteBefore(ts types.TS) bool
	HasDropCommitted() bool
	HasDropCommittedLocked() bool

	WriteOneNodeTo(w io.Writer) (n int64, err error)
	ReadOneNodeFrom(r io.Reader) (n int64, err error)
	CloneCommittedInRange(start, end types.TS) (ret BaseEntry)

	PrepareCommit() error
	PrepareRollback() (bool, error)
	ApplyCommit(index *wal.Index) error
	ApplyRollback(index *wal.Index) error
}

JXM TODO: Generic BaseEntry can't work in go 1.19 because of compiler bug: https://github.com/golang/go/issues/54671 Refactor catalog and use generic BaseEntry after go 1.19.1 release.

type BlockDataFactory

type BlockDataFactory = func(meta *BlockEntry) data.Block

type BlockEntry

type BlockEntry struct {
	*MetaBaseEntry
	// contains filtered or unexported fields
}

func NewBlockEntry

func NewBlockEntry(segment *SegmentEntry, txn txnif.AsyncTxn, state EntryState, dataFactory BlockDataFactory) *BlockEntry

func NewReplayBlockEntry

func NewReplayBlockEntry() *BlockEntry

func NewStandaloneBlock

func NewStandaloneBlock(segment *SegmentEntry, id uint64, ts types.TS) *BlockEntry

func NewSysBlockEntry

func NewSysBlockEntry(segment *SegmentEntry, id uint64) *BlockEntry

func (*BlockEntry) AsCommonID

func (entry *BlockEntry) AsCommonID() *common.ID

func (*BlockEntry) DestroyData

func (entry *BlockEntry) DestroyData() (err error)

func (*BlockEntry) GetBlockData

func (entry *BlockEntry) GetBlockData() data.Block

func (*BlockEntry) GetCatalog

func (entry *BlockEntry) GetCatalog() *Catalog

func (*BlockEntry) GetSchema

func (entry *BlockEntry) GetSchema() *Schema

func (*BlockEntry) GetSegment

func (entry *BlockEntry) GetSegment() *SegmentEntry

func (*BlockEntry) GetTerminationTS

func (entry *BlockEntry) GetTerminationTS() (ts types.TS, terminated bool)

GetTerminationTS is coarse API: no consistency check

func (*BlockEntry) InitData

func (entry *BlockEntry) InitData(factory DataFactory)

func (*BlockEntry) Is1PC added in v0.6.0

func (entry *BlockEntry) Is1PC() bool

func (*BlockEntry) IsActive

func (entry *BlockEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*BlockEntry) IsAppendable

func (entry *BlockEntry) IsAppendable() bool

func (*BlockEntry) MakeCommand

func (entry *BlockEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*BlockEntry) MakeKey

func (entry *BlockEntry) MakeKey() []byte

func (*BlockEntry) PPString

func (entry *BlockEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*BlockEntry) PrepareCompact added in v0.6.0

func (entry *BlockEntry) PrepareCompact() bool

PrepareCompact is performance insensitive a block can be compacted: 1. no uncommited node 2. at least one committed node 3. not compacted

func (*BlockEntry) PrepareRollback

func (entry *BlockEntry) PrepareRollback() (err error)

func (*BlockEntry) ReadFrom

func (entry *BlockEntry) ReadFrom(r io.Reader) (n int64, err error)

func (*BlockEntry) Repr

func (entry *BlockEntry) Repr() string

func (*BlockEntry) Set1PC added in v0.6.0

func (entry *BlockEntry) Set1PC()

func (*BlockEntry) String

func (entry *BlockEntry) String() string

func (*BlockEntry) StringLocked

func (entry *BlockEntry) StringLocked() string

func (*BlockEntry) StringWithLevel added in v0.6.0

func (entry *BlockEntry) StringWithLevel(level common.PPLevel) string

func (*BlockEntry) StringWithLevelLocked added in v0.6.0

func (entry *BlockEntry) StringWithLevelLocked(level common.PPLevel) string

func (*BlockEntry) WriteTo

func (entry *BlockEntry) WriteTo(w io.Writer) (n int64, err error)

type Catalog

type Catalog struct {
	*IDAlloctor
	*sync.RWMutex
	// contains filtered or unexported fields
}

func MockCatalog

func MockCatalog(scheduler tasks.TaskScheduler) *Catalog

func NewEmptyCatalog added in v0.6.0

func NewEmptyCatalog() *Catalog

func OpenCatalog

func OpenCatalog(scheduler tasks.TaskScheduler, dataFactory DataFactory) (*Catalog, error)

func (*Catalog) AddColumnCnt

func (catalog *Catalog) AddColumnCnt(cnt int)

func (*Catalog) AddEntryLocked

func (catalog *Catalog) AddEntryLocked(database *DBEntry, txn txnif.TxnReader, skipDedup bool) error

func (*Catalog) AddTableCnt

func (catalog *Catalog) AddTableCnt(cnt int)

func (*Catalog) Close

func (catalog *Catalog) Close() error

func (*Catalog) CoarseColumnCnt

func (catalog *Catalog) CoarseColumnCnt() int

func (*Catalog) CoarseDBCnt

func (catalog *Catalog) CoarseDBCnt() int

func (*Catalog) CoarseTableCnt

func (catalog *Catalog) CoarseTableCnt() int

func (*Catalog) CreateDBEntry

func (catalog *Catalog) CreateDBEntry(name, createSql string, txn txnif.AsyncTxn) (*DBEntry, error)

func (*Catalog) CreateDBEntryByTS added in v0.6.0

func (catalog *Catalog) CreateDBEntryByTS(name string, ts types.TS) (*DBEntry, error)

func (*Catalog) CreateDBEntryWithID added in v0.6.0

func (catalog *Catalog) CreateDBEntryWithID(name, createSql string, id uint64, txn txnif.AsyncTxn) (*DBEntry, error)

func (*Catalog) DropDBEntry

func (catalog *Catalog) DropDBEntry(
	name string,
	txn txnif.AsyncTxn) (newEntry bool, deleted *DBEntry, err error)

func (*Catalog) DropDBEntryByID added in v0.6.0

func (catalog *Catalog) DropDBEntryByID(id uint64, txn txnif.AsyncTxn) (newEntry bool, deleted *DBEntry, err error)

func (*Catalog) GetDBEntryByName added in v0.6.0

func (catalog *Catalog) GetDBEntryByName(
	tenantID uint32,
	name string,
	ts types.TS) (db *DBEntry, err error)

func (*Catalog) GetDatabaseByID

func (catalog *Catalog) GetDatabaseByID(id uint64) (db *DBEntry, err error)

func (*Catalog) GetItemNodeByIDLocked added in v0.6.0

func (catalog *Catalog) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*DBEntry]

func (*Catalog) GetScheduler

func (catalog *Catalog) GetScheduler() tasks.TaskScheduler

func (*Catalog) InitSystemDB

func (catalog *Catalog) InitSystemDB()

func (*Catalog) MakeDBIt

func (catalog *Catalog) MakeDBIt(reverse bool) *common.GenericSortedDListIt[*DBEntry]

func (*Catalog) OnReplayBlockBatch added in v0.6.0

func (catalog *Catalog) OnReplayBlockBatch(ins, insTxn, del, delTxn *containers.Batch, dataFactory DataFactory)

func (*Catalog) OnReplayDatabaseBatch added in v0.6.0

func (catalog *Catalog) OnReplayDatabaseBatch(ins, insTxn, del, delTxn *containers.Batch)

func (*Catalog) OnReplaySegmentBatch added in v0.6.0

func (catalog *Catalog) OnReplaySegmentBatch(ins, insTxn, del, delTxn *containers.Batch, dataFactory DataFactory)

func (*Catalog) OnReplayTableBatch added in v0.6.0

func (catalog *Catalog) OnReplayTableBatch(ins, insTxn, insCol, del, delTxn *containers.Batch, dataFactory DataFactory)

func (*Catalog) PPString

func (catalog *Catalog) PPString(level common.PPLevel, depth int, prefix string) string

func (*Catalog) RecurLoop

func (catalog *Catalog) RecurLoop(processor Processor) (err error)

func (*Catalog) RemoveEntry

func (catalog *Catalog) RemoveEntry(database *DBEntry) error

func (*Catalog) ReplayCmd

func (catalog *Catalog) ReplayCmd(
	txncmd txnif.TxnCmd,
	dataFactory DataFactory,
	idxCtx *wal.Index,
	observer wal.ReplayObserver)

func (*Catalog) ReplayTableRows

func (catalog *Catalog) ReplayTableRows()

func (*Catalog) SimplePPString

func (catalog *Catalog) SimplePPString(level common.PPLevel) string

func (*Catalog) TxnGetDBEntryByID added in v0.6.0

func (catalog *Catalog) TxnGetDBEntryByID(id uint64, txn txnif.AsyncTxn) (*DBEntry, error)

func (*Catalog) TxnGetDBEntryByName added in v0.6.0

func (catalog *Catalog) TxnGetDBEntryByName(name string, txn txnif.AsyncTxn) (*DBEntry, error)

type ColDef

type ColDef struct {
	Name          string
	Idx           int // indicates its position in all coldefs
	Type          types.Type
	Hidden        bool // Hidden Column is generated by compute layer, keep hidden from user
	PhyAddr       bool // PhyAddr Column is generated by tae as rowid
	NullAbility   bool
	AutoIncrement bool
	Primary       bool
	SortIdx       int8 // indicates its position in all sort keys
	SortKey       bool
	Comment       string
	Default       Default
	OnUpdate      OnUpdate
}

func (*ColDef) GetName

func (def *ColDef) GetName() string

func (*ColDef) GetType

func (def *ColDef) GetType() types.Type

func (*ColDef) IsAutoIncrement added in v0.6.0

func (def *ColDef) IsAutoIncrement() bool

func (*ColDef) IsHidden

func (def *ColDef) IsHidden() bool

func (*ColDef) IsPhyAddr added in v0.6.0

func (def *ColDef) IsPhyAddr() bool

func (*ColDef) IsPrimary

func (def *ColDef) IsPrimary() bool

func (*ColDef) IsSortKey

func (def *ColDef) IsSortKey() bool

func (*ColDef) Nullable

func (def *ColDef) Nullable() bool

type ComposedFilter

type ComposedFilter struct {
	CommitFilters []func(*MetaBaseEntry) bool
	BlockFilters  []func(*BlockEntry) bool
}

func NewComposedFilter

func NewComposedFilter() *ComposedFilter

func (*ComposedFilter) AddBlockFilter

func (filter *ComposedFilter) AddBlockFilter(f func(*BlockEntry) bool)

func (*ComposedFilter) AddCommitFilter

func (filter *ComposedFilter) AddCommitFilter(f func(*MetaBaseEntry) bool)

func (*ComposedFilter) FilteBlock

func (filter *ComposedFilter) FilteBlock(be *BlockEntry) bool

func (*ComposedFilter) FilteCommit

func (filter *ComposedFilter) FilteCommit(be *MetaBaseEntry) bool

type ComputeIndexInfo added in v0.6.0

type ComputeIndexInfo struct {
	Name      string
	TableName string
	Unique    bool
	Field     []string
}

type DBBaseEntry added in v0.6.0

type DBBaseEntry struct {
	*txnbase.MVCCChain
	ID uint64
}

func NewDBBaseEntry added in v0.6.0

func NewDBBaseEntry(id uint64) *DBBaseEntry

func NewReplayDBBaseEntry added in v0.6.0

func NewReplayDBBaseEntry() *DBBaseEntry

func (*DBBaseEntry) CloneCommittedInRange added in v0.6.0

func (be *DBBaseEntry) CloneCommittedInRange(start, end types.TS) BaseEntry

func (*DBBaseEntry) CreateWithTS added in v0.6.0

func (be *DBBaseEntry) CreateWithTS(ts types.TS)

func (*DBBaseEntry) CreateWithTxn added in v0.6.0

func (be *DBBaseEntry) CreateWithTxn(txn txnif.AsyncTxn)

func (*DBBaseEntry) DeleteAfter added in v0.6.0

func (be *DBBaseEntry) DeleteAfter(ts types.TS) bool

func (*DBBaseEntry) DeleteBefore added in v0.6.0

func (be *DBBaseEntry) DeleteBefore(ts types.TS) bool

func (*DBBaseEntry) DeleteLocked added in v0.6.0

func (be *DBBaseEntry) DeleteLocked(txn txnif.TxnReader) (isNewNode bool, err error)

func (*DBBaseEntry) DoCompre added in v0.6.0

func (be *DBBaseEntry) DoCompre(voe BaseEntry) int

func (*DBBaseEntry) DropEntryLocked added in v0.6.0

func (be *DBBaseEntry) DropEntryLocked(txn txnif.TxnReader) (isNewNode bool, err error)

func (*DBBaseEntry) GetCreatedAt added in v0.6.0

func (be *DBBaseEntry) GetCreatedAt() types.TS

func (*DBBaseEntry) GetDeleteAt added in v0.6.0

func (be *DBBaseEntry) GetDeleteAt() types.TS

func (*DBBaseEntry) GetID added in v0.6.0

func (be *DBBaseEntry) GetID() uint64

func (*DBBaseEntry) GetVisibility added in v0.6.0

func (be *DBBaseEntry) GetVisibility(ts types.TS) (visible, dropped bool)

func (*DBBaseEntry) GetVisibilityLocked added in v0.6.0

func (be *DBBaseEntry) GetVisibilityLocked(ts types.TS) (visible, dropped bool)

func (*DBBaseEntry) HasDropCommitted added in v0.6.0

func (be *DBBaseEntry) HasDropCommitted() bool

func (*DBBaseEntry) HasDropCommittedLocked added in v0.6.0

func (be *DBBaseEntry) HasDropCommittedLocked() bool

func (*DBBaseEntry) IsVisible added in v0.6.0

func (be *DBBaseEntry) IsVisible(ts types.TS, mu *sync.RWMutex) (ok bool, err error)

func (*DBBaseEntry) NeedWaitCommitting added in v0.6.0

func (be *DBBaseEntry) NeedWaitCommitting(startTS types.TS) (bool, txnif.TxnReader)

func (*DBBaseEntry) PPString added in v0.6.0

func (be *DBBaseEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*DBBaseEntry) PrepareAdd added in v0.6.0

func (be *DBBaseEntry) PrepareAdd(txn txnif.TxnReader) (err error)

func (*DBBaseEntry) ReadAllFrom added in v0.6.0

func (be *DBBaseEntry) ReadAllFrom(r io.Reader) (n int64, err error)

func (*DBBaseEntry) ReadOneNodeFrom added in v0.6.0

func (be *DBBaseEntry) ReadOneNodeFrom(r io.Reader) (n int64, err error)

func (*DBBaseEntry) String added in v0.6.0

func (be *DBBaseEntry) String() string

func (*DBBaseEntry) StringLocked added in v0.6.0

func (be *DBBaseEntry) StringLocked() string

func (*DBBaseEntry) TryGetTerminatedTS added in v0.6.0

func (be *DBBaseEntry) TryGetTerminatedTS(waitIfcommitting bool) (terminated bool, TS types.TS)

func (*DBBaseEntry) WriteAllTo added in v0.6.0

func (be *DBBaseEntry) WriteAllTo(w io.Writer) (n int64, err error)

func (*DBBaseEntry) WriteOneNodeTo added in v0.6.0

func (be *DBBaseEntry) WriteOneNodeTo(w io.Writer) (n int64, err error)

type DBEntry

type DBEntry struct {
	*DBBaseEntry
	// contains filtered or unexported fields
}

func NewDBEntry

func NewDBEntry(catalog *Catalog, name, createSql string, txn txnif.AsyncTxn) *DBEntry

func NewDBEntryByTS added in v0.6.0

func NewDBEntryByTS(catalog *Catalog, name string, ts types.TS) *DBEntry

func NewDBEntryWithID added in v0.6.0

func NewDBEntryWithID(catalog *Catalog, name string, createSql string, id uint64, txn txnif.AsyncTxn) *DBEntry

func NewReplayDBEntry

func NewReplayDBEntry() *DBEntry

func NewSystemDBEntry

func NewSystemDBEntry(catalog *Catalog) *DBEntry

func (*DBEntry) AddEntryLocked

func (e *DBEntry) AddEntryLocked(table *TableEntry, txn txnif.TxnReader, skipDedup bool) (err error)

Catalog entry is created in following steps: 1. Locate the record. Creating always gets the latest DBEntry. 2.1 If there doesn't exist a DBEntry, add new entry and return. 2.2 If there exists a DBEntry: 2.2.1 Check conflication.

  1. Wait for the related txn if need.
  2. w-w conflict when: there's an active txn; or he CommitTS of the latest related txn is larger than StartTS of write txn

2.2.2 Check duplicate/not found. If the entry hasn't been dropped, return ErrDuplicate.

func (*DBEntry) CoarseTableCnt

func (e *DBEntry) CoarseTableCnt() int

func (*DBEntry) CreateTableEntry

func (e *DBEntry) CreateTableEntry(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory) (created *TableEntry, err error)

func (*DBEntry) CreateTableEntryWithTableId added in v0.6.0

func (e *DBEntry) CreateTableEntryWithTableId(schema *Schema, txn txnif.AsyncTxn, dataFactory TableDataFactory, tableId uint64) (created *TableEntry, err error)

func (*DBEntry) DropTableEntry

func (e *DBEntry) DropTableEntry(name string, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)

Catalog entry is dropped in following steps: 1. Locate the record by timestamp 2. Check conflication. 2.1 Wait for the related txn if need. 2.2 w-w conflict when 1. there's an active txn; or

  1. the CommitTS of the latest related txn is larger than StartTS of write txn

3. Check duplicate/not found. If the entry has already been dropped, return ErrNotFound.

func (*DBEntry) DropTableEntryByID added in v0.6.0

func (e *DBEntry) DropTableEntryByID(id uint64, txn txnif.AsyncTxn) (newEntry bool, deleted *TableEntry, err error)

func (*DBEntry) GetBlockEntryByID

func (e *DBEntry) GetBlockEntryByID(id *common.ID) (blk *BlockEntry, err error)

func (*DBEntry) GetCatalog

func (e *DBEntry) GetCatalog() *Catalog

func (*DBEntry) GetCreateAt added in v0.6.0

func (e *DBEntry) GetCreateAt() types.Timestamp

func (*DBEntry) GetCreateSql added in v0.6.0

func (e *DBEntry) GetCreateSql() string

func (*DBEntry) GetFullName added in v0.6.0

func (e *DBEntry) GetFullName() string

func (*DBEntry) GetItemNodeByIDLocked added in v0.6.0

func (e *DBEntry) GetItemNodeByIDLocked(id uint64) *common.GenericDLNode[*TableEntry]

func (*DBEntry) GetName

func (e *DBEntry) GetName() string

func (*DBEntry) GetRoleID added in v0.6.0

func (e *DBEntry) GetRoleID() uint32

func (*DBEntry) GetTableEntryByID

func (e *DBEntry) GetTableEntryByID(id uint64) (table *TableEntry, err error)

func (*DBEntry) GetTableEntryByName added in v0.6.0

func (e *DBEntry) GetTableEntryByName(
	tenantID uint32,
	name string,
	ts types.TS) (entry *TableEntry, err error)

func (*DBEntry) GetTenantID added in v0.6.0

func (e *DBEntry) GetTenantID() uint32

func (*DBEntry) GetUserID added in v0.6.0

func (e *DBEntry) GetUserID() uint32

func (*DBEntry) Is1PC added in v0.6.0

func (e *DBEntry) Is1PC() bool

func (*DBEntry) IsActive

func (e *DBEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*DBEntry) IsSystemDB

func (e *DBEntry) IsSystemDB() bool

func (*DBEntry) MakeCommand

func (e *DBEntry) MakeCommand(id uint32) (txnif.TxnCmd, error)

func (*DBEntry) MakeTableIt

func (e *DBEntry) MakeTableIt(reverse bool) *common.GenericSortedDListIt[*TableEntry]

func (*DBEntry) PPString

func (e *DBEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*DBEntry) PrepareRollback

func (e *DBEntry) PrepareRollback() (err error)

func (*DBEntry) ReadFrom

func (e *DBEntry) ReadFrom(r io.Reader) (n int64, err error)

func (*DBEntry) RecurLoop

func (e *DBEntry) RecurLoop(processor Processor) (err error)

func (*DBEntry) RemoveEntry

func (e *DBEntry) RemoveEntry(table *TableEntry) (err error)

func (*DBEntry) Set1PC added in v0.6.0

func (e *DBEntry) Set1PC()

func (*DBEntry) String

func (e *DBEntry) String() string

func (*DBEntry) StringLocked

func (e *DBEntry) StringLocked() string

func (*DBEntry) StringWithLevel added in v0.6.0

func (e *DBEntry) StringWithLevel(level common.PPLevel) string

func (*DBEntry) StringWithlevelLocked added in v0.6.0

func (e *DBEntry) StringWithlevelLocked(level common.PPLevel) string

func (*DBEntry) TxnGetTableEntryByID added in v0.6.0

func (e *DBEntry) TxnGetTableEntryByID(id uint64, txn txnif.AsyncTxn) (entry *TableEntry, err error)

func (*DBEntry) TxnGetTableEntryByName added in v0.6.0

func (e *DBEntry) TxnGetTableEntryByName(name string, txn txnif.AsyncTxn) (entry *TableEntry, err error)

func (*DBEntry) WriteTo

func (e *DBEntry) WriteTo(w io.Writer) (n int64, err error)

type DBMVCCNode added in v0.6.0

type DBMVCCNode struct {
	*EntryMVCCNode
	*txnbase.TxnMVCCNode
}

func (*DBMVCCNode) ApplyCommit added in v0.6.0

func (e *DBMVCCNode) ApplyCommit(index *wal.Index) (err error)

func (*DBMVCCNode) ApplyRollback added in v0.6.0

func (e *DBMVCCNode) ApplyRollback(index *wal.Index) (err error)

func (*DBMVCCNode) CloneAll added in v0.6.0

func (e *DBMVCCNode) CloneAll() txnif.MVCCNode

func (*DBMVCCNode) CloneData added in v0.6.0

func (e *DBMVCCNode) CloneData() txnif.MVCCNode

func (*DBMVCCNode) PrepareCommit added in v0.6.0

func (e *DBMVCCNode) PrepareCommit() (err error)

func (*DBMVCCNode) ReadFrom added in v0.6.0

func (e *DBMVCCNode) ReadFrom(r io.Reader) (n int64, err error)

func (*DBMVCCNode) String added in v0.6.0

func (e *DBMVCCNode) String() string

func (*DBMVCCNode) Update added in v0.6.0

func (e *DBMVCCNode) Update(vun txnif.MVCCNode)

for create drop in one txn

func (*DBMVCCNode) WriteTo added in v0.6.0

func (e *DBMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type DataFactory

type DataFactory interface {
	MakeTableFactory() TableDataFactory
	MakeSegmentFactory() SegmentDataFactory
	MakeBlockFactory() BlockDataFactory
}

type Default

type Default struct {
	NullAbility  bool
	Expr         []byte
	OriginString string
}

func (*Default) Marshal added in v0.6.0

func (d *Default) Marshal() ([]byte, error)

func (*Default) Unmarshal added in v0.6.0

func (d *Default) Unmarshal(data []byte) (err error)

type EntryCommand

type EntryCommand struct {
	*txnbase.BaseCustomizedCmd

	DBID      uint64
	TableID   uint64
	SegmentID uint64
	DB        *DBEntry
	Table     *TableEntry
	Segment   *SegmentEntry
	Block     *BlockEntry
	// contains filtered or unexported fields
}

func (*EntryCommand) ApplyCommit added in v0.6.0

func (cmd *EntryCommand) ApplyCommit()

func (*EntryCommand) ApplyRollback added in v0.6.0

func (cmd *EntryCommand) ApplyRollback()

func (*EntryCommand) Desc

func (cmd *EntryCommand) Desc() string

func (*EntryCommand) GetID

func (cmd *EntryCommand) GetID() (uint64, *common.ID)

func (*EntryCommand) GetLogIndex

func (cmd *EntryCommand) GetLogIndex() *wal.Index

func (*EntryCommand) GetTs

func (cmd *EntryCommand) GetTs() types.TS

func (*EntryCommand) GetType

func (cmd *EntryCommand) GetType() int16

func (*EntryCommand) IDString

func (cmd *EntryCommand) IDString() string

func (*EntryCommand) Marshal

func (cmd *EntryCommand) Marshal() (buf []byte, err error)

func (*EntryCommand) ReadFrom

func (cmd *EntryCommand) ReadFrom(r io.Reader) (n int64, err error)

func (*EntryCommand) SetReplayTxn added in v0.6.0

func (cmd *EntryCommand) SetReplayTxn(txn txnif.AsyncTxn)

func (*EntryCommand) String

func (cmd *EntryCommand) String() string

func (*EntryCommand) Unmarshal

func (cmd *EntryCommand) Unmarshal(buf []byte) (err error)

func (*EntryCommand) VerboseString

func (cmd *EntryCommand) VerboseString() string

func (*EntryCommand) WriteTo

func (cmd *EntryCommand) WriteTo(w io.Writer) (n int64, err error)

type EntryMVCCNode added in v0.6.0

type EntryMVCCNode struct {
	CreatedAt, DeletedAt types.TS
}

func (*EntryMVCCNode) ApplyCommit added in v0.6.0

func (un *EntryMVCCNode) ApplyCommit(ts types.TS) (err error)

func (*EntryMVCCNode) Clone added in v0.6.0

func (un *EntryMVCCNode) Clone() *EntryMVCCNode

func (*EntryMVCCNode) CloneData added in v0.6.0

func (un *EntryMVCCNode) CloneData() *EntryMVCCNode

func (*EntryMVCCNode) Delete added in v0.6.0

func (un *EntryMVCCNode) Delete()

func (*EntryMVCCNode) GetCreatedAt added in v0.6.0

func (un *EntryMVCCNode) GetCreatedAt() types.TS

func (*EntryMVCCNode) GetDeletedAt added in v0.6.0

func (un *EntryMVCCNode) GetDeletedAt() types.TS

func (*EntryMVCCNode) HasDropCommitted added in v0.6.0

func (un *EntryMVCCNode) HasDropCommitted() bool

Dropped committed

func (*EntryMVCCNode) HasDropIntent added in v0.6.0

func (un *EntryMVCCNode) HasDropIntent() bool

Dropped committed or uncommitted

func (*EntryMVCCNode) IsCreating added in v0.6.0

func (un *EntryMVCCNode) IsCreating() bool

func (*EntryMVCCNode) PrepareCommit added in v0.6.0

func (un *EntryMVCCNode) PrepareCommit() (err error)

func (*EntryMVCCNode) ReadFrom added in v0.6.0

func (un *EntryMVCCNode) ReadFrom(r io.Reader) (n int64, err error)

func (*EntryMVCCNode) String added in v0.6.0

func (un *EntryMVCCNode) String() string

func (*EntryMVCCNode) WriteTo added in v0.6.0

func (un *EntryMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type EntryState

type EntryState int8
const (
	ES_Appendable EntryState = iota
	ES_NotAppendable
	ES_Frozen
)

func (EntryState) Repr

func (es EntryState) Repr() string

type IDAlloctor

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

func NewIDAllocator

func NewIDAllocator() *IDAlloctor

func (*IDAlloctor) CurrBlock

func (alloc *IDAlloctor) CurrBlock() uint64

func (*IDAlloctor) CurrDB

func (alloc *IDAlloctor) CurrDB() uint64

func (*IDAlloctor) CurrSegment

func (alloc *IDAlloctor) CurrSegment() uint64

func (*IDAlloctor) CurrTable

func (alloc *IDAlloctor) CurrTable() uint64

func (*IDAlloctor) IDStates

func (alloc *IDAlloctor) IDStates() string

func (*IDAlloctor) Init

func (alloc *IDAlloctor) Init(prevDb, prevTbl, prevSeg, prevBlk uint64)

func (*IDAlloctor) NextBlock

func (alloc *IDAlloctor) NextBlock() uint64

func (*IDAlloctor) NextDB

func (alloc *IDAlloctor) NextDB() uint64

func (*IDAlloctor) NextSegment

func (alloc *IDAlloctor) NextSegment() uint64

func (*IDAlloctor) NextTable

func (alloc *IDAlloctor) NextTable() uint64

func (*IDAlloctor) OnReplayBlockID

func (alloc *IDAlloctor) OnReplayBlockID(id uint64)

func (*IDAlloctor) OnReplayDBID

func (alloc *IDAlloctor) OnReplayDBID(id uint64)

func (*IDAlloctor) OnReplaySegmentID

func (alloc *IDAlloctor) OnReplaySegmentID(id uint64)

func (*IDAlloctor) OnReplayTableID

func (alloc *IDAlloctor) OnReplayTableID(id uint64)

type IndexInfo

type IndexInfo struct {
	Id      uint64
	Name    string
	Type    IndexT
	Columns []uint16
}

func NewIndexInfo

func NewIndexInfo(name string, typ IndexT, colIdx ...int) *IndexInfo

type IndexT

type IndexT uint16
const (
	ZoneMap IndexT = iota
)

type LoopProcessor

type LoopProcessor struct {
	DatabaseFn    func(*DBEntry) error
	TableFn       func(*TableEntry) error
	SegmentFn     func(*SegmentEntry) error
	BlockFn       func(*BlockEntry) error
	PostSegmentFn func(*SegmentEntry) error
}

func (*LoopProcessor) OnBlock

func (p *LoopProcessor) OnBlock(block *BlockEntry) error

func (*LoopProcessor) OnDatabase

func (p *LoopProcessor) OnDatabase(database *DBEntry) error

func (*LoopProcessor) OnPostSegment

func (p *LoopProcessor) OnPostSegment(segment *SegmentEntry) error

func (*LoopProcessor) OnSegment

func (p *LoopProcessor) OnSegment(segment *SegmentEntry) error

func (*LoopProcessor) OnTable

func (p *LoopProcessor) OnTable(table *TableEntry) error

type MetaBaseEntry added in v0.6.0

type MetaBaseEntry struct {
	*txnbase.MVCCChain
	ID uint64
}

func NewMetaBaseEntry added in v0.6.0

func NewMetaBaseEntry(id uint64) *MetaBaseEntry

func NewReplayMetaBaseEntry added in v0.6.0

func NewReplayMetaBaseEntry() *MetaBaseEntry

func (*MetaBaseEntry) CloneCommittedInRange added in v0.6.0

func (be *MetaBaseEntry) CloneCommittedInRange(start, end types.TS) BaseEntry

func (*MetaBaseEntry) CreateWithTS added in v0.6.0

func (be *MetaBaseEntry) CreateWithTS(ts types.TS)

func (*MetaBaseEntry) CreateWithTxn added in v0.6.0

func (be *MetaBaseEntry) CreateWithTxn(txn txnif.AsyncTxn)

func (*MetaBaseEntry) DeleteAfter added in v0.6.0

func (be *MetaBaseEntry) DeleteAfter(ts types.TS) bool

func (*MetaBaseEntry) DeleteBefore added in v0.6.0

func (be *MetaBaseEntry) DeleteBefore(ts types.TS) bool

func (*MetaBaseEntry) DeleteLocked added in v0.6.0

func (be *MetaBaseEntry) DeleteLocked(txn txnif.TxnReader) (isNewNode bool, err error)

func (*MetaBaseEntry) DoCompre added in v0.6.0

func (be *MetaBaseEntry) DoCompre(voe BaseEntry) int

func (*MetaBaseEntry) DropEntryLocked added in v0.6.0

func (be *MetaBaseEntry) DropEntryLocked(txn txnif.TxnReader) (isNewNode bool, err error)

func (*MetaBaseEntry) GetCreatedAt added in v0.6.0

func (be *MetaBaseEntry) GetCreatedAt() types.TS

func (*MetaBaseEntry) GetDeleteAt added in v0.6.0

func (be *MetaBaseEntry) GetDeleteAt() types.TS

func (*MetaBaseEntry) GetDeltaLoc added in v0.6.0

func (be *MetaBaseEntry) GetDeltaLoc() string

func (*MetaBaseEntry) GetID added in v0.6.0

func (be *MetaBaseEntry) GetID() uint64

func (*MetaBaseEntry) GetMetaLoc added in v0.6.0

func (be *MetaBaseEntry) GetMetaLoc() string

func (*MetaBaseEntry) GetVisibility added in v0.6.0

func (be *MetaBaseEntry) GetVisibility(ts types.TS) (visible, dropped bool)

func (*MetaBaseEntry) GetVisibilityLocked added in v0.6.0

func (be *MetaBaseEntry) GetVisibilityLocked(ts types.TS) (visible, dropped bool)

func (*MetaBaseEntry) GetVisibleDeltaLoc added in v0.6.0

func (be *MetaBaseEntry) GetVisibleDeltaLoc(ts types.TS) string

func (*MetaBaseEntry) GetVisibleMetaLoc added in v0.6.0

func (be *MetaBaseEntry) GetVisibleMetaLoc(ts types.TS) string

func (*MetaBaseEntry) HasDropCommitted added in v0.6.0

func (be *MetaBaseEntry) HasDropCommitted() bool

func (*MetaBaseEntry) HasDropCommittedLocked added in v0.6.0

func (be *MetaBaseEntry) HasDropCommittedLocked() bool

func (*MetaBaseEntry) HasPersistedData added in v0.6.0

func (be *MetaBaseEntry) HasPersistedData() bool

func (*MetaBaseEntry) HasPersistedDeltaData added in v0.6.0

func (be *MetaBaseEntry) HasPersistedDeltaData() bool

func (*MetaBaseEntry) IsVisible added in v0.6.0

func (be *MetaBaseEntry) IsVisible(ts types.TS, mu *sync.RWMutex) (ok bool, err error)

func (*MetaBaseEntry) NeedWaitCommitting added in v0.6.0

func (be *MetaBaseEntry) NeedWaitCommitting(startTS types.TS) (bool, txnif.TxnReader)

func (*MetaBaseEntry) PPString added in v0.6.0

func (be *MetaBaseEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*MetaBaseEntry) ReadAllFrom added in v0.6.0

func (be *MetaBaseEntry) ReadAllFrom(r io.Reader) (n int64, err error)

func (*MetaBaseEntry) ReadOneNodeFrom added in v0.6.0

func (be *MetaBaseEntry) ReadOneNodeFrom(r io.Reader) (n int64, err error)

func (*MetaBaseEntry) String added in v0.6.0

func (be *MetaBaseEntry) String() string

func (*MetaBaseEntry) StringLocked added in v0.6.0

func (be *MetaBaseEntry) StringLocked() string

func (*MetaBaseEntry) TryGetTerminatedTS added in v0.6.0

func (be *MetaBaseEntry) TryGetTerminatedTS(waitIfcommitting bool) (terminated bool, TS types.TS)

func (*MetaBaseEntry) UpdateDeltaLoc added in v0.6.0

func (be *MetaBaseEntry) UpdateDeltaLoc(txn txnif.TxnReader, deltaloc string) (isNewNode bool, err error)

func (*MetaBaseEntry) UpdateMetaLoc added in v0.6.0

func (be *MetaBaseEntry) UpdateMetaLoc(txn txnif.TxnReader, metaloc string) (isNewNode bool, err error)

func (*MetaBaseEntry) WriteAllTo added in v0.6.0

func (be *MetaBaseEntry) WriteAllTo(w io.Writer) (n int64, err error)

func (*MetaBaseEntry) WriteOneNodeTo added in v0.6.0

func (be *MetaBaseEntry) WriteOneNodeTo(w io.Writer) (n int64, err error)

type MetadataMVCCNode added in v0.6.0

type MetadataMVCCNode struct {
	*EntryMVCCNode
	*txnbase.TxnMVCCNode
	MetaLoc  string
	DeltaLoc string
}

func (*MetadataMVCCNode) ApplyCommit added in v0.6.0

func (e *MetadataMVCCNode) ApplyCommit(index *wal.Index) (err error)

func (*MetadataMVCCNode) ApplyRollback added in v0.6.0

func (e *MetadataMVCCNode) ApplyRollback(index *wal.Index) (err error)

func (*MetadataMVCCNode) CloneAll added in v0.6.0

func (e *MetadataMVCCNode) CloneAll() txnif.MVCCNode

func (*MetadataMVCCNode) CloneData added in v0.6.0

func (e *MetadataMVCCNode) CloneData() txnif.MVCCNode

func (*MetadataMVCCNode) PrepareCommit added in v0.6.0

func (e *MetadataMVCCNode) PrepareCommit() (err error)

func (*MetadataMVCCNode) PrepareRollback added in v0.6.0

func (e *MetadataMVCCNode) PrepareRollback() (err error)

func (*MetadataMVCCNode) ReadFrom added in v0.6.0

func (e *MetadataMVCCNode) ReadFrom(r io.Reader) (n int64, err error)

func (*MetadataMVCCNode) String added in v0.6.0

func (e *MetadataMVCCNode) String() string

func (*MetadataMVCCNode) Update added in v0.6.0

func (e *MetadataMVCCNode) Update(vun txnif.MVCCNode)

for create drop in one txn

func (*MetadataMVCCNode) UpdateDeltaLoc added in v0.6.0

func (e *MetadataMVCCNode) UpdateDeltaLoc(deltaLoc string)

func (*MetadataMVCCNode) UpdateMetaLoc added in v0.6.0

func (e *MetadataMVCCNode) UpdateMetaLoc(metaLoc string)

func (*MetadataMVCCNode) WriteTo added in v0.6.0

func (e *MetadataMVCCNode) WriteTo(w io.Writer) (n int64, err error)

type OnUpdate added in v0.6.0

type OnUpdate struct {
	Expr         []byte
	OriginString string
}

func (*OnUpdate) Marshal added in v0.6.0

func (u *OnUpdate) Marshal() ([]byte, error)

func (*OnUpdate) Unmarshal added in v0.6.0

func (u *OnUpdate) Unmarshal(data []byte) (err error)

type Processor

type Processor interface {
	OnDatabase(database *DBEntry) error
	OnTable(table *TableEntry) error
	OnPostSegment(segment *SegmentEntry) error
	OnSegment(segment *SegmentEntry) error
	OnBlock(block *BlockEntry) error
}

XXX this API is broken. In case of inplementing a cursor like interface we cannot use error. moerr is a very heavy mechanism.

Return a int code.

type Schema

type Schema struct {
	AcInfo           accessInfo
	Name             string
	ColDefs          []*ColDef
	NameIndex        map[string]int
	BlockMaxRows     uint32
	SegmentMaxBlocks uint16
	Comment          string
	Partition        string
	Relkind          string
	Createsql        string
	View             string
	IndexInfos       []*ComputeIndexInfo

	SortKey    *SortKey
	PhyAddrKey *ColDef
}
var SystemColumnSchema *Schema
var SystemDBSchema *Schema
var SystemTableSchema *Schema

func MockSchema

func MockSchema(colCnt int, pkIdx int) *Schema

func MockSchemaAll

func MockSchemaAll(colCnt int, pkIdx int, from ...int) *Schema

MockSchemaAll if char/varchar is needed, colCnt = 14, otherwise colCnt = 12 pkIdx == -1 means no pk defined

func NewEmptySchema

func NewEmptySchema(name string) *Schema

func (*Schema) AllNames

func (s *Schema) AllNames() []string

func (*Schema) AllNullables

func (s *Schema) AllNullables() []bool

func (*Schema) AllTypes

func (s *Schema) AllTypes() []types.Type

func (*Schema) AppendCol

func (s *Schema) AppendCol(name string, typ types.Type) error

func (*Schema) AppendColDef

func (s *Schema) AppendColDef(def *ColDef) (err error)

func (*Schema) AppendColWithAttribute added in v0.6.0

func (s *Schema) AppendColWithAttribute(attr engine.Attribute) error

func (*Schema) AppendColWithDefault

func (s *Schema) AppendColWithDefault(name string, typ types.Type, val Default) error

func (*Schema) AppendPKCol

func (s *Schema) AppendPKCol(name string, typ types.Type, idx int) error

func (*Schema) AppendPKColWithAttribute added in v0.6.0

func (s *Schema) AppendPKColWithAttribute(attr engine.Attribute, idx int) error

func (*Schema) AppendSortKey

func (s *Schema) AppendSortKey(name string, typ types.Type, idx int, isPrimary bool) error

func (*Schema) Attrs

func (s *Schema) Attrs() []string

func (*Schema) Clone

func (s *Schema) Clone() *Schema

func (*Schema) Finalize

func (s *Schema) Finalize(rebuild bool) (err error)

Finalize runs various checks and create shortcuts to phyaddr and sortkey

func (*Schema) GetColIdx

func (s *Schema) GetColIdx(attr string) int

GetColIdx returns column index for the given column name if found, otherwise returns -1.

func (*Schema) GetSingleSortKey

func (s *Schema) GetSingleSortKey() *ColDef

GetSingleSortKey should be call only if IsSinglePK is checked

func (*Schema) GetSingleSortKeyIdx

func (s *Schema) GetSingleSortKeyIdx() int

func (*Schema) GetSortKeyType

func (s *Schema) GetSortKeyType() types.Type

func (*Schema) HasPK

func (s *Schema) HasPK() bool

func (*Schema) HasSortKey

func (s *Schema) HasSortKey() bool

func (*Schema) IsPartOfPK

func (s *Schema) IsPartOfPK(idx int) bool

func (*Schema) Marshal

func (s *Schema) Marshal() (buf []byte, err error)

func (*Schema) Nullables

func (s *Schema) Nullables() []bool

func (*Schema) ReadFrom

func (s *Schema) ReadFrom(r io.Reader) (n int64, err error)

func (*Schema) ReadFromBatch added in v0.6.0

func (s *Schema) ReadFromBatch(bat *containers.Batch, offset int) (next int)

func (*Schema) String

func (s *Schema) String() string

func (*Schema) Types

func (s *Schema) Types() []types.Type

type SegmentDataFactory

type SegmentDataFactory = func(meta *SegmentEntry) data.Segment

type SegmentEntry

type SegmentEntry struct {
	*MetaBaseEntry
	// contains filtered or unexported fields
}

func NewReplaySegmentEntry

func NewReplaySegmentEntry() *SegmentEntry

func NewSegmentEntry

func NewSegmentEntry(table *TableEntry, txn txnif.AsyncTxn, state EntryState, dataFactory SegmentDataFactory) *SegmentEntry

func NewStandaloneSegment

func NewStandaloneSegment(table *TableEntry, id uint64, ts types.TS) *SegmentEntry

func NewSysSegmentEntry

func NewSysSegmentEntry(table *TableEntry, id uint64) *SegmentEntry

func (*SegmentEntry) AddEntryLocked

func (entry *SegmentEntry) AddEntryLocked(block *BlockEntry)

func (*SegmentEntry) AsCommonID

func (entry *SegmentEntry) AsCommonID() *common.ID

func (*SegmentEntry) BlockCnt

func (entry *SegmentEntry) BlockCnt() int

func (*SegmentEntry) CollectBlockEntries

func (entry *SegmentEntry) CollectBlockEntries(commitFilter func(be *MetaBaseEntry) bool, blockFilter func(be *BlockEntry) bool) []*BlockEntry

func (*SegmentEntry) CreateBlock

func (entry *SegmentEntry) CreateBlock(txn txnif.AsyncTxn, state EntryState, dataFactory BlockDataFactory) (created *BlockEntry, err error)

func (*SegmentEntry) DestroyData

func (entry *SegmentEntry) DestroyData() (err error)

func (*SegmentEntry) DropBlockEntry

func (entry *SegmentEntry) DropBlockEntry(id uint64, txn txnif.AsyncTxn) (deleted *BlockEntry, err error)

func (*SegmentEntry) GetAppendableBlock added in v0.6.0

func (entry *SegmentEntry) GetAppendableBlock() (blk *BlockEntry)

func (*SegmentEntry) GetAppendableBlockCnt

func (entry *SegmentEntry) GetAppendableBlockCnt() int

func (*SegmentEntry) GetBlockEntryByID

func (entry *SegmentEntry) GetBlockEntryByID(id uint64) (blk *BlockEntry, err error)

func (*SegmentEntry) GetBlockEntryByIDLocked

func (entry *SegmentEntry) GetBlockEntryByIDLocked(id uint64) (blk *BlockEntry, err error)

XXX API like this, why do we need the error? Isn't blk is nil enough?

func (*SegmentEntry) GetCatalog

func (entry *SegmentEntry) GetCatalog() *Catalog

func (*SegmentEntry) GetScheduler

func (entry *SegmentEntry) GetScheduler() tasks.TaskScheduler

func (*SegmentEntry) GetSegmentData

func (entry *SegmentEntry) GetSegmentData() data.Segment

func (*SegmentEntry) GetTable

func (entry *SegmentEntry) GetTable() *TableEntry

func (*SegmentEntry) GetTerminationTS added in v0.6.0

func (entry *SegmentEntry) GetTerminationTS() (ts types.TS, terminated bool)

GetTerminationTS is coarse API: no consistency check

func (*SegmentEntry) InitData

func (entry *SegmentEntry) InitData(factory DataFactory)

func (*SegmentEntry) Is1PC added in v0.6.0

func (entry *SegmentEntry) Is1PC() bool

func (*SegmentEntry) IsActive

func (entry *SegmentEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*SegmentEntry) IsAppendable

func (entry *SegmentEntry) IsAppendable() bool

func (*SegmentEntry) LastAppendableBlock

func (entry *SegmentEntry) LastAppendableBlock() (blk *BlockEntry)

func (*SegmentEntry) MakeBlockIt

func (entry *SegmentEntry) MakeBlockIt(reverse bool) *common.GenericSortedDListIt[*BlockEntry]

func (*SegmentEntry) MakeCommand

func (entry *SegmentEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*SegmentEntry) PPString

func (entry *SegmentEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*SegmentEntry) PrepareRollback

func (entry *SegmentEntry) PrepareRollback() (err error)

func (*SegmentEntry) ReadFrom

func (entry *SegmentEntry) ReadFrom(r io.Reader) (n int64, err error)

func (*SegmentEntry) RemoveEntry

func (entry *SegmentEntry) RemoveEntry(block *BlockEntry) (err error)

func (*SegmentEntry) Repr

func (entry *SegmentEntry) Repr() string

func (*SegmentEntry) Set1PC added in v0.6.0

func (entry *SegmentEntry) Set1PC()

func (*SegmentEntry) String

func (entry *SegmentEntry) String() string

func (*SegmentEntry) StringLocked

func (entry *SegmentEntry) StringLocked() string

func (*SegmentEntry) StringWithLevel added in v0.6.0

func (entry *SegmentEntry) StringWithLevel(level common.PPLevel) string

func (*SegmentEntry) StringWithLevelLocked added in v0.6.0

func (entry *SegmentEntry) StringWithLevelLocked(level common.PPLevel) string

func (*SegmentEntry) TreeMaxDropCommitEntry

func (entry *SegmentEntry) TreeMaxDropCommitEntry() BaseEntry

func (*SegmentEntry) WriteTo

func (entry *SegmentEntry) WriteTo(w io.Writer) (n int64, err error)

type SortKey

type SortKey struct {
	Defs []*ColDef
	// contains filtered or unexported fields
}

func NewSortKey

func NewSortKey() *SortKey

func (*SortKey) AddDef

func (cpk *SortKey) AddDef(def *ColDef) (ok bool)

func (*SortKey) GetDef

func (cpk *SortKey) GetDef(pos int) *ColDef

func (*SortKey) GetSingleIdx

func (cpk *SortKey) GetSingleIdx() int

func (*SortKey) HasColumn

func (cpk *SortKey) HasColumn(idx int) (found bool)

func (*SortKey) IsPrimary

func (cpk *SortKey) IsPrimary() bool

func (*SortKey) Size

func (cpk *SortKey) Size() int

type TableBaseEntry added in v0.6.0

type TableBaseEntry struct {
	*txnbase.MVCCChain
	ID uint64
}

func NewReplayTableBaseEntry added in v0.6.0

func NewReplayTableBaseEntry() *TableBaseEntry

func NewTableBaseEntry added in v0.6.0

func NewTableBaseEntry(id uint64) *TableBaseEntry

func (*TableBaseEntry) CloneCommittedInRange added in v0.6.0

func (be *TableBaseEntry) CloneCommittedInRange(start, end types.TS) BaseEntry

func (*TableBaseEntry) CreateWithTS added in v0.6.0

func (be *TableBaseEntry) CreateWithTS(ts types.TS)

func (*TableBaseEntry) CreateWithTxn added in v0.6.0

func (be *TableBaseEntry) CreateWithTxn(txn txnif.AsyncTxn)

func (*TableBaseEntry) DeleteAfter added in v0.6.0

func (be *TableBaseEntry) DeleteAfter(ts types.TS) bool

func (*TableBaseEntry) DeleteBefore added in v0.6.0

func (be *TableBaseEntry) DeleteBefore(ts types.TS) bool

func (*TableBaseEntry) DeleteLocked added in v0.6.0

func (be *TableBaseEntry) DeleteLocked(txn txnif.TxnReader) (isNewNode bool, err error)

func (*TableBaseEntry) DoCompre added in v0.6.0

func (be *TableBaseEntry) DoCompre(voe BaseEntry) int

func (*TableBaseEntry) DropEntryLocked added in v0.6.0

func (be *TableBaseEntry) DropEntryLocked(txnCtx txnif.TxnReader) (isNewNode bool, err error)

func (*TableBaseEntry) GetCreatedAt added in v0.6.0

func (be *TableBaseEntry) GetCreatedAt() types.TS

func (*TableBaseEntry) GetDeleteAt added in v0.6.0

func (be *TableBaseEntry) GetDeleteAt() types.TS

func (*TableBaseEntry) GetID added in v0.6.0

func (be *TableBaseEntry) GetID() uint64

func (*TableBaseEntry) GetVisibility added in v0.6.0

func (be *TableBaseEntry) GetVisibility(ts types.TS) (visible, dropped bool)

func (*TableBaseEntry) GetVisibilityLocked added in v0.6.0

func (be *TableBaseEntry) GetVisibilityLocked(ts types.TS) (visible, dropped bool)

func (*TableBaseEntry) HasDropCommitted added in v0.6.0

func (be *TableBaseEntry) HasDropCommitted() bool

func (*TableBaseEntry) HasDropCommittedLocked added in v0.6.0

func (be *TableBaseEntry) HasDropCommittedLocked() bool

func (*TableBaseEntry) IsVisible added in v0.6.0

func (be *TableBaseEntry) IsVisible(ts types.TS, mu *sync.RWMutex) (ok bool, err error)

func (*TableBaseEntry) NeedWaitCommitting added in v0.6.0

func (be *TableBaseEntry) NeedWaitCommitting(startTS types.TS) (bool, txnif.TxnReader)

func (*TableBaseEntry) PPString added in v0.6.0

func (be *TableBaseEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*TableBaseEntry) PrepareAdd added in v0.6.0

func (be *TableBaseEntry) PrepareAdd(txn txnif.TxnReader) (err error)

func (*TableBaseEntry) ReadAllFrom added in v0.6.0

func (be *TableBaseEntry) ReadAllFrom(r io.Reader) (n int64, err error)

func (*TableBaseEntry) ReadOneNodeFrom added in v0.6.0

func (be *TableBaseEntry) ReadOneNodeFrom(r io.Reader) (n int64, err error)

func (*TableBaseEntry) String added in v0.6.0

func (be *TableBaseEntry) String() string

func (*TableBaseEntry) StringLocked added in v0.6.0

func (be *TableBaseEntry) StringLocked() string

func (*TableBaseEntry) TryGetTerminatedTS added in v0.6.0

func (be *TableBaseEntry) TryGetTerminatedTS(waitIfcommitting bool) (terminated bool, TS types.TS)

func (*TableBaseEntry) WriteAllTo added in v0.6.0

func (be *TableBaseEntry) WriteAllTo(w io.Writer) (n int64, err error)

func (*TableBaseEntry) WriteOneNodeTo added in v0.6.0

func (be *TableBaseEntry) WriteOneNodeTo(w io.Writer) (n int64, err error)

type TableDataFactory

type TableDataFactory = func(meta *TableEntry) data.Table

type TableEntry

type TableEntry struct {
	*TableBaseEntry
	// contains filtered or unexported fields
}

func MockStaloneTableEntry

func MockStaloneTableEntry(id uint64, schema *Schema) *TableEntry

func NewReplayTableEntry

func NewReplayTableEntry() *TableEntry

func NewSystemTableEntry

func NewSystemTableEntry(db *DBEntry, id uint64, schema *Schema) *TableEntry

func NewTableEntry

func NewTableEntry(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, dataFactory TableDataFactory) *TableEntry

func NewTableEntryWithTableId added in v0.6.0

func NewTableEntryWithTableId(db *DBEntry, schema *Schema, txnCtx txnif.AsyncTxn, dataFactory TableDataFactory, tableId uint64) *TableEntry

func (*TableEntry) AddEntryLocked

func (entry *TableEntry) AddEntryLocked(segment *SegmentEntry)

func (*TableEntry) AddRows

func (entry *TableEntry) AddRows(delta uint64) uint64

func (*TableEntry) AsCommonID

func (entry *TableEntry) AsCommonID() *common.ID

func (*TableEntry) CreateSegment

func (entry *TableEntry) CreateSegment(txn txnif.AsyncTxn, state EntryState, dataFactory SegmentDataFactory) (created *SegmentEntry, err error)

func (*TableEntry) DropSegmentEntry

func (entry *TableEntry) DropSegmentEntry(id uint64, txn txnif.AsyncTxn) (deleted *SegmentEntry, err error)

func (*TableEntry) GetCatalog

func (entry *TableEntry) GetCatalog() *Catalog

func (*TableEntry) GetColDefs added in v0.6.0

func (entry *TableEntry) GetColDefs() []*ColDef

func (*TableEntry) GetDB

func (entry *TableEntry) GetDB() *DBEntry

func (*TableEntry) GetFullName added in v0.6.0

func (entry *TableEntry) GetFullName() string

func (*TableEntry) GetRows

func (entry *TableEntry) GetRows() uint64

func (*TableEntry) GetSchema

func (entry *TableEntry) GetSchema() *Schema

func (*TableEntry) GetSegmentByID

func (entry *TableEntry) GetSegmentByID(id uint64) (seg *SegmentEntry, err error)

func (*TableEntry) GetTableData

func (entry *TableEntry) GetTableData() data.Table

func (*TableEntry) GetTerminationTS added in v0.6.0

func (entry *TableEntry) GetTerminationTS() (ts types.TS, terminated bool)

GetTerminationTS is coarse API: no consistency check

func (*TableEntry) Is1PC added in v0.6.0

func (entry *TableEntry) Is1PC() bool

func (*TableEntry) IsActive

func (entry *TableEntry) IsActive() bool

IsActive is coarse API: no consistency check

func (*TableEntry) IsVirtual

func (entry *TableEntry) IsVirtual() bool

func (*TableEntry) LastAppendableSegmemt

func (entry *TableEntry) LastAppendableSegmemt() (seg *SegmentEntry)

func (*TableEntry) MakeCommand

func (entry *TableEntry) MakeCommand(id uint32) (cmd txnif.TxnCmd, err error)

func (*TableEntry) MakeSegmentIt

func (entry *TableEntry) MakeSegmentIt(reverse bool) *common.GenericSortedDListIt[*SegmentEntry]

func (*TableEntry) PPString

func (entry *TableEntry) PPString(level common.PPLevel, depth int, prefix string) string

func (*TableEntry) PrepareRollback

func (entry *TableEntry) PrepareRollback() (err error)

func (*TableEntry) ReadFrom

func (entry *TableEntry) ReadFrom(r io.Reader) (n int64, err error)

func (*TableEntry) RecurLoop

func (entry *TableEntry) RecurLoop(processor Processor) (err error)

func (*TableEntry) RemoveEntry

func (entry *TableEntry) RemoveEntry(segment *SegmentEntry) (err error)

func (*TableEntry) RemoveRows

func (entry *TableEntry) RemoveRows(delta uint64) uint64

func (*TableEntry) Set1PC added in v0.6.0

func (entry *TableEntry) Set1PC()

func (*TableEntry) String

func (entry *TableEntry) String() string

func (*TableEntry) StringLocked

func (entry *TableEntry) StringLocked() string

func (*TableEntry) StringLockedWithLevel added in v0.6.0

func (entry *TableEntry) StringLockedWithLevel(level common.PPLevel) string

func (*TableEntry) StringWithLevel added in v0.6.0

func (entry *TableEntry) StringWithLevel(level common.PPLevel) string

func (*TableEntry) WriteTo

func (entry *TableEntry) WriteTo(w io.Writer) (n int64, err error)

type TableMVCCNode added in v0.6.0

type TableMVCCNode struct {
	*EntryMVCCNode
	*txnbase.TxnMVCCNode
}

func (*TableMVCCNode) ApplyCommit added in v0.6.0

func (e *TableMVCCNode) ApplyCommit(index *wal.Index) (err error)

func (*TableMVCCNode) ApplyRollback added in v0.6.0

func (e *TableMVCCNode) ApplyRollback(index *wal.Index) (err error)

func (*TableMVCCNode) CloneAll added in v0.6.0

func (e *TableMVCCNode) CloneAll() txnif.MVCCNode

func (*TableMVCCNode) CloneData added in v0.6.0

func (e *TableMVCCNode) CloneData() txnif.MVCCNode

func (*TableMVCCNode) PrepareCommit added in v0.6.0

func (e *TableMVCCNode) PrepareCommit() (err error)

func (*TableMVCCNode) ReadFrom added in v0.6.0

func (e *TableMVCCNode) ReadFrom(r io.Reader) (n int64, err error)

func (*TableMVCCNode) String added in v0.6.0

func (e *TableMVCCNode) String() string

func (*TableMVCCNode) Update added in v0.6.0

func (e *TableMVCCNode) Update(vun txnif.MVCCNode)

for create drop in one txn

func (*TableMVCCNode) WriteTo added in v0.6.0

func (e *TableMVCCNode) WriteTo(w io.Writer) (n int64, err error)

Jump to

Keyboard shortcuts

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