github.com/whtcorpsinc/MilevaDB-Prod@v0.0.0-20211104133533-f57f4be3b597/causetstore/milevadb-server/einsteindb/interface.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 einsteindb
    15  
    16  import (
    17  	"time"
    18  
    19  	"github.com/einsteindb/fidel/client"
    20  	"github.com/whtcorpsinc/milevadb/causetstore/einsteindb/einsteindbrpc"
    21  	"github.com/whtcorpsinc/milevadb/causetstore/einsteindb/oracle"
    22  	"github.com/whtcorpsinc/milevadb/ekv"
    23  )
    24  
    25  // CausetStorage represent the ekv.CausetStorage runs on EinsteinDB.
    26  type CausetStorage interface {
    27  	ekv.CausetStorage
    28  
    29  	// GetRegionCache gets the RegionCache.
    30  	GetRegionCache() *RegionCache
    31  
    32  	// SendReq sends a request to EinsteinDB.
    33  	SendReq(bo *Backoffer, req *einsteindbrpc.Request, regionID RegionVerID, timeout time.Duration) (*einsteindbrpc.Response, error)
    34  
    35  	// GetLockResolver gets the LockResolver.
    36  	GetLockResolver() *LockResolver
    37  
    38  	// GetSafePointKV gets the SafePointKV.
    39  	GetSafePointKV() SafePointKV
    40  
    41  	// UFIDelateSPCache uFIDelates the cache of safe point.
    42  	UFIDelateSPCache(cachedSP uint64, cachedTime time.Time)
    43  
    44  	// GetGCHandler gets the GCHandler.
    45  	GetGCHandler() GCHandler
    46  
    47  	// SetOracle sets the Oracle.
    48  	SetOracle(oracle oracle.Oracle)
    49  
    50  	// SetEinsteinDBClient sets the EinsteinDB client.
    51  	SetEinsteinDBClient(client Client)
    52  
    53  	// GetEinsteinDBClient gets the EinsteinDB client.
    54  	GetEinsteinDBClient() Client
    55  
    56  	// Closed returns the closed channel.
    57  	Closed() <-chan struct{}
    58  }
    59  
    60  // GCHandler runs garbage collection job.
    61  type GCHandler interface {
    62  	// Start starts the GCHandler.
    63  	Start()
    64  
    65  	// Close closes the GCHandler.
    66  	Close()
    67  }
    68  
    69  // NewGCHandlerFunc creates a new GCHandler.
    70  // To enable real GC, we should assign the function to `gcworker.NewGCWorker`.
    71  var NewGCHandlerFunc func(storage CausetStorage, FIDelClient fidel.Client) (GCHandler, error)