forked from vitessio/vitess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faketopo.go
240 lines (190 loc) · 8.35 KB
/
faketopo.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
// Package faketopo contains utitlities for tests that have to interact with a
// Vitess topology.
package faketopo
import (
"errors"
"github.com/youtube/vitess/go/vt/topo"
"golang.org/x/net/context"
pb "github.com/youtube/vitess/go/vt/proto/topodata"
)
var errNotImplemented = errors.New("Not implemented")
// FakeTopo is a topo.Server implementation that always returns errNotImplemented errors.
type FakeTopo struct{}
// GetSrvKeyspaceNames implements topo.Server.
func (ft FakeTopo) GetSrvKeyspaceNames(ctx context.Context, cell string) ([]string, error) {
return nil, errNotImplemented
}
// GetSrvKeyspace implements topo.Server.
func (ft FakeTopo) GetSrvKeyspace(ctx context.Context, cell, keyspace string) (*pb.SrvKeyspace, error) {
return nil, errNotImplemented
}
// GetEndPoints implements topo.Server.
func (ft FakeTopo) GetEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType) (*pb.EndPoints, int64, error) {
return nil, -1, errNotImplemented
}
// Close implements topo.Server.
func (ft FakeTopo) Close() {}
// GetKnownCells implements topo.Server.
func (ft FakeTopo) GetKnownCells(ctx context.Context) ([]string, error) {
return nil, errNotImplemented
}
// CreateKeyspace implements topo.Server.
func (ft FakeTopo) CreateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace) error {
return errNotImplemented
}
// UpdateKeyspace implements topo.Server.
func (ft FakeTopo) UpdateKeyspace(ctx context.Context, keyspace string, value *pb.Keyspace, existingVersion int64) (int64, error) {
return 0, errNotImplemented
}
// DeleteKeyspace implements topo.Server.
func (ft FakeTopo) DeleteKeyspace(ctx context.Context, keyspace string) error {
return errNotImplemented
}
// GetKeyspace implements topo.Server.
func (ft FakeTopo) GetKeyspace(ctx context.Context, keyspace string) (*pb.Keyspace, int64, error) {
return nil, 0, errNotImplemented
}
// GetKeyspaces implements topo.Server.
func (ft FakeTopo) GetKeyspaces(ctx context.Context) ([]string, error) {
return nil, errNotImplemented
}
// DeleteKeyspaceShards implements topo.Server.
func (ft FakeTopo) DeleteKeyspaceShards(ctx context.Context, keyspace string) error {
return errNotImplemented
}
// CreateShard implements topo.Server.
func (ft FakeTopo) CreateShard(ctx context.Context, keyspace, shard string, value *pb.Shard) error {
return errNotImplemented
}
// UpdateShard implements topo.Server.
func (ft FakeTopo) UpdateShard(ctx context.Context, keyspace, shard string, value *pb.Shard, existingVersion int64) (int64, error) {
return 0, errNotImplemented
}
// ValidateShard implements topo.Server.
func (ft FakeTopo) ValidateShard(ctx context.Context, keyspace, shard string) error {
return errNotImplemented
}
// GetShard implements topo.Server.
func (ft FakeTopo) GetShard(ctx context.Context, keyspace, shard string) (*pb.Shard, int64, error) {
return nil, 0, errNotImplemented
}
// GetShardNames implements topo.Server.
func (ft FakeTopo) GetShardNames(ctx context.Context, keyspace string) ([]string, error) {
return nil, errNotImplemented
}
// DeleteShard implements topo.Server.
func (ft FakeTopo) DeleteShard(ctx context.Context, keyspace, shard string) error {
return errNotImplemented
}
// CreateTablet implements topo.Server.
func (ft FakeTopo) CreateTablet(ctx context.Context, tablet *pb.Tablet) error {
return errNotImplemented
}
// UpdateTablet implements topo.Server.
func (ft FakeTopo) UpdateTablet(ctx context.Context, tablet *pb.Tablet, existingVersion int64) (newVersion int64, err error) {
return 0, errNotImplemented
}
// UpdateTabletFields implements topo.Server.
func (ft FakeTopo) UpdateTabletFields(ctx context.Context, tabletAlias *pb.TabletAlias, update func(*pb.Tablet) error) (*pb.Tablet, error) {
return nil, errNotImplemented
}
// DeleteTablet implements topo.Server.
func (ft FakeTopo) DeleteTablet(ctx context.Context, alias *pb.TabletAlias) error {
return errNotImplemented
}
// GetTablet implements topo.Server.
func (ft FakeTopo) GetTablet(ctx context.Context, alias *pb.TabletAlias) (*pb.Tablet, int64, error) {
return nil, 0, errNotImplemented
}
// GetTabletsByCell implements topo.Server.
func (ft FakeTopo) GetTabletsByCell(ctx context.Context, cell string) ([]*pb.TabletAlias, error) {
return nil, errNotImplemented
}
// UpdateShardReplicationFields implements topo.Server.
func (ft FakeTopo) UpdateShardReplicationFields(ctx context.Context, cell, keyspace, shard string, update func(*pb.ShardReplication) error) error {
return errNotImplemented
}
// GetShardReplication implements topo.Server.
func (ft FakeTopo) GetShardReplication(ctx context.Context, cell, keyspace, shard string) (*topo.ShardReplicationInfo, error) {
return nil, errNotImplemented
}
// DeleteShardReplication implements topo.Server.
func (ft FakeTopo) DeleteShardReplication(ctx context.Context, cell, keyspace, shard string) error {
return errNotImplemented
}
// DeleteKeyspaceReplication implements topo.Server.
func (ft FakeTopo) DeleteKeyspaceReplication(ctx context.Context, cell, keyspace string) error {
return errNotImplemented
}
// LockSrvShardForAction implements topo.Server.
func (ft FakeTopo) LockSrvShardForAction(ctx context.Context, cell, keyspace, shard, contents string) (string, error) {
return "", errNotImplemented
}
// UnlockSrvShardForAction implements topo.Server.
func (ft FakeTopo) UnlockSrvShardForAction(ctx context.Context, cell, keyspace, shard, lockPath, results string) error {
return errNotImplemented
}
// GetSrvTabletTypesPerShard implements topo.Server.
func (ft FakeTopo) GetSrvTabletTypesPerShard(ctx context.Context, cell, keyspace, shard string) ([]pb.TabletType, error) {
return nil, errNotImplemented
}
// CreateEndPoints implements topo.Server.
func (ft FakeTopo) CreateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, addrs *pb.EndPoints) error {
return errNotImplemented
}
// UpdateEndPoints implements topo.Server.
func (ft FakeTopo) UpdateEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, addrs *pb.EndPoints, existingVersion int64) error {
return errNotImplemented
}
// DeleteEndPoints implements topo.Server.
func (ft FakeTopo) DeleteEndPoints(ctx context.Context, cell, keyspace, shard string, tabletType pb.TabletType, existingVersion int64) error {
return errNotImplemented
}
// WatchSrvKeyspace implements topo.Server.WatchSrvKeyspace
func (ft FakeTopo) WatchSrvKeyspace(ctx context.Context, cell, keyspace string) (<-chan *pb.SrvKeyspace, chan<- struct{}, error) {
return nil, nil, errNotImplemented
}
// UpdateSrvShard implements topo.Server.
func (ft FakeTopo) UpdateSrvShard(ctx context.Context, cell, keyspace, shard string, srvShard *pb.SrvShard) error {
return errNotImplemented
}
// GetSrvShard implements topo.Server.
func (ft FakeTopo) GetSrvShard(ctx context.Context, cell, keyspace, shard string) (*pb.SrvShard, error) {
return nil, errNotImplemented
}
// DeleteSrvShard implements topo.Server.
func (ft FakeTopo) DeleteSrvShard(ctx context.Context, cell, keyspace, shard string) error {
return errNotImplemented
}
// UpdateSrvKeyspace implements topo.Server.
func (ft FakeTopo) UpdateSrvKeyspace(ctx context.Context, cell, keyspace string, srvKeyspace *pb.SrvKeyspace) error {
return errNotImplemented
}
// DeleteSrvKeyspace implements topo.Server.
func (ft FakeTopo) DeleteSrvKeyspace(ctx context.Context, cell, keyspace string) error {
return errNotImplemented
}
// LockKeyspaceForAction implements topo.Server.
func (ft FakeTopo) LockKeyspaceForAction(ctx context.Context, keyspace, contents string) (string, error) {
return "", errNotImplemented
}
// UnlockKeyspaceForAction implements topo.Server.
func (ft FakeTopo) UnlockKeyspaceForAction(ctx context.Context, keyspace, lockPath, results string) error {
return errNotImplemented
}
// LockShardForAction implements topo.Server.
func (ft FakeTopo) LockShardForAction(ctx context.Context, keyspace, shard, contents string) (string, error) {
return "", errNotImplemented
}
// UnlockShardForAction implements topo.Server.
func (ft FakeTopo) UnlockShardForAction(ctx context.Context, keyspace, shard, lockPath, results string) error {
return errNotImplemented
}
// SaveVSchema implements topo.Server.
func (ft FakeTopo) SaveVSchema(context.Context, string) error {
return errNotImplemented
}
// GetVSchema implements topo.Server.
func (ft FakeTopo) GetVSchema(ctx context.Context) (string, error) {
return "", errNotImplemented
}