Documentation
¶
Index ¶
- Constants
- Variables
- func BeginCpuProfile(cpu string) *os.File
- func BeginTime() time.Time
- func ConvertAttributeDescIntoTypesType(attrs []*descriptor.AttributeDesc) ([]string, []*engine.AttributeDef)
- func EndCpuProfile(cpuf *os.File)
- func EndTime(s time.Time, info string)
- func EngineTypeToTpeType(t *types.Type) orderedcodec.ValueType
- func FillBatch(lines [][]string, batchData *batch.Batch)
- func GetDeleteFlag(bat *batch.Batch) bool
- func GetRow(writeCtx interface{}, bat *batch.Batch, row []interface{}, j int) error
- func GetRowID(nodeID uint64) uint64
- func InitColIndex(indexWriteCtx *WriteContext, bat *batch.Batch)
- func IsValid(r Range) bool
- func MakeAttributes(ts ...types.T) ([]string, []*engine.AttributeDef)
- func MakeBatch(batchSize int, attrName []string, cols []*engine.AttributeDef) *batch.Batch
- func MarshalDatabaseDesc(desc *descriptor.DatabaseDesc) ([]byte, error)
- func MarshalRelationDesc(desc *descriptor.RelationDesc) ([]byte, error)
- func MaxUint64(a, b uint64) uint64
- func Min(a, b int) int
- func ParseFloat(actualData []byte, bitSize int) (interface{}, error)
- func ParseInterge(actualData []byte, base int, bitSize int, flag bool) (interface{}, error)
- func SerializeVectorForBatch(bat *batch.Batch) error
- func TpeTypeToEngineType(Ttype orderedcodec.ValueType) types.Type
- func TruncateBatch(bat *batch.Batch, batchSize, needLen int)
- func Uint64ToString(v uint64) string
- func UnmarshalDatabaseDesc(data []byte) (*descriptor.DatabaseDesc, error)
- func UnmarshalRelationDesc(data []byte) (*descriptor.RelationDesc, error)
- type AttributeMap
- type AttributeStateForWrite
- type BatchAdapter
- type CompactValueLayoutSerializer
- func (cvls *CompactValueLayoutSerializer) Deserialize(data []byte, amForValue *AttributeMap) ([]byte, []*orderedcodec.DecodedItem, []*ValueDecodedItem, error)
- func (cvls *CompactValueLayoutSerializer) GetPositionsOfAttributesInTheValue(tableDesc *descriptor.RelationDesc, indexDesc *descriptor.IndexDesc) map[uint32]int
- func (cvls *CompactValueLayoutSerializer) Serialize(out []byte, ctx *ValueLayoutContext) ([]byte, error)
- type ComputationHandlerImpl
- func (chi *ComputationHandlerImpl) CreateDatabase(epoch uint64, dbName string, typ int) (uint64, error)
- func (chi *ComputationHandlerImpl) CreateTable(epoch, dbId uint64, tableDesc *descriptor.RelationDesc) (uint64, error)
- func (chi *ComputationHandlerImpl) DropDatabase(epoch uint64, dbName string) error
- func (chi *ComputationHandlerImpl) DropTable(epoch, dbId uint64, tableName string) (uint64, error)
- func (chi *ComputationHandlerImpl) DropTableByDesc(epoch, dbId uint64, tableDesc *descriptor.RelationDesc) (uint64, error)
- func (chi *ComputationHandlerImpl) GetDatabase(dbName string) (*descriptor.DatabaseDesc, error)
- func (chi *ComputationHandlerImpl) GetNodesHoldTheTable(dbId uint64, desc *descriptor.RelationDesc) (engine.Nodes, interface{}, error)
- func (chi *ComputationHandlerImpl) GetTable(dbId uint64, name string) (*descriptor.RelationDesc, error)
- func (chi *ComputationHandlerImpl) ListDatabases() ([]*descriptor.DatabaseDesc, error)
- func (chi *ComputationHandlerImpl) ListTables(dbId uint64) ([]*descriptor.RelationDesc, error)
- func (chi *ComputationHandlerImpl) MultiNode() bool
- func (chi *ComputationHandlerImpl) ParallelReader() bool
- func (chi *ComputationHandlerImpl) Read(readCtx interface{}) (*batch.Batch, error)
- func (chi *ComputationHandlerImpl) RemoveDeletedTable(epoch uint64) (int, error)
- func (chi *ComputationHandlerImpl) Write(writeCtx interface{}, bat *batch.Batch) error
- type ConciseSerializer
- type CubeKV
- func (ck *CubeKV) DedupSet(key TupleKey, value TupleValue) error
- func (ck *CubeKV) DedupSetBatch(keys []TupleKey, values []TupleValue) error
- func (ck *CubeKV) Delete(key TupleKey) error
- func (ck *CubeKV) DeleteWithPrefix(prefix TupleKey) error
- func (ck *CubeKV) Get(key TupleKey) (TupleValue, error)
- func (ck *CubeKV) GetBatch(keys []TupleKey) ([]TupleValue, error)
- func (ck *CubeKV) GetKVType() KVType
- func (ck *CubeKV) GetRange(startKey TupleKey, endKey TupleKey) ([]TupleValue, error)
- func (ck *CubeKV) GetRangeWithLimit(startKey TupleKey, endKey TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (ck *CubeKV) GetRangeWithPrefixLimit(startKey TupleKey, endKey TupleKey, prefix TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (ck *CubeKV) GetShardsWithPrefix(prefix TupleKey) (interface{}, error)
- func (ck *CubeKV) GetShardsWithRange(startKey TupleKey, endKey TupleKey) (interface{}, error)
- func (ck *CubeKV) GetWithPrefix(prefixOrStartkey TupleKey, prefixLen int, prefixEnd []byte, needKeyOnly bool, ...) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (ck *CubeKV) NextID(typ string) (uint64, error)
- func (ck *CubeKV) Set(key TupleKey, value TupleValue) error
- func (ck *CubeKV) SetBatch(keys []TupleKey, values []TupleValue) error
- type CubeShards
- type DefaultValue
- type DefaultValueLayoutSerializer
- func (dvls *DefaultValueLayoutSerializer) Deserialize(data []byte, amForValue *AttributeMap) ([]byte, []*orderedcodec.DecodedItem, []*ValueDecodedItem, error)
- func (dvls *DefaultValueLayoutSerializer) GetPositionsOfAttributesInTheValue(tableDesc *descriptor.RelationDesc, indexDesc *descriptor.IndexDesc) map[uint32]int
- func (dvls *DefaultValueLayoutSerializer) Serialize(out []byte, ctx *ValueLayoutContext) ([]byte, error)
- type DefaultValueSerializer
- type DescriptorHandlerImpl
- func (dhi *DescriptorHandlerImpl) DeleteDatabaseDescByID(dbID uint64) error
- func (dhi *DescriptorHandlerImpl) DeleteRelationDescByID(parentID uint64, tableID uint64) error
- func (dhi *DescriptorHandlerImpl) GetValuesWithPrefix(parentID uint64, callbackCtx interface{}, ...) ([]byte, error)
- func (dhi *DescriptorHandlerImpl) ListRelationDescFromAsyncGC(epoch uint64) ([]descriptor.EpochGCItem, error)
- func (dhi *DescriptorHandlerImpl) LoadDatabaseDescByID(dbID uint64) (*descriptor.DatabaseDesc, error)
- func (dhi *DescriptorHandlerImpl) LoadDatabaseDescByName(name string) (*descriptor.DatabaseDesc, error)
- func (dhi *DescriptorHandlerImpl) LoadRelationDescByID(parentID uint64, tableID uint64) (*descriptor.RelationDesc, error)
- func (dhi *DescriptorHandlerImpl) LoadRelationDescByName(parentID uint64, name string) (*descriptor.RelationDesc, error)
- func (dhi *DescriptorHandlerImpl) MakePrefixWithEpochAndDBIDAndTableID(dbID uint64, tableID uint64, indexID uint64, gcEpoch uint64, gcDbID uint64, ...) (TupleKey, *orderedcodec.EncodedItem)
- func (dhi *DescriptorHandlerImpl) MakePrefixWithOneExtraID(dbID uint64, tableID uint64, indexID uint64, extraID uint64) ([]byte, *orderedcodec.EncodedItem)
- func (dhi *DescriptorHandlerImpl) StoreDatabaseDescByID(dbID uint64, dbDesc *descriptor.DatabaseDesc) error
- func (dhi *DescriptorHandlerImpl) StoreDatabaseDescByName(name string, dbDesc *descriptor.DatabaseDesc) error
- func (dhi *DescriptorHandlerImpl) StoreRelationDescByID(parentID uint64, tableID uint64, tableDesc *descriptor.RelationDesc) error
- func (dhi *DescriptorHandlerImpl) StoreRelationDescByName(parentID uint64, name string, tableDesc *descriptor.RelationDesc) error
- func (dhi *DescriptorHandlerImpl) StoreRelationDescIntoAsyncGC(epoch uint64, dbID uint64, desc *descriptor.RelationDesc) error
- type EpochHandler
- type FlatSerializer
- type IDPool
- type IndexHandlerImpl
- func (ihi *IndexHandlerImpl) DeleteFromIndex(writeCtx interface{}, bat *batch.Batch) error
- func (ihi *IndexHandlerImpl) DeleteFromTable(writeCtx interface{}, bat *batch.Batch) error
- func (ihi *IndexHandlerImpl) DumpReadFromIndex(readCtx interface{}) (*batch.Batch, int, error)
- func (ihi *IndexHandlerImpl) ReadFromIndex(readCtx interface{}) (*batch.Batch, int, error)
- func (ihi *IndexHandlerImpl) UpdateIntoIndex(writeCtx interface{}, bat *batch.Batch) error
- func (ihi *IndexHandlerImpl) WriteIntoIndex(writeCtx interface{}, bat *batch.Batch) error
- func (ihi *IndexHandlerImpl) WriteIntoTable(table *descriptor.RelationDesc, writeCtx interface{}, bat *batch.Batch) error
- type KVHandler
- type KVType
- type MemoryItem
- type MemoryKV
- func (m *MemoryKV) DedupSet(key TupleKey, value TupleValue) error
- func (m *MemoryKV) DedupSetBatch(keys []TupleKey, values []TupleValue) error
- func (m *MemoryKV) Delete(key TupleKey) error
- func (m *MemoryKV) DeleteWithPrefix(prefix TupleKey) error
- func (m *MemoryKV) Get(key TupleKey) (TupleValue, error)
- func (m *MemoryKV) GetBatch(keys []TupleKey) ([]TupleValue, error)
- func (m *MemoryKV) GetKVType() KVType
- func (m *MemoryKV) GetRange(startKey TupleKey, endKey TupleKey) ([]TupleValue, error)
- func (m *MemoryKV) GetRangeWithLimit(startKey TupleKey, endKey TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (m *MemoryKV) GetRangeWithPrefixLimit(startKey TupleKey, endKey TupleKey, prefix TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (m *MemoryKV) GetShardsWithPrefix(prefix TupleKey) (interface{}, error)
- func (m *MemoryKV) GetShardsWithRange(startKey TupleKey, endKey TupleKey) (interface{}, error)
- func (m *MemoryKV) GetWithPrefix(prefixOrStartkey TupleKey, prefixLen int, prefixEnd []byte, needKeyOnly bool, ...) ([]TupleKey, []TupleValue, bool, TupleKey, error)
- func (m *MemoryKV) NextID(typ string) (uint64, error)
- func (m *MemoryKV) PrintKeys()
- func (m *MemoryKV) Set(key TupleKey, value TupleValue) error
- func (m *MemoryKV) SetBatch(keys []TupleKey, values []TupleValue) error
- type ParallelReaderContext
- type Range
- type ReadContext
- type RowColumnConverter
- type RowColumnConverterImpl
- func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexKey(index *descriptor.IndexDesc, columnGroupID uint64, ...) error
- func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexKeyValue(index *descriptor.IndexDesc, columnGroupID uint64, ...) error
- func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexValue(index *descriptor.IndexDesc, columnGroupID uint64, ...) error
- func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexValue2(index *descriptor.IndexDesc, columnGroupID uint64, ...) error
- func (tbi *RowColumnConverterImpl) GetTupleFromBatch(bat *batch.Batch, rowID int) (Tuple, error)
- func (tbi *RowColumnConverterImpl) GetTuplesFromBatch(bat *batch.Batch) (Tuples, error)
- type SerializerType
- type ShardInfo
- type ShardNode
- type Shards
- type SingleReaderContext
- type Tuple
- type TupleBatchImpl
- func (tbi *TupleBatchImpl) GetAttribute(colIdx uint32) (types.Type, string, error)
- func (tbi *TupleBatchImpl) GetAttributeCount() (uint32, error)
- func (tbi *TupleBatchImpl) GetInt(colIdx uint32) (int, error)
- func (tbi *TupleBatchImpl) GetValue(colIdx uint32) (interface{}, error)
- func (tbi *TupleBatchImpl) IsNull(colIdx uint32) (bool, error)
- type TupleCodecHandler
- type TupleKey
- type TupleKeyDecoder
- func (tkd *TupleKeyDecoder) DecodeDatabasePrefix(key TupleKey) (TupleKey, *orderedcodec.DecodedItem, error)
- func (tkd *TupleKeyDecoder) DecodeIndexPrefix(key TupleKey) (TupleKey, []*orderedcodec.DecodedItem, error)
- func (tkd *TupleKeyDecoder) DecodePrimaryIndexKey(key TupleKey, index *descriptor.IndexDesc) (TupleKey, []*orderedcodec.DecodedItem, error)
- func (tkd *TupleKeyDecoder) DecodePrimaryIndexValue(value TupleValue, index *descriptor.IndexDesc, columnGroupID uint64, ...) (TupleValue, []*orderedcodec.DecodedItem, error)
- func (tkd *TupleKeyDecoder) DecodeTablePrefix(key TupleKey) (TupleKey, []*orderedcodec.DecodedItem, error)
- func (tkd *TupleKeyDecoder) GetTenantPrefix() TupleKey
- func (tkd *TupleKeyDecoder) SkipTenantPrefix(key TupleKey) (TupleKey, error)
- type TupleKeyEncoder
- func (tke *TupleKeyEncoder) EncodeDatabasePrefix(prefix TupleKey, dbID uint64) (TupleKey, *orderedcodec.EncodedItem)
- func (tke *TupleKeyEncoder) EncodeIndexPrefix(prefix TupleKey, dbID uint64, tableID, indexID uint64) (TupleKey, *orderedcodec.EncodedItem)
- func (tke *TupleKeyEncoder) EncodePrimaryIndexKey(prefix TupleKey, index *descriptor.IndexDesc, columnGroupID uint64, ...) (TupleKey, *orderedcodec.EncodedItem, error)
- func (tke *TupleKeyEncoder) EncodePrimaryIndexValue(prefix TupleValue, index *descriptor.IndexDesc, columnGroupID uint64, ...) (TupleValue, *orderedcodec.EncodedItem, error)
- func (tke *TupleKeyEncoder) EncodeTablePrefix(prefix TupleKey, dbID uint64, tableID uint64) (TupleKey, *orderedcodec.EncodedItem)
- func (tke *TupleKeyEncoder) EncodeTenantPrefix(prefix TupleKey, tenantID uint64) (TupleKey, *orderedcodec.EncodedItem)
- func (tke *TupleKeyEncoder) GetTenantPrefix() TupleKey
- type TupleValue
- type Tuples
- type ValueDecodedItem
- type ValueLayoutContext
- type ValueLayoutSerializer
- type ValueSerializer
- type WriteContext
Constants ¶
const ( DATABASE_ID = "database_id" TABLE_ID = "table_id" )
const ( SystemTenantID uint64 = 1 //holding the schema of the descriptor table InternalDatabaseID uint64 = 0 //holding the schema of the table InternalDescriptorTableID uint64 = 0 InternalDescriptorTable_parentID_ID = 0 InternalDescriptorTable_id_ID = 1 InternalDescriptorTable_name_ID = 2 InternalDescriptorTable_desc_ID = 3 PrimaryIndexID uint32 = 1 //holding the epochgced table InternalAsyncGCTableID uint64 = 1 InternalAsyncGCTable_epoch_ID = 0 InternalAsyncGCTable_dbID_ID = 1 InternalAsyncGCTable_tableID_ID = 2 InternalAsyncGCTable_desc_ID = 3 //user table id offset UserTableIDOffset uint64 = 3 )
const ( INT64 = "int64" UINT64 = "uint64" FLOAT64 = "FLOAT64" STRING = "string" TYPE_DATE = "types.Date" TYPE_DATETIME = "types.Datetime" )
const ( SERIAL_TYPE_NULL byte = 0 SERIAL_TYPE_STRING byte = SERIAL_TYPE_NULL + 1 SERIAL_TYPE_BYTES byte = SERIAL_TYPE_STRING + 1 SERIAL_TYPE_BOOL byte = SERIAL_TYPE_BYTES + 1 SERIAL_TYPE_INT8 byte = SERIAL_TYPE_BOOL + 1 SERIAL_TYPE_INT16 byte = SERIAL_TYPE_INT8 + 1 SERIAL_TYPE_INT32 byte = SERIAL_TYPE_INT16 + 1 SERIAL_TYPE_INT64 byte = SERIAL_TYPE_INT32 + 1 SERIAL_TYPE_UINT8 byte = SERIAL_TYPE_INT64 + 1 SERIAL_TYPE_UINT16 byte = SERIAL_TYPE_UINT8 + 1 SERIAL_TYPE_UINT32 byte = SERIAL_TYPE_UINT16 + 1 SERIAL_TYPE_UINT64 byte = SERIAL_TYPE_UINT32 + 1 SERIAL_TYPE_FLOAT32 byte = SERIAL_TYPE_UINT64 + 1 SERIAL_TYPE_FLOAT64 byte = SERIAL_TYPE_FLOAT32 + 1 SERIAL_TYPE_DATE byte = SERIAL_TYPE_FLOAT64 + 1 SERIAL_TYPE_DATETIME byte = SERIAL_TYPE_DATE + 1 SERIAL_TYPE_UNKNOWN byte = 255 )
Variables ¶
var ( InternalDatabaseDesc = &descriptor.DatabaseDesc{ ID: uint32(InternalDatabaseID), Name: "system", Update_time: 0, Create_epoch: math.MaxUint64, Is_deleted: false, Drop_epoch: 0, } InternalDescriptorTableDesc = &descriptor.RelationDesc{ ID: uint32(InternalDescriptorTableID), Name: "descriptor", Update_time: 0, Next_attribute_id: 4, Attributes: []descriptor.AttributeDesc{ { ID: 0, Name: "parentID", Ttype: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), Is_null: false, Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: true, Comment: "the parent ID of the table and database", }, { ID: 1, Name: "ID", Ttype: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), Is_null: false, Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: true, Comment: "the ID of the table and the database", }, { ID: 2, Name: "Name", Ttype: orderedcodec.VALUE_TYPE_STRING, TypesType: toTypesType(types.T_varchar), Is_null: false, Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: false, Comment: "the name of the table and the database", }, { ID: 3, Name: "desc", Ttype: orderedcodec.VALUE_TYPE_BYTES, TypesType: toTypesType(types.T_varchar), Is_null: false, Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: false, Comment: "the serialized bytes of the descriptor of the table and the database", }, }, IDependsOnRelations: nil, RelationsDependsOnMe: nil, Next_attribute_group_id: 0, AttributeGroups: nil, Primary_index: descriptor.IndexDesc{ Name: "primary", ID: PrimaryIndexID, Is_unique: true, Attributes: []descriptor.IndexDesc_Attribute{ { Name: "parentID", ID: 0, Type: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), }, { Name: "ID", ID: 1, Type: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), }, }, }, Next_index_id: 2, Indexes: nil, Create_sql: "hard code", Create_time: 0, Drop_time: 0, Create_epoch: math.MaxUint64, Is_deleted: false, Drop_epoch: 0, Max_access_epoch: 0, Table_options: nil, Partition_options: nil, } InternalAsyncGCTableDesc = &descriptor.RelationDesc{ ID: uint32(InternalAsyncGCTableID), Name: "asyncgc", Update_time: 0, Next_attribute_id: 0, Attributes: []descriptor.AttributeDesc{ { ID: 0, Name: "epoch", Ttype: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), Is_null: false, Default_value: "", Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: true, Comment: "epoch when the delete happens", References: nil, Constrains: nil, }, { ID: 1, Name: "dbID", Ttype: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), Is_null: false, Default_value: "", Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: true, Comment: "the dbID that the table belongs to", References: nil, Constrains: nil, }, { ID: 2, Name: "tableID", Ttype: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), Is_null: false, Default_value: "the tableID to be dropped", Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: true, Comment: "", References: nil, Constrains: nil, }, { ID: 3, Name: "desc", Ttype: orderedcodec.VALUE_TYPE_BYTES, TypesType: toTypesType(types.T_varchar), Default: engine.DefaultExpr{}, Is_null: false, Default_value: "", Is_hidden: false, Is_auto_increment: false, Is_unique: false, Is_primarykey: false, Comment: "the descriptor of the table dropped", References: nil, Constrains: nil, }, }, IDependsOnRelations: nil, RelationsDependsOnMe: nil, Next_attribute_group_id: 0, AttributeGroups: nil, Primary_index: descriptor.IndexDesc{ Name: "primary", ID: PrimaryIndexID, Is_unique: true, Attributes: []descriptor.IndexDesc_Attribute{ { Name: "epoch", ID: 0, Type: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), }, { Name: "dbID", ID: 1, Type: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), }, { Name: "tableID", ID: 2, Type: orderedcodec.VALUE_TYPE_UINT64, TypesType: toTypesType(types.T_uint64), }, }, Impilict_attributes: nil, Composite_attributes: nil, Store_attributes: nil, Key_encoding_type: 0, Value_encoding_type: 0, }, Next_index_id: 0, Indexes: nil, Create_sql: "", Create_time: 0, Drop_time: 0, Create_epoch: math.MaxUint64, Is_deleted: false, Drop_epoch: 0, Max_access_epoch: 0, Table_options: nil, Partition_options: nil, } )
var ES errorStorage
var (
ErrorIsNotShards = errors.New("it is not the shards")
)
Functions ¶
func BeginCpuProfile ¶
func ConvertAttributeDescIntoTypesType ¶
func ConvertAttributeDescIntoTypesType(attrs []*descriptor.AttributeDesc) ([]string, []*engine.AttributeDef)
func EndCpuProfile ¶
func EngineTypeToTpeType ¶
func EngineTypeToTpeType(t *types.Type) orderedcodec.ValueType
func GetDeleteFlag ¶
judge the operation is delete or insert, true for delete, false for insert
func InitColIndex ¶
func InitColIndex(indexWriteCtx *WriteContext, bat *batch.Batch)
func IsValid ¶
IsValid check the Range is valid or not. It is different the IsValid above. IsValid here can accept the nil for the startKey and endKey
func MakeAttributes ¶
func MakeAttributes(ts ...types.T) ([]string, []*engine.AttributeDef)
func MarshalDatabaseDesc ¶
func MarshalDatabaseDesc(desc *descriptor.DatabaseDesc) ([]byte, error)
MarshalDatabaseDesc encods the relationDesc into the bytes
func MarshalRelationDesc ¶
func MarshalRelationDesc(desc *descriptor.RelationDesc) ([]byte, error)
MarshalRelationDesc encods the relationDesc into the bytes
func ParseFloat ¶
func ParseInterge ¶
func SerializeVectorForBatch ¶
func TpeTypeToEngineType ¶
func TpeTypeToEngineType(Ttype orderedcodec.ValueType) types.Type
func TruncateBatch ¶
func Uint64ToString ¶
func UnmarshalDatabaseDesc ¶
func UnmarshalDatabaseDesc(data []byte) (*descriptor.DatabaseDesc, error)
UnmarshalDatabaseDesc decodes the bytes into the databaseDesc
func UnmarshalRelationDesc ¶
func UnmarshalRelationDesc(data []byte) (*descriptor.RelationDesc, error)
UnmarshalRelationDesc decodes the bytes into the relationDesc
Types ¶
type AttributeMap ¶
type AttributeMap struct {
// contains filtered or unexported fields
}
func (*AttributeMap) Append ¶
func (am *AttributeMap) Append(id, positionInValue, positionInBatch int)
func (*AttributeMap) BuildPositionInDecodedItemArray ¶
func (am *AttributeMap) BuildPositionInDecodedItemArray()
func (*AttributeMap) GetAttributeAtSortedIndex ¶
func (am *AttributeMap) GetAttributeAtSortedIndex(i int) int
func (*AttributeMap) Length ¶
func (am *AttributeMap) Length() int
type AttributeStateForWrite ¶
type AttributeStateForWrite struct {
PositionInBatch int
//true - the attribute value should be generated.
//false - the attribute value got from the batch.
NeedGenerated bool
AttrDesc descriptor.AttributeDesc
//the value for the attribute especially for
//the implicit primary key
ImplicitPrimaryKey interface{}
}
type BatchAdapter ¶
type BatchAdapter struct {
// contains filtered or unexported fields
}
BatchAdapter for convenient access to the batch
func NewBatchAdapter ¶
func NewBatchAdapter(bat *batch.Batch) *BatchAdapter
func (*BatchAdapter) ForEachTuple ¶
func (ba *BatchAdapter) ForEachTuple(callbackCtx interface{}, callback func(callbackCtx interface{}, tuple Tuple) error) error
ForEachTuple process every row with callback function in the batch
type CompactValueLayoutSerializer ¶
type CompactValueLayoutSerializer struct {
Serializer ValueSerializer
// contains filtered or unexported fields
}
CompactValueLayoutSerializer defines a compact layout of the value
The Layout of the value: | The Control Byte(first byte) | The Column Group (option) | The Attributes Storage Section | | | Attributes Offset Section | Attributes Section | | The count of Attributes | Attribute Offset Array | Attribute 1 Format, Attribute 2 Format,.... | | Attribute 1 offset, Attribute 2 offset,...|
The layout of the Attribute X Format: | The Value Type(first byte) | Attribute X's ID (option) | The serialized bytes of the Attribute X |
Control Byte : bit7:0-primary index;1-secondary index。 bit6: 0-no column group; 1-has column group。 bit5: 0-The Attribute X Format does not have Attribute ID;1-The Attribute X Format has Attribute ID bit4~bit3 : used in secondary index bit0~bit2: the offset of the Attributes Offset Section
func (*CompactValueLayoutSerializer) Deserialize ¶
func (cvls *CompactValueLayoutSerializer) Deserialize(data []byte, amForValue *AttributeMap) ([]byte, []*orderedcodec.DecodedItem, []*ValueDecodedItem, error)
func (*CompactValueLayoutSerializer) GetPositionsOfAttributesInTheValue ¶
func (cvls *CompactValueLayoutSerializer) GetPositionsOfAttributesInTheValue(tableDesc *descriptor.RelationDesc, indexDesc *descriptor.IndexDesc) map[uint32]int
func (*CompactValueLayoutSerializer) Serialize ¶
func (cvls *CompactValueLayoutSerializer) Serialize(out []byte, ctx *ValueLayoutContext) ([]byte, error)
Serialize serializes the tuple Now we just consider the primary index
type ComputationHandlerImpl ¶
type ComputationHandlerImpl struct {
// contains filtered or unexported fields
}
func NewComputationHandlerImpl ¶
func NewComputationHandlerImpl(dh descriptor.DescriptorHandler, kv KVHandler, tch *TupleCodecHandler, serial ValueSerializer, ih index.IndexHandler, epoch *EpochHandler, parallelReader bool, multiNode bool) *ComputationHandlerImpl
func (*ComputationHandlerImpl) CreateDatabase ¶
func (*ComputationHandlerImpl) CreateTable ¶
func (chi *ComputationHandlerImpl) CreateTable(epoch, dbId uint64, tableDesc *descriptor.RelationDesc) (uint64, error)
func (*ComputationHandlerImpl) DropDatabase ¶
func (chi *ComputationHandlerImpl) DropDatabase(epoch uint64, dbName string) error
func (*ComputationHandlerImpl) DropTable ¶
func (chi *ComputationHandlerImpl) DropTable(epoch, dbId uint64, tableName string) (uint64, error)
func (*ComputationHandlerImpl) DropTableByDesc ¶
func (chi *ComputationHandlerImpl) DropTableByDesc(epoch, dbId uint64, tableDesc *descriptor.RelationDesc) (uint64, error)
func (*ComputationHandlerImpl) GetDatabase ¶
func (chi *ComputationHandlerImpl) GetDatabase(dbName string) (*descriptor.DatabaseDesc, error)
func (*ComputationHandlerImpl) GetNodesHoldTheTable ¶
func (chi *ComputationHandlerImpl) GetNodesHoldTheTable(dbId uint64, desc *descriptor.RelationDesc) (engine.Nodes, interface{}, error)
func (*ComputationHandlerImpl) GetTable ¶
func (chi *ComputationHandlerImpl) GetTable(dbId uint64, name string) (*descriptor.RelationDesc, error)
func (*ComputationHandlerImpl) ListDatabases ¶
func (chi *ComputationHandlerImpl) ListDatabases() ([]*descriptor.DatabaseDesc, error)
func (*ComputationHandlerImpl) ListTables ¶
func (chi *ComputationHandlerImpl) ListTables(dbId uint64) ([]*descriptor.RelationDesc, error)
func (*ComputationHandlerImpl) MultiNode ¶
func (chi *ComputationHandlerImpl) MultiNode() bool
func (*ComputationHandlerImpl) ParallelReader ¶
func (chi *ComputationHandlerImpl) ParallelReader() bool
func (*ComputationHandlerImpl) Read ¶
func (chi *ComputationHandlerImpl) Read(readCtx interface{}) (*batch.Batch, error)
func (*ComputationHandlerImpl) RemoveDeletedTable ¶
func (chi *ComputationHandlerImpl) RemoveDeletedTable(epoch uint64) (int, error)
type ConciseSerializer ¶
type ConciseSerializer struct {
}
func (*ConciseSerializer) DeserializeValue ¶
func (cs *ConciseSerializer) DeserializeValue(data []byte) ([]byte, *orderedcodec.DecodedItem, error)
func (*ConciseSerializer) SerializeValue ¶
func (cs *ConciseSerializer) SerializeValue(data []byte, value interface{}) ([]byte, *orderedcodec.EncodedItem, error)
type CubeKV ¶
type CubeKV struct {
Cube driver.CubeDriver
// contains filtered or unexported fields
}
func (*CubeKV) DedupSetBatch ¶
func (ck *CubeKV) DedupSetBatch(keys []TupleKey, values []TupleValue) error
func (*CubeKV) DeleteWithPrefix ¶
func (*CubeKV) Get ¶
func (ck *CubeKV) Get(key TupleKey) (TupleValue, error)
Get gets the value of the key. If the key does not exist, it returns the null
func (*CubeKV) GetRange ¶
func (ck *CubeKV) GetRange(startKey TupleKey, endKey TupleKey) ([]TupleValue, error)
func (*CubeKV) GetRangeWithLimit ¶
func (*CubeKV) GetRangeWithPrefixLimit ¶
func (*CubeKV) GetShardsWithPrefix ¶
func (*CubeKV) GetShardsWithRange ¶
func (*CubeKV) GetWithPrefix ¶
type CubeShards ¶
func (CubeShards) String ¶
func (cs CubeShards) String() string
type DefaultValue ¶
type DefaultValue struct {
ValueType string `json:"value_type"`
Value interface{} `json:"value,string"`
}
type DefaultValueLayoutSerializer ¶
type DefaultValueLayoutSerializer struct {
Serializer ValueSerializer
}
DefaultValueLayoutSerializer defines a default layout of the value
The Layout of the value:
The attributes in the value keep the same order as they defined in the relation.
| Attribute1,Attribute2,... |
func (*DefaultValueLayoutSerializer) Deserialize ¶
func (dvls *DefaultValueLayoutSerializer) Deserialize(data []byte, amForValue *AttributeMap) ([]byte, []*orderedcodec.DecodedItem, []*ValueDecodedItem, error)
func (*DefaultValueLayoutSerializer) GetPositionsOfAttributesInTheValue ¶
func (dvls *DefaultValueLayoutSerializer) GetPositionsOfAttributesInTheValue(tableDesc *descriptor.RelationDesc, indexDesc *descriptor.IndexDesc) map[uint32]int
func (*DefaultValueLayoutSerializer) Serialize ¶
func (dvls *DefaultValueLayoutSerializer) Serialize(out []byte, ctx *ValueLayoutContext) ([]byte, error)
type DefaultValueSerializer ¶
type DefaultValueSerializer struct{}
func (*DefaultValueSerializer) DeserializeValue ¶
func (dvs *DefaultValueSerializer) DeserializeValue(data []byte) ([]byte, *orderedcodec.DecodedItem, error)
DeserializeValue deserializes the data
func (*DefaultValueSerializer) SerializeValue ¶
func (dvs *DefaultValueSerializer) SerializeValue(data []byte, value interface{}) ([]byte, *orderedcodec.EncodedItem, error)
SerializeValue serializes the value with json
type DescriptorHandlerImpl ¶
type DescriptorHandlerImpl struct {
// contains filtered or unexported fields
}
func NewDescriptorHandlerImpl ¶
func NewDescriptorHandlerImpl(codec *TupleCodecHandler, kv KVHandler, vs ValueSerializer, limit uint64) *DescriptorHandlerImpl
func (*DescriptorHandlerImpl) DeleteDatabaseDescByID ¶
func (dhi *DescriptorHandlerImpl) DeleteDatabaseDescByID(dbID uint64) error
func (*DescriptorHandlerImpl) DeleteRelationDescByID ¶
func (dhi *DescriptorHandlerImpl) DeleteRelationDescByID(parentID uint64, tableID uint64) error
func (*DescriptorHandlerImpl) GetValuesWithPrefix ¶
func (dhi *DescriptorHandlerImpl) GetValuesWithPrefix(parentID uint64, callbackCtx interface{}, callback func(callbackCtx interface{}, dis []*orderedcodec.DecodedItem) ([]byte, error)) ([]byte, error)
getValueByName gets the value for the key by the name
func (*DescriptorHandlerImpl) ListRelationDescFromAsyncGC ¶
func (dhi *DescriptorHandlerImpl) ListRelationDescFromAsyncGC(epoch uint64) ([]descriptor.EpochGCItem, error)
func (*DescriptorHandlerImpl) LoadDatabaseDescByID ¶
func (dhi *DescriptorHandlerImpl) LoadDatabaseDescByID(dbID uint64) (*descriptor.DatabaseDesc, error)
func (*DescriptorHandlerImpl) LoadDatabaseDescByName ¶
func (dhi *DescriptorHandlerImpl) LoadDatabaseDescByName(name string) (*descriptor.DatabaseDesc, error)
func (*DescriptorHandlerImpl) LoadRelationDescByID ¶
func (dhi *DescriptorHandlerImpl) LoadRelationDescByID(parentID uint64, tableID uint64) (*descriptor.RelationDesc, error)
func (*DescriptorHandlerImpl) LoadRelationDescByName ¶
func (dhi *DescriptorHandlerImpl) LoadRelationDescByName(parentID uint64, name string) (*descriptor.RelationDesc, error)
func (*DescriptorHandlerImpl) MakePrefixWithEpochAndDBIDAndTableID ¶
func (dhi *DescriptorHandlerImpl) MakePrefixWithEpochAndDBIDAndTableID( dbID uint64, tableID uint64, indexID uint64, gcEpoch uint64, gcDbID uint64, gcTableID uint64) (TupleKey, *orderedcodec.EncodedItem)
MakePrefixWithEpochAndDBIDAndTableID makes the prefix(tenantID,dbID,tableID,indexID,delEpoch,delDbID,delTableID)
func (*DescriptorHandlerImpl) MakePrefixWithOneExtraID ¶
func (dhi *DescriptorHandlerImpl) MakePrefixWithOneExtraID(dbID uint64, tableID uint64, indexID uint64, extraID uint64) ([]byte, *orderedcodec.EncodedItem)
MakePrefixWithParentID makes the prefix(tenantID,dbID,tableID,indexID,parentID)
func (*DescriptorHandlerImpl) StoreDatabaseDescByID ¶
func (dhi *DescriptorHandlerImpl) StoreDatabaseDescByID(dbID uint64, dbDesc *descriptor.DatabaseDesc) error
StoreDatabaseDescByID saves the descriptor. It will overwrite the exists one.
func (*DescriptorHandlerImpl) StoreDatabaseDescByName ¶
func (dhi *DescriptorHandlerImpl) StoreDatabaseDescByName(name string, dbDesc *descriptor.DatabaseDesc) error
func (*DescriptorHandlerImpl) StoreRelationDescByID ¶
func (dhi *DescriptorHandlerImpl) StoreRelationDescByID(parentID uint64, tableID uint64, tableDesc *descriptor.RelationDesc) error
StoreRelationDescByID saves the descriptor. It will overwrite the exists one.
func (*DescriptorHandlerImpl) StoreRelationDescByName ¶
func (dhi *DescriptorHandlerImpl) StoreRelationDescByName(parentID uint64, name string, tableDesc *descriptor.RelationDesc) error
func (*DescriptorHandlerImpl) StoreRelationDescIntoAsyncGC ¶
func (dhi *DescriptorHandlerImpl) StoreRelationDescIntoAsyncGC(epoch uint64, dbID uint64, desc *descriptor.RelationDesc) error
type EpochHandler ¶
type EpochHandler struct {
// contains filtered or unexported fields
}
func NewEpochHandler ¶
func NewEpochHandler(tch *TupleCodecHandler, dh descriptor.DescriptorHandler, kv KVHandler) *EpochHandler
func (*EpochHandler) GetEpoch ¶
func (eh *EpochHandler) GetEpoch() uint64
func (*EpochHandler) RemoveDeletedTable ¶
func (eh *EpochHandler) RemoveDeletedTable(epoch uint64) (int, error)
func (*EpochHandler) SetEpoch ¶
func (eh *EpochHandler) SetEpoch(e uint64)
type FlatSerializer ¶
type FlatSerializer struct {
}
func (*FlatSerializer) DeserializeValue ¶
func (fs *FlatSerializer) DeserializeValue(data []byte) ([]byte, *orderedcodec.DecodedItem, error)
func (*FlatSerializer) SerializeValue ¶
func (fs *FlatSerializer) SerializeValue(data []byte, value interface{}) ([]byte, *orderedcodec.EncodedItem, error)
type IndexHandlerImpl ¶
func NewIndexHandlerImpl ¶
func NewIndexHandlerImpl(tch *TupleCodecHandler, db *descriptor.DatabaseDesc, kv KVHandler, kvLimit uint64, serial ValueSerializer, vls ValueLayoutSerializer, rcc RowColumnConverter) *IndexHandlerImpl
func (*IndexHandlerImpl) DeleteFromIndex ¶
func (ihi *IndexHandlerImpl) DeleteFromIndex(writeCtx interface{}, bat *batch.Batch) error
func (*IndexHandlerImpl) DeleteFromTable ¶
func (ihi *IndexHandlerImpl) DeleteFromTable(writeCtx interface{}, bat *batch.Batch) error
func (*IndexHandlerImpl) DumpReadFromIndex ¶
func (ihi *IndexHandlerImpl) DumpReadFromIndex(readCtx interface{}) (*batch.Batch, int, error)
func (*IndexHandlerImpl) ReadFromIndex ¶
func (ihi *IndexHandlerImpl) ReadFromIndex(readCtx interface{}) (*batch.Batch, int, error)
func (*IndexHandlerImpl) UpdateIntoIndex ¶
func (ihi *IndexHandlerImpl) UpdateIntoIndex(writeCtx interface{}, bat *batch.Batch) error
func (*IndexHandlerImpl) WriteIntoIndex ¶
func (ihi *IndexHandlerImpl) WriteIntoIndex(writeCtx interface{}, bat *batch.Batch) error
func (*IndexHandlerImpl) WriteIntoTable ¶
func (ihi *IndexHandlerImpl) WriteIntoTable(table *descriptor.RelationDesc, writeCtx interface{}, bat *batch.Batch) error
type KVHandler ¶
type KVHandler interface {
GetKVType() KVType
// NextID gets the next id of the type
NextID(typ string) (uint64, error)
// Set writes the key-value (overwrite)
Set(key TupleKey, value TupleValue) error
// SetBatch writes the batch of key-value (overwrite)
SetBatch(keys []TupleKey, values []TupleValue) error
// DedupSet writes the key-value. It will fail if the key exists
DedupSet(key TupleKey, value TupleValue) error
// DedupSetBatch writes the batch of keys-values. It will fail if there is one key exists
DedupSetBatch(keys []TupleKey, values []TupleValue) error
// Delete deletes the key
Delete(key TupleKey) error
// DeleteWithPrefix keys with the prefix
DeleteWithPrefix(prefix TupleKey) error
// Get gets the value of the key
Get(key TupleKey) (TupleValue, error)
// GetBatch gets the values of the keys
GetBatch(keys []TupleKey) ([]TupleValue, error)
// GetRange gets the values among the range [startKey,endKey).
GetRange(startKey TupleKey, endKey TupleKey) ([]TupleValue, error)
// GetRangeWithLimit gets the values from the startKey with limit
//return parameters:
//[][]byte : return keys
//[][]byte : return values
//bool: true - the scanner accomplished in all shards.
//[]byte : the start key for the next scan. If last parameter is false, this parameter is nil.
GetRangeWithLimit(startKey TupleKey, endKey TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
GetRangeWithPrefixLimit(startKey TupleKey, endKey TupleKey, prefix TupleKey, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
// GetWithPrefix gets the values of the prefix with limit.
// The prefixLen denotes the prefix[:prefixLen] is the real prefix.
// When we invoke GetWithPrefix several times, the prefix is the real
// prefix in the first time. But from the second time, the prefix is the
// last key in previous results of the GetWithPrefix.
//return parameters:
//[][]byte : return keys
//[][]byte : return values
//bool: true - the scanner accomplished in all shards.
//[]byte : the start key for the next scan. If last parameter is false, this parameter is nil.
GetWithPrefix(prefixOrStartkey TupleKey, prefixLen int, prefixEnd []byte, needKeyOnly bool, limit uint64) ([]TupleKey, []TupleValue, bool, TupleKey, error)
// GetShardsWithRange get the shards that holds the range [startKey,endKey)
GetShardsWithRange(startKey TupleKey, endKey TupleKey) (interface{}, error)
// GetShardsWithPrefix get the shards that holds the keys with prefix
GetShardsWithPrefix(prefix TupleKey) (interface{}, error)
}
type MemoryItem ¶
type MemoryItem struct {
// contains filtered or unexported fields
}
func NewMemoryItem ¶
func NewMemoryItem(key TupleKey, value TupleValue) *MemoryItem
type MemoryKV ¶
type MemoryKV struct {
// contains filtered or unexported fields
}
MemoryKV for test
func NewMemoryKV ¶
func NewMemoryKV() *MemoryKV
func (*MemoryKV) DedupSetBatch ¶
func (m *MemoryKV) DedupSetBatch(keys []TupleKey, values []TupleValue) error
func (*MemoryKV) DeleteWithPrefix ¶
func (*MemoryKV) GetRange ¶
func (m *MemoryKV) GetRange(startKey TupleKey, endKey TupleKey) ([]TupleValue, error)
func (*MemoryKV) GetRangeWithLimit ¶
func (*MemoryKV) GetRangeWithPrefixLimit ¶
func (*MemoryKV) GetShardsWithPrefix ¶
func (*MemoryKV) GetShardsWithRange ¶
func (*MemoryKV) GetWithPrefix ¶
type ParallelReaderContext ¶
type ParallelReaderContext struct {
ID int
//index in shard info
ShardIndex int
//the startKey of the shard
ShardStartKey []byte
//the endKey of the shard
ShardEndKey []byte
//the next scan key of the shard
ShardNextScanKey []byte
//scan end key for the shard
ShardScanEndKey []byte
//finished ?
CompleteInShard bool
ReadCnt int
CountOfWithoutPrefix int
}
for parallel readers
func (*ParallelReaderContext) Reset ¶
func (prc *ParallelReaderContext) Reset()
func (*ParallelReaderContext) Set ¶
func (prc *ParallelReaderContext) Set(id, shardIndex int)
func (*ParallelReaderContext) SetShardInfo ¶
func (prc *ParallelReaderContext) SetShardInfo(shardStartKey, shardEndKey, nextScanKeyInShard, scanEndKeyInShard []byte)
func (ParallelReaderContext) String ¶
func (prc ParallelReaderContext) String() string
type Range ¶
type Range struct {
// contains filtered or unexported fields
}
Range for [startKey, endKey)
func (Range) ContainRange ¶
Contain check the range contains the another range.
type ReadContext ¶
type ReadContext struct {
//target database,table and index
DbDesc *descriptor.DatabaseDesc
TableDesc *descriptor.RelationDesc
IndexDesc *descriptor.IndexDesc
//the attributes to be read
ReadAttributesNames []string
//the attributes for the read
ReadAttributeDescs []*descriptor.AttributeDesc
ParallelReader bool
MultiNode bool
//for test
ReadCount int
ParallelReaderContext
SingleReaderContext
DumpData bool // dumpData flag
Opt *batch.DumpOption
}
func (*ReadContext) AddReadCount ¶
func (rc *ReadContext) AddReadCount() int
type RowColumnConverter ¶
type RowColumnConverter interface {
GetTupleFromBatch(bat *batch.Batch, rowID int) (Tuple, error)
GetTuplesFromBatch(bat *batch.Batch) (Tuples, error)
//FillBatchFromDecodedIndexKey fills the batch at row i with the data from the decoded key
//the attributeID are wanted attribute.
FillBatchFromDecodedIndexKey(index *descriptor.IndexDesc,
columnGroupID uint64, attributes []*orderedcodec.DecodedItem,
am *AttributeMap, bat *batch.Batch, rowIndex int) error
//FillBatchFromDecodedIndexValue fills the batch at row i with the data from the decoded value
//the attributeID are wanted attribute.
FillBatchFromDecodedIndexValue(index *descriptor.IndexDesc,
columnGroupID uint64, attributes []*orderedcodec.DecodedItem,
am *AttributeMap, bat *batch.Batch, rowIndex int) error
FillBatchFromDecodedIndexValue2(index *descriptor.IndexDesc,
columnGroupID uint64, attributes []*ValueDecodedItem,
am *AttributeMap, bat *batch.Batch, rowIndex int) error
//FillBatchFromDecodedIndexKeyValue fills the batch at row i with the data from the decoded key and value
//the attributeID are wanted attribute.
FillBatchFromDecodedIndexKeyValue(index *descriptor.IndexDesc,
columnGroupID uint64,
keyAttributes []*orderedcodec.DecodedItem,
valueAttributes []*orderedcodec.DecodedItem,
amForKey *AttributeMap, amForValue *AttributeMap,
bat *batch.Batch, rowIndex int) error
}
type RowColumnConverterImpl ¶
type RowColumnConverterImpl struct{}
func (*RowColumnConverterImpl) FillBatchFromDecodedIndexKey ¶
func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexKey( index *descriptor.IndexDesc, columnGroupID uint64, attributes []*orderedcodec.DecodedItem, am *AttributeMap, bat *batch.Batch, rowIdx int) error
func (*RowColumnConverterImpl) FillBatchFromDecodedIndexKeyValue ¶
func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexKeyValue( index *descriptor.IndexDesc, columnGroupID uint64, keyAttributes []*orderedcodec.DecodedItem, valueAttributes []*orderedcodec.DecodedItem, amForKey *AttributeMap, amForValue *AttributeMap, bat *batch.Batch, rowIdx int) error
func (*RowColumnConverterImpl) FillBatchFromDecodedIndexValue ¶
func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexValue( index *descriptor.IndexDesc, columnGroupID uint64, attributes []*orderedcodec.DecodedItem, am *AttributeMap, bat *batch.Batch, rowIdx int) error
func (*RowColumnConverterImpl) FillBatchFromDecodedIndexValue2 ¶
func (tbi *RowColumnConverterImpl) FillBatchFromDecodedIndexValue2(index *descriptor.IndexDesc, columnGroupID uint64, attributes []*ValueDecodedItem, am *AttributeMap, bat *batch.Batch, rowIdx int) error
func (*RowColumnConverterImpl) GetTupleFromBatch ¶
func (*RowColumnConverterImpl) GetTuplesFromBatch ¶
func (tbi *RowColumnConverterImpl) GetTuplesFromBatch(bat *batch.Batch) (Tuples, error)
type SerializerType ¶
type SerializerType int
const ( ST_JSON SerializerType = iota ST_CONCISE SerializerType = iota + 1 ST_FLAT SerializerType = iota + 2 )
type ShardInfo ¶
type ShardInfo struct {
// contains filtered or unexported fields
}
func (ShardInfo) GetShardID ¶
func (ShardInfo) GetShardNode ¶
func (ShardInfo) GetStartKey ¶
func (ShardInfo) GetStatistics ¶
func (si ShardInfo) GetStatistics() metapb.ShardStats
type ShardNode ¶
type ShardNode struct {
//the address of the store of the leader replica of the shard
Addr string
//the id of the store of the leader replica of the shard
StoreID uint64
//the bytes of the id
StoreIDbytes string
//shards the node will read
Shards CubeShards
}
type Shards ¶
type Shards struct {
// contains filtered or unexported fields
}
func (Shards) GetShardInfos ¶
func (Shards) GetShardNodes ¶
func (*Shards) SetShardInfos ¶
func (*Shards) SetShardNodes ¶
type SingleReaderContext ¶
type Tuple ¶
type Tuple interface {
GetAttributeCount() (uint32, error)
GetAttribute(colIdx uint32) (types.Type, string, error)
IsNull(colIdx uint32) (bool, error)
GetValue(colIdx uint32) (interface{}, error)
GetInt(colIdx uint32) (int, error)
}
Tuple denotes the row of the relation
type TupleBatchImpl ¶
type TupleBatchImpl struct {
// contains filtered or unexported fields
}
func NewTupleBatchImpl ¶
func NewTupleBatchImpl(bat *batch.Batch, row []interface{}) *TupleBatchImpl
func (*TupleBatchImpl) GetAttribute ¶
func (*TupleBatchImpl) GetAttributeCount ¶
func (tbi *TupleBatchImpl) GetAttributeCount() (uint32, error)
func (*TupleBatchImpl) GetValue ¶
func (tbi *TupleBatchImpl) GetValue(colIdx uint32) (interface{}, error)
type TupleCodecHandler ¶
type TupleCodecHandler struct {
// contains filtered or unexported fields
}
func NewTupleCodecHandler ¶
func NewTupleCodecHandler(tenantID uint64) *TupleCodecHandler
func (*TupleCodecHandler) GetDecoder ¶
func (tch *TupleCodecHandler) GetDecoder() *TupleKeyDecoder
func (*TupleCodecHandler) GetEncoder ¶
func (tch *TupleCodecHandler) GetEncoder() *TupleKeyEncoder
type TupleKey ¶
type TupleKey []byte
func SuccessorOfKey ¶
SuccessorOfKey gets the successor of the key. Carefully, key can not be changed.
func SuccessorOfPrefix ¶
SuccessorOfPrefix gets the successor of the prefix
func (TupleKey) IsPredecessor ¶
IsPredecessor decides the is the predecessor of the another key
type TupleKeyDecoder ¶
type TupleKeyDecoder struct {
// contains filtered or unexported fields
}
func NewTupleKeyDecoder ¶
func NewTupleKeyDecoder(tenantID uint64) *TupleKeyDecoder
func (*TupleKeyDecoder) DecodeDatabasePrefix ¶
func (tkd *TupleKeyDecoder) DecodeDatabasePrefix(key TupleKey) (TupleKey, *orderedcodec.DecodedItem, error)
DecodeDatabasePrefix decodes database ID and returns the rest.
func (*TupleKeyDecoder) DecodeIndexPrefix ¶
func (tkd *TupleKeyDecoder) DecodeIndexPrefix(key TupleKey) (TupleKey, []*orderedcodec.DecodedItem, error)
DecodeIndexPrefix decodes database ID, table ID and index ID and returns the rest.
func (*TupleKeyDecoder) DecodePrimaryIndexKey ¶
func (tkd *TupleKeyDecoder) DecodePrimaryIndexKey(key TupleKey, index *descriptor.IndexDesc) (TupleKey, []*orderedcodec.DecodedItem, error)
DecodePrimaryIndexKey decodes fields of the primary index and returns the rest. The dbID,tableID and Index ID have been decoded.
func (*TupleKeyDecoder) DecodePrimaryIndexValue ¶
func (tkd *TupleKeyDecoder) DecodePrimaryIndexValue(value TupleValue, index *descriptor.IndexDesc, columnGroupID uint64, serializer ValueSerializer) (TupleValue, []*orderedcodec.DecodedItem, error)
DecodePrimaryIndexValue decodes the values of the primary index and return the rest. Now,it decodes all tuple.
func (*TupleKeyDecoder) DecodeTablePrefix ¶
func (tkd *TupleKeyDecoder) DecodeTablePrefix(key TupleKey) (TupleKey, []*orderedcodec.DecodedItem, error)
DecodeTablePrefix decodes table ID and returns the rest.
func (*TupleKeyDecoder) GetTenantPrefix ¶
func (tkd *TupleKeyDecoder) GetTenantPrefix() TupleKey
func (*TupleKeyDecoder) SkipTenantPrefix ¶
func (tkd *TupleKeyDecoder) SkipTenantPrefix(key TupleKey) (TupleKey, error)
SkipTenantPrefix skips the tenant prefix wanted and returns the rest.
type TupleKeyEncoder ¶
type TupleKeyEncoder struct {
// contains filtered or unexported fields
}
func NewTupleKeyEncoder ¶
func NewTupleKeyEncoder(tenantID uint64) *TupleKeyEncoder
func (*TupleKeyEncoder) EncodeDatabasePrefix ¶
func (tke *TupleKeyEncoder) EncodeDatabasePrefix(prefix TupleKey, dbID uint64) (TupleKey, *orderedcodec.EncodedItem)
EncodeDatabasePrefix encodes the database prefix
func (*TupleKeyEncoder) EncodeIndexPrefix ¶
func (tke *TupleKeyEncoder) EncodeIndexPrefix(prefix TupleKey, dbID uint64, tableID, indexID uint64) (TupleKey, *orderedcodec.EncodedItem)
EncodeIndexPrefix encodes the index prefix
func (*TupleKeyEncoder) EncodePrimaryIndexKey ¶
func (tke *TupleKeyEncoder) EncodePrimaryIndexKey(prefix TupleKey, index *descriptor.IndexDesc, columnGroupID uint64, tuple Tuple) (TupleKey, *orderedcodec.EncodedItem, error)
EncodePrimaryIndexKey encodes the tuple into bytes. The prefix has the tenantID,dbID,tableID,IndexID.
func (*TupleKeyEncoder) EncodePrimaryIndexValue ¶
func (tke *TupleKeyEncoder) EncodePrimaryIndexValue(prefix TupleValue, index *descriptor.IndexDesc, columnGroupID uint64, tuple Tuple, serializer ValueSerializer) (TupleValue, *orderedcodec.EncodedItem, error)
EncodePrimaryIndexValue encodes the tuple into bytes
func (*TupleKeyEncoder) EncodeTablePrefix ¶
func (tke *TupleKeyEncoder) EncodeTablePrefix(prefix TupleKey, dbID uint64, tableID uint64) (TupleKey, *orderedcodec.EncodedItem)
EncodeTablePrefix encodes the table prefix
func (*TupleKeyEncoder) EncodeTenantPrefix ¶
func (tke *TupleKeyEncoder) EncodeTenantPrefix(prefix TupleKey, tenantID uint64) (TupleKey, *orderedcodec.EncodedItem)
EncodeTenantPrefix encodes the tenant prefix
func (*TupleKeyEncoder) GetTenantPrefix ¶
func (tke *TupleKeyEncoder) GetTenantPrefix() TupleKey
type TupleValue ¶
type TupleValue []byte
type ValueDecodedItem ¶
type ValueDecodedItem struct {
OffsetInUndecodedKey int //the position in undecoded bytes
RawBytes []byte //the byte that holds the item
BytesCountInUndecodedKey int //the count of bytes in undecoded bytes
ID uint32 //the attribute id
// contains filtered or unexported fields
}
ValueDecodedItem for value deserialization
func (*ValueDecodedItem) DecodeValue ¶
func (vdi *ValueDecodedItem) DecodeValue() (*orderedcodec.DecodedItem, error)
type ValueLayoutContext ¶
type ValueLayoutContext struct {
TableDesc *descriptor.RelationDesc
IndexDesc *descriptor.IndexDesc
//write control for the attribute
AttributeStates []AttributeStateForWrite
Tuple Tuple
Fields []interface{}
ColumnGroup uint64
}
type ValueLayoutSerializer ¶
type ValueLayoutSerializer interface {
Serialize(out []byte, ctx *ValueLayoutContext) ([]byte, error)
Deserialize(data []byte, amForValue *AttributeMap) ([]byte, []*orderedcodec.DecodedItem, []*ValueDecodedItem, error)
GetPositionsOfAttributesInTheValue(tableDesc *descriptor.RelationDesc, indexDesc *descriptor.IndexDesc) map[uint32]int
}
ValueLayoutSerializer defines the layout of the value serialization
type ValueSerializer ¶
type ValueSerializer interface {
SerializeValue(data []byte, value interface{}) ([]byte, *orderedcodec.EncodedItem, error)
DeserializeValue(data []byte) ([]byte, *orderedcodec.DecodedItem, error)
}
ValueSerializer for serializing the value Stateless is better
type WriteContext ¶
type WriteContext struct {
//target database,table and index
DbDesc *descriptor.DatabaseDesc
TableDesc *descriptor.RelationDesc
IndexDesc *descriptor.IndexDesc
//write control for the attribute
AttributeStates []AttributeStateForWrite
//the attributes need to be written
BatchAttrs []descriptor.AttributeDesc
NodeID uint64
// contains filtered or unexported fields
}