-
Notifications
You must be signed in to change notification settings - Fork 0
/
mocks.go
144 lines (116 loc) · 3.6 KB
/
mocks.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
package historyarchive
import (
"github.com/shantanu-hashcash/go/xdr"
"github.com/stretchr/testify/mock"
)
// MockArchive is a mockable archive.
type MockArchive struct {
mock.Mock
}
func (m *MockArchive) GetCheckpointManager() CheckpointManager {
a := m.Called()
return a.Get(0).(CheckpointManager)
}
func (m *MockArchive) GetPathHAS(path string) (HistoryArchiveState, error) {
a := m.Called(path)
return a.Get(0).(HistoryArchiveState), a.Error(1)
}
func (m *MockArchive) PutPathHAS(path string, has HistoryArchiveState, opts *CommandOptions) error {
a := m.Called(path, has, opts)
return a.Error(0)
}
func (m *MockArchive) BucketExists(bucket Hash) (bool, error) {
a := m.Called(bucket)
return a.Get(0).(bool), a.Error(1)
}
func (m *MockArchive) BucketSize(bucket Hash) (int64, error) {
a := m.Called(bucket)
return a.Get(0).(int64), a.Error(1)
}
func (m *MockArchive) CategoryCheckpointExists(cat string, chk uint32) (bool, error) {
a := m.Called(cat, chk)
return a.Get(0).(bool), a.Error(1)
}
func (m *MockArchive) GetLedgerHeader(chk uint32) (xdr.LedgerHeaderHistoryEntry, error) {
a := m.Called(chk)
return a.Get(0).(xdr.LedgerHeaderHistoryEntry), a.Error(1)
}
func (m *MockArchive) GetLedgers(start, end uint32) (map[uint32]*Ledger, error) {
a := m.Called(start, end)
return a.Get(0).(map[uint32]*Ledger), a.Error(1)
}
func (m *MockArchive) GetRootHAS() (HistoryArchiveState, error) {
a := m.Called()
return a.Get(0).(HistoryArchiveState), a.Error(1)
}
func (m *MockArchive) GetCheckpointHAS(chk uint32) (HistoryArchiveState, error) {
a := m.Called(chk)
return a.Get(0).(HistoryArchiveState), a.Error(1)
}
func (m *MockArchive) PutCheckpointHAS(chk uint32, has HistoryArchiveState, opts *CommandOptions) error {
a := m.Called(chk, has, opts)
return a.Error(0)
}
func (m *MockArchive) PutRootHAS(has HistoryArchiveState, opts *CommandOptions) error {
a := m.Called(has, opts)
return a.Error(0)
}
func (m *MockArchive) ListBucket(dp DirPrefix) (chan string, chan error) {
m.Called(dp)
panic("Returning channels not implemented")
return make(chan string), make(chan error)
}
func (m *MockArchive) ListAllBuckets() (chan string, chan error) {
m.Called()
panic("Returning channels not implemented")
return make(chan string), make(chan error)
}
func (m *MockArchive) ListAllBucketHashes() (chan Hash, chan error) {
m.Called()
panic("Returning channels not implemented")
return make(chan Hash), make(chan error)
}
func (m *MockArchive) ListCategoryCheckpoints(cat string, pth string) (chan uint32, chan error) {
m.Called(cat, pth)
panic("Returning channels not implemented")
return make(chan uint32), make(chan error)
}
func (m *MockArchive) GetXdrStreamForHash(hash Hash) (*XdrStream, error) {
a := m.Called(hash)
return a.Get(0).(*XdrStream), a.Error(1)
}
func (m *MockArchive) GetXdrStream(pth string) (*XdrStream, error) {
a := m.Called(pth)
return a.Get(0).(*XdrStream), a.Error(1)
}
func (m *MockArchive) GetStats() []ArchiveStats {
a := m.Called()
return a.Get(0).([]ArchiveStats)
}
type MockArchiveStats struct {
mock.Mock
}
func (m *MockArchiveStats) GetRequests() uint32 {
a := m.Called()
return a.Get(0).(uint32)
}
func (m *MockArchiveStats) GetDownloads() uint32 {
a := m.Called()
return a.Get(0).(uint32)
}
func (m *MockArchiveStats) GetUploads() uint32 {
a := m.Called()
return a.Get(0).(uint32)
}
func (m *MockArchiveStats) GetBackendName() string {
a := m.Called()
return a.Get(0).(string)
}
func (m *MockArchiveStats) GetCacheHits() uint32 {
a := m.Called()
return a.Get(0).(uint32)
}
func (m *MockArchiveStats) GetCacheBandwidth() uint64 {
a := m.Called()
return a.Get(0).(uint64)
}