github.com/matrixorigin/matrixone@v1.2.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  	"context"
    19  	"io"
    20  
    21  	"github.com/matrixorigin/matrixone/pkg/container/types"
    22  	"github.com/matrixorigin/matrixone/pkg/objectio"
    23  	apipb "github.com/matrixorigin/matrixone/pkg/pb/api"
    24  
    25  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
    26  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers"
    27  )
    28  
    29  type Relation interface {
    30  	io.Closer
    31  	ID() uint64
    32  	String() string
    33  	SimplePPString(common.PPLevel) string
    34  	GetCardinality(attr string) int64
    35  	Schema() any
    36  	AlterTable(ctx context.Context, req *apipb.AlterTableReq) error
    37  	MakeObjectIt() ObjectIt
    38  	MakeObjectItOnSnap() ObjectIt
    39  
    40  	DeleteByPhyAddrKey(key any) error
    41  	GetValueByPhyAddrKey(key any, col int) (any, bool, error)
    42  	DeleteByPhyAddrKeys(keys containers.Vector, pkVec containers.Vector) error
    43  	RangeDelete(id *common.ID, start, end uint32, dt DeleteType) error
    44  	TryDeleteByDeltaloc(id *common.ID, deltaloc objectio.Location) (ok bool, err error)
    45  	Update(id *common.ID, row uint32, col uint16, v any, isNull bool) error
    46  	GetByFilter(ctx context.Context, filter *Filter) (id *common.ID, offset uint32, err error)
    47  	GetValue(id *common.ID, row uint32, col uint16) (any, bool, error)
    48  	GetValueByFilter(ctx context.Context, filter *Filter, col int) (any, bool, error)
    49  	UpdateByFilter(ctx context.Context, filter *Filter, col uint16, v any, isNull bool) error
    50  	DeleteByFilter(ctx context.Context, filter *Filter) error
    51  
    52  	BatchDedup(col containers.Vector) error
    53  	Append(ctx context.Context, data *containers.Batch) error
    54  	AddObjsWithMetaLoc(ctx context.Context, stats containers.Vector) error
    55  
    56  	GetMeta() any
    57  	CreateObject(bool) (Object, error)
    58  	CreateNonAppendableObject(is1PC bool, opt *objectio.CreateObjOpt) (Object, error)
    59  	GetObject(id *types.Objectid) (Object, error)
    60  	SoftDeleteObject(id *types.Objectid) (err error)
    61  
    62  	GetDB() (Database, error)
    63  }
    64  
    65  type RelationIt interface {
    66  	Iterator
    67  	GetRelation() Relation
    68  }