generated from cybozu-go/neco-template
/
nop.go
64 lines (48 loc) · 1.38 KB
/
nop.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
package dbop
import (
"context"
"errors"
)
// ErrNop is a sentinel error for NopOperator
var ErrNop = errors.New("nop")
// NopOperator is an implementation of Operator that always returns ErrNop.
type NopOperator struct {
name string
}
var _ Operator = NopOperator{}
func (o NopOperator) Name() string {
return o.name
}
func (o NopOperator) Close() error {
return nil
}
func (o NopOperator) GetStatus(context.Context) (*MySQLInstanceStatus, error) {
return nil, ErrNop
}
func (o NopOperator) SubtractGTID(ctx context.Context, set1, set2 string) (string, error) {
return "", ErrNop
}
func (o NopOperator) IsSubsetGTID(ctx context.Context, set1, set2 string) (bool, error) {
return false, ErrNop
}
func (o NopOperator) FindTopRunner(context.Context, []*MySQLInstanceStatus) (int, error) {
return 0, ErrNop
}
func (o NopOperator) ConfigureReplica(ctx context.Context, source AccessInfo, semisync bool) error {
return ErrNop
}
func (o NopOperator) ConfigurePrimary(ctx context.Context, waitForCount int) error {
return ErrNop
}
func (o NopOperator) StopReplicaIOThread(context.Context) error {
return ErrNop
}
func (o NopOperator) WaitForGTID(ctx context.Context, gtidSet string, timeoutSeconds int) error {
return ErrNop
}
func (o NopOperator) SetReadOnly(context.Context, bool) error {
return ErrNop
}
func (o NopOperator) KillConnections(context.Context) error {
return ErrNop
}