github.com/matrixorigin/matrixone@v1.2.0/pkg/vm/engine/tae/iface/handle/object.go (about) 1 // Copyright 2021 Matrix Origin 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package handle 16 17 import ( 18 "context" 19 "io" 20 21 "github.com/matrixorigin/matrixone/pkg/common/mpool" 22 "github.com/matrixorigin/matrixone/pkg/container/types" 23 "github.com/matrixorigin/matrixone/pkg/objectio" 24 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common" 25 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers" 26 ) 27 28 type FilterOp int16 29 30 const ( 31 FilterEq FilterOp = iota 32 FilterBatchEq 33 FilterBtw 34 ) 35 36 type Filter struct { 37 Op FilterOp 38 Val any 39 } 40 41 type DeleteType int8 42 43 const ( 44 DT_Normal DeleteType = iota 45 DT_MergeCompact 46 ) 47 48 func NewEQFilter(v any) *Filter { 49 return &Filter{ 50 Op: FilterEq, 51 Val: v, 52 } 53 } 54 55 type ObjectIt interface { 56 Iterator 57 GetObject() Object 58 } 59 60 type ObjectReader interface { 61 io.Closer 62 GetID() *types.Objectid 63 IsUncommitted() bool 64 IsAppendable() bool 65 Fingerprint() *common.ID 66 // GetByFilter(filter Filter, offsetOnly bool) (map[uint64]*batch.Batch, error) 67 String() string 68 GetMeta() any 69 GetByFilter(ctx context.Context, filter *Filter, mp *mpool.MPool) (uint16, uint32, error) 70 GetColumnDataByNames(ctx context.Context, blkID uint16, attrs []string, mp *mpool.MPool) (*containers.BlockView, error) 71 GetColumnDataByIds(ctx context.Context, blkID uint16, colIdxes []int, mp *mpool.MPool) (*containers.BlockView, error) 72 GetColumnDataByName(context.Context, uint16, string, *mpool.MPool) (*containers.ColumnView, error) 73 GetColumnDataById(context.Context, uint16, int, *mpool.MPool) (*containers.ColumnView, error) 74 75 GetRelation() Relation 76 77 BatchDedup(pks containers.Vector) error 78 Prefetch(idxes []int) error 79 BlkCnt() int 80 } 81 82 type ObjectWriter interface { 83 io.Closer 84 String() string 85 Update(blk uint64, row uint32, col uint16, v any) error 86 RangeDelete(blk uint16, start, end uint32, dt DeleteType, mp *mpool.MPool) error 87 88 PushDeleteOp(filter Filter) error 89 PushUpdateOp(filter Filter, attr string, val any) error 90 91 UpdateStats(objectio.ObjectStats) error 92 UpdateDeltaLoc(blkID uint16, deltaLoc objectio.Location) error 93 } 94 95 type Object interface { 96 ObjectReader 97 ObjectWriter 98 }