github.com/matrixorigin/matrixone@v1.2.0/pkg/tnservice/types.go (about)

     1  // Copyright 2021 - 2022 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 tnservice
    16  
    17  import (
    18  	"github.com/matrixorigin/matrixone/pkg/pb/metadata"
    19  	"github.com/matrixorigin/matrixone/pkg/taskservice"
    20  )
    21  
    22  // StorageType txn storage type
    23  type StorageType string
    24  
    25  const (
    26  	// StorageTAE TAE txn storage backend
    27  	StorageTAE = StorageType("TAE")
    28  	// StorageMEMKV MEMKV txn storage backend
    29  	StorageMEMKV = StorageType("MEMKV")
    30  	// StorageMEMKV MEM txn storage backend
    31  	StorageMEM = StorageType("MEM")
    32  )
    33  
    34  // Option store option
    35  type Option func(*store)
    36  
    37  // Service TN Service
    38  type Service interface {
    39  	// Start start tn store. Start all DNShards currently managed by the Store and listen
    40  	// to and process requests from CN and other DNs.
    41  	Start() error
    42  	// Close close tn store
    43  	Close() error
    44  
    45  	// StartTNReplica start the DNShard replica
    46  	StartTNReplica(metadata.TNShard) error
    47  	// CloseTNReplica close the DNShard replica.
    48  	CloseTNReplica(shard metadata.TNShard) error
    49  
    50  	// GetTaskService returns taskservice
    51  	GetTaskService() (taskservice.TaskService, bool)
    52  }