github.com/matrixorigin/matrixone@v0.7.0/pkg/vm/engine/tae/txn/txnimpl/node.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 txnimpl 16 17 import ( 18 "bytes" 19 "github.com/RoaringBitmap/roaring" 20 "github.com/matrixorigin/matrixone/pkg/objectio" 21 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/buffer/base" 22 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/catalog" 23 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common" 24 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers" 25 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/txnif" 26 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/model" 27 "github.com/matrixorigin/matrixone/pkg/vm/engine/tae/tasks" 28 ) 29 30 // node corresponds to an un-appendable standalone-uncommitted block 31 // which belongs to txn's workspace. 32 type node struct { 33 *baseNode 34 //uuid string 35 } 36 37 // NewNode creates a InsertNode object with data in S3/FS. 38 func NewNode( 39 tbl *txnTable, 40 fs *objectio.ObjectFS, 41 mgr base.INodeManager, 42 sched tasks.TaskScheduler, 43 meta *catalog.BlockEntry, 44 ) *node { 45 impl := new(node) 46 impl.baseNode = newBaseNode(tbl, fs, mgr, sched, meta) 47 impl.storage.pnode = newPersistedNode(impl.baseNode) 48 impl.storage.pnode.Ref() 49 return impl 50 } 51 52 func (n *node) Close() error { 53 n.storage.pnode.close() 54 return nil 55 } 56 57 func (n *node) Append(data *containers.Batch, offset uint32) (appended uint32, err error) { 58 panic("not supported") 59 } 60 61 func (n *node) RangeDelete(start uint32, end uint32) (err error) { 62 if n.storage.pnode.deletes == nil { 63 n.storage.pnode.deletes = roaring.New() 64 } 65 n.storage.pnode.deletes.AddRange(uint64(start), uint64(end)) 66 return 67 } 68 69 func (n *node) IsRowDeleted(row uint32) bool { 70 return n.storage.pnode.deletes != nil && 71 n.storage.pnode.deletes.ContainsInt(int(row)) 72 } 73 74 func (n *node) PrintDeletes() string { 75 if n.storage.pnode.deletes == nil { 76 return "NoDeletes" 77 } 78 return n.storage.pnode.deletes.String() 79 80 } 81 82 func (n *node) GetSpace() uint32 { 83 panic("not supported ") 84 } 85 86 func (n *node) FillBlockView( 87 view *model.BlockView, 88 buffers []*bytes.Buffer, 89 colIdxes []int) (err error) { 90 //TODO:: 91 panic("not implemented yet ") 92 } 93 94 func (n *node) FillColumnView(*model.ColumnView, *bytes.Buffer) error { 95 //TODO:: 96 panic("not implemented yet ") 97 } 98 99 func (n *node) Window(start, end uint32) (*containers.Batch, error) { 100 //TODO:: 101 panic("not implemented yet ") 102 } 103 104 func (n *node) GetValue(col int, row uint32) (any, error) { 105 //TODO:: 106 panic("not implemented yet ") 107 } 108 109 func (n *node) AddApplyInfo( 110 srcOff, 111 srcLen, 112 destOff, 113 destLen uint32, 114 dbid uint64, 115 dest *common.ID) *appendInfo { 116 panic("not supported ") 117 } 118 119 func (n *node) RowsWithoutDeletes() uint32 { 120 panic("not implemented yet ") 121 } 122 123 func (n *node) LengthWithDeletes(appended, toAppend uint32) uint32 { 124 panic("not supported ") 125 } 126 127 func (n *node) OffsetWithDeletes(count uint32) uint32 { 128 panic("not supported ") 129 } 130 131 func (n *node) GetAppends() []*appendInfo { 132 panic("not supported ") 133 } 134 135 func (n *node) MakeCommand(_ uint32) (txnif.TxnCmd, error) { 136 return nil, nil 137 } 138 139 func (n *node) GetColumnDataByIds([]int, []*bytes.Buffer) (*model.BlockView, error) { 140 //TODO:: 141 panic("not implemented yet ") 142 } 143 144 func (n *node) GetColumnDataById(int, *bytes.Buffer) (*model.ColumnView, error) { 145 //TODO:: 146 panic("not implemented yet ") 147 }