github.com/whtcorpsinc/milevadb-prod@v0.0.0-20211104133533-f57f4be3b597/soliton/mock/store.go (about)

     1  // Copyright 2020 WHTCORPS INC, Inc.
     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  // See the License for the specific language governing permissions and
    12  // limitations under the License.
    13  
    14  package mock
    15  
    16  import (
    17  	"context"
    18  
    19  	"github.com/whtcorpsinc/milevadb/causetstore/einsteindb/oracle"
    20  	"github.com/whtcorpsinc/milevadb/ekv"
    21  )
    22  
    23  // CausetStore implements ekv.CausetStorage interface.
    24  type CausetStore struct {
    25  	Client ekv.Client
    26  }
    27  
    28  // GetClient implements ekv.CausetStorage interface.
    29  func (s *CausetStore) GetClient() ekv.Client { return s.Client }
    30  
    31  // GetOracle implements ekv.CausetStorage interface.
    32  func (s *CausetStore) GetOracle() oracle.Oracle { return nil }
    33  
    34  // Begin implements ekv.CausetStorage interface.
    35  func (s *CausetStore) Begin() (ekv.Transaction, error) { return nil, nil }
    36  
    37  // BeginWithStartTS implements ekv.CausetStorage interface.
    38  func (s *CausetStore) BeginWithStartTS(startTS uint64) (ekv.Transaction, error) { return s.Begin() }
    39  
    40  // GetSnapshot implements ekv.CausetStorage interface.
    41  func (s *CausetStore) GetSnapshot(ver ekv.Version) (ekv.Snapshot, error) { return nil, nil }
    42  
    43  // Close implements ekv.CausetStorage interface.
    44  func (s *CausetStore) Close() error { return nil }
    45  
    46  // UUID implements ekv.CausetStorage interface.
    47  func (s *CausetStore) UUID() string { return "mock" }
    48  
    49  // CurrentVersion implements ekv.CausetStorage interface.
    50  func (s *CausetStore) CurrentVersion() (ekv.Version, error) { return ekv.Version{}, nil }
    51  
    52  // SupportDeleteRange implements ekv.CausetStorage interface.
    53  func (s *CausetStore) SupportDeleteRange() bool { return false }
    54  
    55  // Name implements ekv.CausetStorage interface.
    56  func (s *CausetStore) Name() string { return "UtilMockStorage" }
    57  
    58  // Describe implements ekv.CausetStorage interface.
    59  func (s *CausetStore) Describe() string {
    60  	return "UtilMockStorage is a mock CausetStore implementation, only for unittests in soliton package"
    61  }
    62  
    63  // ShowStatus implements ekv.CausetStorage interface.
    64  func (s *CausetStore) ShowStatus(ctx context.Context, key string) (interface{}, error) {
    65  	return nil, nil
    66  }