github.com/matrixorigin/matrixone@v0.7.0/pkg/vm/engine/tae/iface/handle/relation.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  	"io"
    19  
    20  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
    21  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers"
    22  )
    23  
    24  type Relation interface {
    25  	io.Closer
    26  	ID() uint64
    27  	Rows() int64
    28  	String() string
    29  	SimplePPString(common.PPLevel) string
    30  	GetCardinality(attr string) int64
    31  	Schema() any
    32  	UpdateConstraint([]byte) error
    33  	MakeSegmentIt() SegmentIt
    34  	MakeBlockIt() BlockIt
    35  
    36  	DeleteByPhyAddrKey(key any) error
    37  	GetValueByPhyAddrKey(key any, col int) (any, error)
    38  	DeleteByPhyAddrKeys(keys containers.Vector) error
    39  
    40  	RangeDelete(id *common.ID, start, end uint32, dt DeleteType) error
    41  	Update(id *common.ID, row uint32, col uint16, v any) error
    42  	GetByFilter(filter *Filter) (id *common.ID, offset uint32, err error)
    43  	GetValue(id *common.ID, row uint32, col uint16) (any, error)
    44  	GetValueByFilter(filter *Filter, col int) (any, error)
    45  	UpdateByFilter(filter *Filter, col uint16, v any) error
    46  	DeleteByFilter(filter *Filter) error
    47  
    48  	BatchDedup(col containers.Vector) error
    49  	Append(data *containers.Batch) error
    50  	AddBlksWithMetaLoc(pkVecs []containers.Vector, file string, metaLcos []string, flag int32) error
    51  
    52  	GetMeta() any
    53  	CreateSegment(bool) (Segment, error)
    54  	CreateNonAppendableSegment(is1PC bool) (Segment, error)
    55  	GetSegment(id uint64) (Segment, error)
    56  	SoftDeleteSegment(id uint64) (err error)
    57  
    58  	GetDB() (Database, error)
    59  }
    60  
    61  type RelationIt interface {
    62  	Iterator
    63  	GetRelation() Relation
    64  }