Documentation
¶
Overview ¶
Copyright 2022 Matrix Origin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func CalcStats(ctx context.Context, blocks *[][]BlockMeta, expr *plan.Expr, ...) (*plan.Stats, error)
- func GetTableMeta(ctx context.Context, tbl *table, expr *plan.Expr) error
- type BlockBatch
- type BlockMeta
- type Columns
- type ColumnsIndexDef
- type DB
- type DNStore
- type DataRow
- type DataValue
- type Engine
- func (e *Engine) Commit(ctx context.Context, op client.TxnOperator) error
- func (e *Engine) Create(ctx context.Context, name string, op client.TxnOperator) error
- func (e *Engine) Database(ctx context.Context, name string, op client.TxnOperator) (engine.Database, error)
- func (e *Engine) Databases(ctx context.Context, op client.TxnOperator) ([]string, error)
- func (e *Engine) Delete(ctx context.Context, name string, op client.TxnOperator) error
- func (e *Engine) GetNameById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName string, tblName string, err error)
- func (e *Engine) GetRelationById(ctx context.Context, op client.TxnOperator, tableId uint64) (dbName, tableName string, rel engine.Relation, err error)
- func (e *Engine) Hints() (h engine.Hints)
- func (e *Engine) New(ctx context.Context, op client.TxnOperator) error
- func (e *Engine) NewBlockReader(ctx context.Context, num int, ts timestamp.Timestamp, expr *plan.Expr, ...) ([]engine.Reader, error)
- func (e *Engine) Nodes() (engine.Nodes, error)
- func (e *Engine) Rollback(ctx context.Context, op client.TxnOperator) error
- type Entry
- type IDGenerator
- type MVCC
- type ModifyBlockMeta
- type Partition
- func (p *Partition) BlockList(ctx context.Context, ts timestamp.Timestamp, blocks []BlockMeta, ...) ([]BlockMeta, map[uint64][]int)
- func (*Partition) CheckPoint(ctx context.Context, ts timestamp.Timestamp) error
- func (p *Partition) Delete(ctx context.Context, b *api.Batch) error
- func (p *Partition) DeleteByBlockID(ctx context.Context, ts timestamp.Timestamp, blockID uint64) error
- func (p *Partition) GC(ts timestamp.Timestamp) error
- func (p *Partition) Get(key types.Rowid, ts timestamp.Timestamp) bool
- func (p *Partition) GetRowsByIndex(ts timestamp.Timestamp, index memtable.Tuple, columns []string, ...) (rows [][]any, err error)
- func (p *Partition) GetRowsByIndexPrefix(ts timestamp.Timestamp, prefix memtable.Tuple) (rows []DataValue, err error)
- func (p *Partition) Insert(ctx context.Context, primaryKeyIndex int, b *api.Batch, needCheck bool) error
- func (p *Partition) IterDeletedRowIDs(ctx context.Context, blockIDs []uint64, ts timestamp.Timestamp, ...)
- func (p *Partition) NewReader(ctx context.Context, readerNumber int, index memtable.Tuple, ...) ([]engine.Reader, error)
- func (p *Partition) Rows(tx *memtable.Transaction, deletes map[types.Rowid]uint8, ...) (int64, error)
- type PartitionReader
- type Partitions
- type RowID
- type Transaction
- func (txn *Transaction) IncStatementId()
- func (txn *Transaction) ReadOnly() bool
- func (txn *Transaction) WriteBatch(typ int, databaseId uint64, tableId uint64, databaseName string, ...) error
- func (txn *Transaction) WriteFile(typ int, databaseId, tableId uint64, databaseName, tableName string, ...) error
Constants ¶
const ( INSERT = iota DELETE UPDATE )
const ( MO_DATABASE_ID_NAME_IDX = 1 MO_DATABASE_ID_ACCOUNT_IDX = 2 MO_DATABASE_LIST_ACCOUNT_IDX = 1 MO_TABLE_ID_NAME_IDX = 1 MO_TABLE_ID_DATABASE_ID_IDX = 2 MO_TABLE_ID_ACCOUNT_IDX = 3 MO_TABLE_LIST_DATABASE_ID_IDX = 1 MO_TABLE_LIST_ACCOUNT_IDX = 2 MO_PRIMARY_OFF = 2 )
const ( HASH_VALUE_FUN string = "hash_value" MAX_RANGE_SIZE int64 = 200 )
const (
GcCycle = 10 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
func CalcStats ¶ added in v0.7.0
func CalcStats(ctx context.Context, blocks *[][]BlockMeta, expr *plan.Expr, tableDef *plan.TableDef, proc *process.Process, sortKeyName string) (*plan.Stats, error)
calculate the stats for scan node. we need to get the zonemap from cn, and eval the filters with zonemap
Types ¶
type BlockBatch ¶ added in v0.7.0
type BlockBatch struct {
// contains filtered or unexported fields
}
type ColumnsIndexDef ¶
func NewColumnsIndexDef ¶
func NewColumnsIndexDef(name memtable.Text, cols ...int) ColumnsIndexDef
type DNStore ¶
type DNStore = logservice.DNStore
type DataRow ¶
type DataRow struct {
// contains filtered or unexported fields
}
func (*DataRow) UniqueIndexes ¶
type Engine ¶
func New ¶
func New( ctx context.Context, mp *mpool.MPool, fs fileservice.FileService, cli client.TxnClient, idGen IDGenerator, getClusterDetails engine.GetClusterDetailsFunc, ) *Engine
func (*Engine) GetNameById ¶ added in v0.7.0
func (*Engine) GetRelationById ¶ added in v0.7.0
func (*Engine) NewBlockReader ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry represents a delete/insert
type MVCC ¶
type MVCC interface {
CheckPoint(ctx context.Context, ts timestamp.Timestamp) error
Insert(ctx context.Context, primaryKeyIndex int, bat *api.Batch, needCheck bool) error
Delete(ctx context.Context, bat *api.Batch) error
BlockList(ctx context.Context, ts timestamp.Timestamp,
blocks []BlockMeta, entries []Entry) ([]BlockMeta, map[uint64][]int)
// If blocks is empty, it means no merge operation with the files on s3 is required.
NewReader(ctx context.Context, readerNumber int, index memtable.Tuple, defs []engine.TableDef,
tableDef *plan.TableDef, skipBlocks map[uint64]uint8, blks []ModifyBlockMeta,
ts timestamp.Timestamp, fs fileservice.FileService, entries []Entry) ([]engine.Reader, error)
}
mvcc is the core data structure of cn and is used to maintain multiple versions of logtail data for a table's partition
type ModifyBlockMeta ¶
type ModifyBlockMeta struct {
// contains filtered or unexported fields
}
type Partition ¶
type Partition struct {
// contains filtered or unexported fields
}
a partition corresponds to a dn
func NewPartition ¶
func NewPartition( columnsIndexDefs []ColumnsIndexDef, ) *Partition
func (*Partition) CheckPoint ¶
func (*Partition) DeleteByBlockID ¶
func (*Partition) GetRowsByIndex ¶
func (*Partition) GetRowsByIndexPrefix ¶
func (*Partition) IterDeletedRowIDs ¶
type PartitionReader ¶
type PartitionReader struct {
// contains filtered or unexported fields
}
func (*PartitionReader) Close ¶
func (p *PartitionReader) Close() error
type Partitions ¶
type Partitions []*Partition
type Transaction ¶
Transaction represents a transaction
func (*Transaction) IncStatementId ¶
func (txn *Transaction) IncStatementId()
use for solving halloween problem
func (*Transaction) ReadOnly ¶
func (txn *Transaction) ReadOnly() bool
detecting whether a transaction is a read-only transaction
func (*Transaction) WriteBatch ¶
func (txn *Transaction) WriteBatch( typ int, databaseId uint64, tableId uint64, databaseName string, tableName string, bat *batch.Batch, dnStore DNStore, primaryIdx int, ) error
Write used to write data to the transaction buffer insert/delete/update all use this api
func (*Transaction) WriteFile ¶
func (txn *Transaction) WriteFile(typ int, databaseId, tableId uint64, databaseName, tableName string, fileName string, bat *batch.Batch, dnStore DNStore) error
WriteFile used to add a s3 file information to the transaction buffer insert/delete/update all use this api