forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
inner_server.go
71 lines (60 loc) · 2.19 KB
/
inner_server.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright 2019-present PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tikv
import (
"github.com/pingcap/kvproto/pkg/tikvpb"
"github.com/twotigers93/tidb/store/mockstore/unistore/pd"
"github.com/twotigers93/tidb/store/mockstore/unistore/tikv/mvcc"
)
// InnerServer defines the inner server interface.
type InnerServer interface {
Setup(pdClient pd.Client)
Start(pdClient pd.Client) error
Stop() error
Raft(stream tikvpb.Tikv_RaftServer) error
BatchRaft(stream tikvpb.Tikv_BatchRaftServer) error
Snapshot(stream tikvpb.Tikv_SnapshotServer) error
}
// StandAlongInnerServer implements the InnerServer interface.
type StandAlongInnerServer struct {
bundle *mvcc.DBBundle
}
// NewStandAlongInnerServer returns a new StandAlongInnerServer.
func NewStandAlongInnerServer(bundle *mvcc.DBBundle) *StandAlongInnerServer {
return &StandAlongInnerServer{
bundle: bundle,
}
}
// Raft implements the InnerServer Raft method.
func (is *StandAlongInnerServer) Raft(stream tikvpb.Tikv_RaftServer) error {
return nil
}
// BatchRaft implements the InnerServer BatchRaft method.
func (is *StandAlongInnerServer) BatchRaft(stream tikvpb.Tikv_BatchRaftServer) error {
return nil
}
// Snapshot implements the InnerServer Snapshot method.
func (is *StandAlongInnerServer) Snapshot(stream tikvpb.Tikv_SnapshotServer) error {
return nil
}
// Setup implements the InnerServer Setup method.
func (is *StandAlongInnerServer) Setup(pdClient pd.Client) {}
// Start implements the InnerServer Start method.
func (is *StandAlongInnerServer) Start(pdClient pd.Client) error {
return nil
}
// Stop implements the InnerServer Stop method.
func (is *StandAlongInnerServer) Stop() error {
return is.bundle.DB.Close()
}