github.com/matrixorigin/matrixone@v0.7.0/pkg/vm/engine/tae/txn/txnbase/store.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 txnbase
    16  
    17  import (
    18  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/common"
    19  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/containers"
    20  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/handle"
    21  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/iface/txnif"
    22  	"github.com/matrixorigin/matrixone/pkg/vm/engine/tae/logstore/entry"
    23  )
    24  
    25  var NoopStoreFactory = func() txnif.TxnStore { return new(NoopTxnStore) }
    26  
    27  type NoopTxnStore struct{}
    28  
    29  func (store *NoopTxnStore) WaitPrepared() (err error)                            { return }
    30  func (store *NoopTxnStore) GetLSN() uint64                                       { return 0 }
    31  func (store *NoopTxnStore) BindTxn(txn txnif.AsyncTxn)                           {}
    32  func (store *NoopTxnStore) Close() error                                         { return nil }
    33  func (store *NoopTxnStore) Append(dbId, id uint64, data *containers.Batch) error { return nil }
    34  func (store *NoopTxnStore) AddBlksWithMetaLoc(
    35  	dbId, tid uint64,
    36  	pks []containers.Vector,
    37  	file string,
    38  	metaLocs []string,
    39  	flag int32) error {
    40  	return nil
    41  }
    42  func (store *NoopTxnStore) PrepareRollback() error { return nil }
    43  func (store *NoopTxnStore) PrePrepare() error      { return nil }
    44  func (store *NoopTxnStore) PrepareCommit() error   { return nil }
    45  func (store *NoopTxnStore) ApplyRollback() error   { return nil }
    46  func (store *NoopTxnStore) PreApplyCommit() error  { return nil }
    47  func (store *NoopTxnStore) ApplyCommit() error     { return nil }
    48  func (store *NoopTxnStore) Apply2PCPrepare() error { return nil }
    49  
    50  func (store *NoopTxnStore) AddTxnEntry(t txnif.TxnEntryType, entry txnif.TxnEntry) {}
    51  
    52  func (store *NoopTxnStore) CreateRelation(dbId uint64, def any) (rel handle.Relation, err error) {
    53  	return
    54  }
    55  func (store *NoopTxnStore) CreateRelationWithTableId(dbId uint64, tableId uint64, def any) (rel handle.Relation, err error) {
    56  	return
    57  }
    58  func (store *NoopTxnStore) DropRelationByName(dbId uint64, name string) (rel handle.Relation, err error) {
    59  	return
    60  }
    61  func (store *NoopTxnStore) DropRelationByID(dbId uint64, id uint64) (rel handle.Relation, err error) {
    62  	return
    63  }
    64  func (store *NoopTxnStore) GetRelationByName(dbId uint64, name string) (rel handle.Relation, err error) {
    65  	return
    66  }
    67  func (store *NoopTxnStore) GetRelationByID(dbId uint64, id uint64) (rel handle.Relation, err error) {
    68  	return
    69  }
    70  
    71  func (store *NoopTxnStore) CreateDatabase(name, creatSql string) (db handle.Database, err error) {
    72  	return
    73  }
    74  func (store *NoopTxnStore) CreateDatabaseWithID(name, createSql string, id uint64) (db handle.Database, err error) {
    75  	return
    76  }
    77  func (store *NoopTxnStore) DropDatabase(name string) (db handle.Database, err error)    { return }
    78  func (store *NoopTxnStore) DropDatabaseByID(id uint64) (db handle.Database, err error)  { return }
    79  func (store *NoopTxnStore) UnsafeGetDatabase(id uint64) (db handle.Database, err error) { return }
    80  func (store *NoopTxnStore) UnsafeGetRelation(dbId, id uint64) (rel handle.Relation, err error) {
    81  	return
    82  }
    83  func (store *NoopTxnStore) GetDatabase(name string) (db handle.Database, err error)   { return }
    84  func (store *NoopTxnStore) GetDatabaseByID(id uint64) (db handle.Database, err error) { return }
    85  func (store *NoopTxnStore) DatabaseNames() (names []string)                           { return }
    86  func (store *NoopTxnStore) GetSegment(dbId uint64, id *common.ID) (seg handle.Segment, err error) {
    87  	return
    88  }
    89  
    90  func (store *NoopTxnStore) CreateSegment(dbId, tid uint64, is1PC bool) (seg handle.Segment, err error) {
    91  	return
    92  }
    93  func (store *NoopTxnStore) CreateNonAppendableSegment(dbId, tid uint64, _ bool) (seg handle.Segment, err error) {
    94  	return
    95  }
    96  func (store *NoopTxnStore) GetBlock(dbId uint64, id *common.ID) (blk handle.Block, err error) { return }
    97  func (store *NoopTxnStore) CreateBlock(uint64, uint64, uint64, bool) (blk handle.Block, err error) {
    98  	return
    99  }
   100  func (store *NoopTxnStore) CreateNonAppendableBlock(dbId uint64, id *common.ID) (blk handle.Block, err error) {
   101  	return
   102  }
   103  
   104  func (store *NoopTxnStore) CreateNonAppendableBlockWithMeta(
   105  	_ uint64,
   106  	_ *common.ID,
   107  	_ string,
   108  	_ string) (blk handle.Block, err error) {
   109  	return
   110  }
   111  
   112  func (store *NoopTxnStore) UpdateMetaLoc(dbId uint64, id *common.ID, un string) (err error)  { return }
   113  func (store *NoopTxnStore) UpdateDeltaLoc(dbId uint64, id *common.ID, un string) (err error) { return }
   114  func (store *NoopTxnStore) SoftDeleteBlock(dbId uint64, id *common.ID) (err error)           { return }
   115  func (store *NoopTxnStore) SoftDeleteSegment(dbId uint64, id *common.ID) (err error)         { return }
   116  func (store *NoopTxnStore) BatchDedup(uint64, uint64, containers.Vector) (err error)         { return }
   117  func (store *NoopTxnStore) Update(uint64, *common.ID, uint32, uint16, any) (err error) {
   118  	return
   119  }
   120  func (store *NoopTxnStore) RangeDelete(uint64, *common.ID, uint32, uint32, handle.DeleteType) (err error) {
   121  	return
   122  }
   123  func (store *NoopTxnStore) GetByFilter(uint64, uint64, *handle.Filter) (id *common.ID, offset uint32, err error) {
   124  	return
   125  }
   126  func (store *NoopTxnStore) GetValue(uint64, *common.ID, uint32, uint16) (v any, err error) {
   127  	return
   128  }
   129  
   130  func (store *NoopTxnStore) LogSegmentID(dbId, tid, sid uint64) {}
   131  func (store *NoopTxnStore) LogBlockID(dbId, tid, bid uint64)   {}
   132  func (store *NoopTxnStore) LogTxnEntry(dbId, tableId uint64, entry txnif.TxnEntry, readed []*common.ID) (err error) {
   133  	return
   134  }
   135  func (store *NoopTxnStore) LogTxnState(sync bool) (logEntry entry.Entry, err error) {
   136  	return
   137  }
   138  
   139  func (store *NoopTxnStore) IsReadonly() bool      { return false }
   140  func (store *NoopTxnStore) IncreateWriteCnt() int { return 0 }
   141  
   142  func (store *NoopTxnStore) HasAnyTableDataChanges() bool                  { return false }
   143  func (store *NoopTxnStore) GetDirty() *common.Tree                        { return nil }
   144  func (store *NoopTxnStore) HasTableDataChanges(id uint64) bool            { return false }
   145  func (store *NoopTxnStore) GetDirtyTableByID(id uint64) *common.TableTree { return nil }
   146  func (store *NoopTxnStore) HasCatalogChanges() bool                       { return false }