db

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 35 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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