db

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WALDir     = "wal"
	CATALOGDir = "catalog"
)
View Source
const DefaultReplayCacheSize = 2 * common.M
View Source
const (
	LockName string = "TAE"
)

Variables

View Source
var (
	ErrTaskDuplicated = errors.New("tae task: duplicated task found")
	ErrTaskNotFound   = errors.New("tae task: task not found")
)
View Source
var (
	ErrClosed = errors.New("tae: closed")
)

Functions

func MakeBlockScopes

func MakeBlockScopes(entries ...*catalog.BlockEntry) (scopes []common.ID)

func MakeDBScopes

func MakeDBScopes(entry *catalog.DBEntry) (scopes []common.ID)

func MakeSegmentScopes

func MakeSegmentScopes(entries ...*catalog.SegmentEntry) (scopes []common.ID)

func MakeTableScopes

func MakeTableScopes(entries ...*catalog.TableEntry) (scopes []common.ID)

func NewDBScanner

func NewDBScanner(db *DB, errHandler ErrHandler) *dbScanner

func ScopeConflictCheck

func ScopeConflictCheck(oldScope, newScope *common.ID) (err error)

Types

type CatalogStats

type CatalogStats struct {
	MaxDBID uint64
	MaxTID  uint64
	MaxSID  uint64
	MaxBID  uint64
}

func CollectCatalogStats

func CollectCatalogStats(c *catalog.Catalog) *CatalogStats

type DB

type DB struct {
	Dir  string
	Opts *options.Options

	Catalog *catalog.Catalog

	IndexBufMgr base.INodeManager
	MTBufMgr    base.INodeManager
	TxnBufMgr   base.INodeManager

	TxnMgr *txnbase.TxnManager
	Wal    wal.Driver

	CKPDriver checkpoint.Driver

	Scheduler tasks.TaskScheduler

	TimedScanner wb.IHeartbeater

	FileFactory file.SegmentFactory

	DBLocker io.Closer

	Closed *atomic.Value
}

func Open

func Open(dirname string, opts *options.Options) (db *DB, err error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) CollectStats

func (db *DB) CollectStats() *Stats

func (*DB) CommitTxn

func (db *DB) CommitTxn(txn txnif.AsyncTxn) (err error)

func (*DB) GetTxn

func (db *DB) GetTxn(id uint64) (txn txnif.AsyncTxn, err error)

func (*DB) GetTxnByCtx

func (db *DB) GetTxnByCtx(ctx []byte) (txn txnif.AsyncTxn, err error)

func (*DB) PrintStats

func (db *DB) PrintStats()

func (*DB) Replay

func (db *DB) Replay(dataFactory *tables.DataFactory)

func (*DB) RollbackTxn

func (db *DB) RollbackTxn(txn txnif.AsyncTxn) error

func (*DB) StartTxn

func (db *DB) StartTxn(info []byte) (txnif.AsyncTxn, error)

type DBScanner

type DBScanner interface {
	base.IHBHandle
	RegisterOp(ScannerOp)
}

type ErrHandler

type ErrHandler interface {
	OnBlockErr(entry *catalog.BlockEntry, err error) error
	OnSegmentErr(entry *catalog.SegmentEntry, err error) error
	OnTableErr(entry *catalog.TableEntry, err error) error
	OnDatabaseErr(entry *catalog.DBEntry, err error) error
}

type GCType

type GCType int16
const (
	GCType_Block GCType = iota
	GCType_Segment
	GCType_Table
	GCType_DB
)

type NoopErrHandler

type NoopErrHandler struct{}

func (*NoopErrHandler) OnBlockErr

func (h *NoopErrHandler) OnBlockErr(entry *catalog.BlockEntry, err error) error

func (*NoopErrHandler) OnDatabaseErr

func (h *NoopErrHandler) OnDatabaseErr(entry *catalog.DBEntry, err error) error

func (*NoopErrHandler) OnSegmentErr

func (h *NoopErrHandler) OnSegmentErr(entry *catalog.SegmentEntry, err error) error

func (*NoopErrHandler) OnTableErr

func (h *NoopErrHandler) OnTableErr(entry *catalog.TableEntry, err error) error

type Replayer

type Replayer struct {
	DataFactory *tables.DataFactory
	// contains filtered or unexported fields
}

func (*Replayer) GetMaxTS

func (replayer *Replayer) GetMaxTS() uint64

func (*Replayer) OnReplayCmd

func (replayer *Replayer) OnReplayCmd(txncmd txnif.TxnCmd, idxCtx *wal.Index)

func (*Replayer) OnReplayEntry

func (replayer *Replayer) OnReplayEntry(group uint32, commitId uint64, payload []byte, typ uint16, info any)

func (*Replayer) OnStaleIndex

func (replayer *Replayer) OnStaleIndex(idx *wal.Index)

func (*Replayer) OnTimeStamp

func (replayer *Replayer) OnTimeStamp(ts uint64)

func (*Replayer) PostReplayWal

func (replayer *Replayer) PostReplayWal()

func (*Replayer) PreReplayWal

func (replayer *Replayer) PreReplayWal()

func (*Replayer) Replay

func (replayer *Replayer) Replay()

type ScannerOp

type ScannerOp interface {
	catalog.Processor
	PreExecute() error
	PostExecute() error
}

type ScheduledTxnTask

type ScheduledTxnTask struct {
	*tasks.BaseTask
	// contains filtered or unexported fields
}

func NewScheduledTxnTask

func NewScheduledTxnTask(ctx *tasks.Context, db *DB, taskType tasks.TaskType, scopes []common.ID, factory tasks.TxnTaskFactory) (task *ScheduledTxnTask)

func (*ScheduledTxnTask) Execute

func (task *ScheduledTxnTask) Execute() (err error)

func (*ScheduledTxnTask) Scope

func (task *ScheduledTxnTask) Scope() *common.ID

func (*ScheduledTxnTask) Scopes

func (task *ScheduledTxnTask) Scopes() []common.ID

type Stats

type Stats struct {
	CatalogStats *CatalogStats
	TxnStats     *TxnStats
	WalStats     *WalStats
	// contains filtered or unexported fields
}

func NewStats

func NewStats(db *DB) *Stats

func (*Stats) Collect

func (stats *Stats) Collect()

func (*Stats) ToString

func (stats *Stats) ToString(prefix string) string

type TxnStats

type TxnStats struct {
	MaxTS  uint64
	MaxID  uint64
	SafeTS uint64
}

func CollectTxnStats

func CollectTxnStats(mgr *txnbase.TxnManager) *TxnStats

type WalStats

type WalStats struct {
	MaxLSN     uint64
	MaxCkped   uint64
	PendingCnt uint64
}

func CollectWalStats

func CollectWalStats(w wal.Driver) *WalStats

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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