github.com/aakash4dev/cometbft@v0.38.2/state/mocks/block_store.go (about) 1 // Code generated by mockery. DO NOT EDIT. 2 3 package mocks 4 5 import ( 6 state "github.com/aakash4dev/cometbft/state" 7 mock "github.com/stretchr/testify/mock" 8 9 types "github.com/aakash4dev/cometbft/types" 10 ) 11 12 // BlockStore is an autogenerated mock type for the BlockStore type 13 type BlockStore struct { 14 mock.Mock 15 } 16 17 // Base provides a mock function with given fields: 18 func (_m *BlockStore) Base() int64 { 19 ret := _m.Called() 20 21 var r0 int64 22 if rf, ok := ret.Get(0).(func() int64); ok { 23 r0 = rf() 24 } else { 25 r0 = ret.Get(0).(int64) 26 } 27 28 return r0 29 } 30 31 // Close provides a mock function with given fields: 32 func (_m *BlockStore) Close() error { 33 ret := _m.Called() 34 35 var r0 error 36 if rf, ok := ret.Get(0).(func() error); ok { 37 r0 = rf() 38 } else { 39 r0 = ret.Error(0) 40 } 41 42 return r0 43 } 44 45 // DeleteLatestBlock provides a mock function with given fields: 46 func (_m *BlockStore) DeleteLatestBlock() error { 47 ret := _m.Called() 48 49 var r0 error 50 if rf, ok := ret.Get(0).(func() error); ok { 51 r0 = rf() 52 } else { 53 r0 = ret.Error(0) 54 } 55 56 return r0 57 } 58 59 // Height provides a mock function with given fields: 60 func (_m *BlockStore) Height() int64 { 61 ret := _m.Called() 62 63 var r0 int64 64 if rf, ok := ret.Get(0).(func() int64); ok { 65 r0 = rf() 66 } else { 67 r0 = ret.Get(0).(int64) 68 } 69 70 return r0 71 } 72 73 // LoadBaseMeta provides a mock function with given fields: 74 func (_m *BlockStore) LoadBaseMeta() *types.BlockMeta { 75 ret := _m.Called() 76 77 var r0 *types.BlockMeta 78 if rf, ok := ret.Get(0).(func() *types.BlockMeta); ok { 79 r0 = rf() 80 } else { 81 if ret.Get(0) != nil { 82 r0 = ret.Get(0).(*types.BlockMeta) 83 } 84 } 85 86 return r0 87 } 88 89 // LoadBlock provides a mock function with given fields: height 90 func (_m *BlockStore) LoadBlock(height int64) *types.Block { 91 ret := _m.Called(height) 92 93 var r0 *types.Block 94 if rf, ok := ret.Get(0).(func(int64) *types.Block); ok { 95 r0 = rf(height) 96 } else { 97 if ret.Get(0) != nil { 98 r0 = ret.Get(0).(*types.Block) 99 } 100 } 101 102 return r0 103 } 104 105 // LoadBlockByHash provides a mock function with given fields: hash 106 func (_m *BlockStore) LoadBlockByHash(hash []byte) *types.Block { 107 ret := _m.Called(hash) 108 109 var r0 *types.Block 110 if rf, ok := ret.Get(0).(func([]byte) *types.Block); ok { 111 r0 = rf(hash) 112 } else { 113 if ret.Get(0) != nil { 114 r0 = ret.Get(0).(*types.Block) 115 } 116 } 117 118 return r0 119 } 120 121 // LoadBlockCommit provides a mock function with given fields: height 122 func (_m *BlockStore) LoadBlockCommit(height int64) *types.Commit { 123 ret := _m.Called(height) 124 125 var r0 *types.Commit 126 if rf, ok := ret.Get(0).(func(int64) *types.Commit); ok { 127 r0 = rf(height) 128 } else { 129 if ret.Get(0) != nil { 130 r0 = ret.Get(0).(*types.Commit) 131 } 132 } 133 134 return r0 135 } 136 137 // LoadBlockExtendedCommit provides a mock function with given fields: height 138 func (_m *BlockStore) LoadBlockExtendedCommit(height int64) *types.ExtendedCommit { 139 ret := _m.Called(height) 140 141 var r0 *types.ExtendedCommit 142 if rf, ok := ret.Get(0).(func(int64) *types.ExtendedCommit); ok { 143 r0 = rf(height) 144 } else { 145 if ret.Get(0) != nil { 146 r0 = ret.Get(0).(*types.ExtendedCommit) 147 } 148 } 149 150 return r0 151 } 152 153 // LoadBlockMeta provides a mock function with given fields: height 154 func (_m *BlockStore) LoadBlockMeta(height int64) *types.BlockMeta { 155 ret := _m.Called(height) 156 157 var r0 *types.BlockMeta 158 if rf, ok := ret.Get(0).(func(int64) *types.BlockMeta); ok { 159 r0 = rf(height) 160 } else { 161 if ret.Get(0) != nil { 162 r0 = ret.Get(0).(*types.BlockMeta) 163 } 164 } 165 166 return r0 167 } 168 169 // LoadBlockMetaByHash provides a mock function with given fields: hash 170 func (_m *BlockStore) LoadBlockMetaByHash(hash []byte) *types.BlockMeta { 171 ret := _m.Called(hash) 172 173 var r0 *types.BlockMeta 174 if rf, ok := ret.Get(0).(func([]byte) *types.BlockMeta); ok { 175 r0 = rf(hash) 176 } else { 177 if ret.Get(0) != nil { 178 r0 = ret.Get(0).(*types.BlockMeta) 179 } 180 } 181 182 return r0 183 } 184 185 // LoadBlockPart provides a mock function with given fields: height, index 186 func (_m *BlockStore) LoadBlockPart(height int64, index int) *types.Part { 187 ret := _m.Called(height, index) 188 189 var r0 *types.Part 190 if rf, ok := ret.Get(0).(func(int64, int) *types.Part); ok { 191 r0 = rf(height, index) 192 } else { 193 if ret.Get(0) != nil { 194 r0 = ret.Get(0).(*types.Part) 195 } 196 } 197 198 return r0 199 } 200 201 // LoadSeenCommit provides a mock function with given fields: height 202 func (_m *BlockStore) LoadSeenCommit(height int64) *types.Commit { 203 ret := _m.Called(height) 204 205 var r0 *types.Commit 206 if rf, ok := ret.Get(0).(func(int64) *types.Commit); ok { 207 r0 = rf(height) 208 } else { 209 if ret.Get(0) != nil { 210 r0 = ret.Get(0).(*types.Commit) 211 } 212 } 213 214 return r0 215 } 216 217 // PruneBlocks provides a mock function with given fields: height, _a1 218 func (_m *BlockStore) PruneBlocks(height int64, _a1 state.State) (uint64, int64, error) { 219 ret := _m.Called(height, _a1) 220 221 var r0 uint64 222 var r1 int64 223 var r2 error 224 if rf, ok := ret.Get(0).(func(int64, state.State) (uint64, int64, error)); ok { 225 return rf(height, _a1) 226 } 227 if rf, ok := ret.Get(0).(func(int64, state.State) uint64); ok { 228 r0 = rf(height, _a1) 229 } else { 230 r0 = ret.Get(0).(uint64) 231 } 232 233 if rf, ok := ret.Get(1).(func(int64, state.State) int64); ok { 234 r1 = rf(height, _a1) 235 } else { 236 r1 = ret.Get(1).(int64) 237 } 238 239 if rf, ok := ret.Get(2).(func(int64, state.State) error); ok { 240 r2 = rf(height, _a1) 241 } else { 242 r2 = ret.Error(2) 243 } 244 245 return r0, r1, r2 246 } 247 248 // SaveBlock provides a mock function with given fields: block, blockParts, seenCommit 249 func (_m *BlockStore) SaveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { 250 _m.Called(block, blockParts, seenCommit) 251 } 252 253 // SaveBlockWithExtendedCommit provides a mock function with given fields: block, blockParts, seenCommit 254 func (_m *BlockStore) SaveBlockWithExtendedCommit(block *types.Block, blockParts *types.PartSet, seenCommit *types.ExtendedCommit) { 255 _m.Called(block, blockParts, seenCommit) 256 } 257 258 // Size provides a mock function with given fields: 259 func (_m *BlockStore) Size() int64 { 260 ret := _m.Called() 261 262 var r0 int64 263 if rf, ok := ret.Get(0).(func() int64); ok { 264 r0 = rf() 265 } else { 266 r0 = ret.Get(0).(int64) 267 } 268 269 return r0 270 } 271 272 // NewBlockStore creates a new instance of BlockStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 273 // The first argument is typically a *testing.T value. 274 func NewBlockStore(t interface { 275 mock.TestingT 276 Cleanup(func()) 277 }) *BlockStore { 278 mock := &BlockStore{} 279 mock.Mock.Test(t) 280 281 t.Cleanup(func() { mock.AssertExpectations(t) }) 282 283 return mock 284 }