-
Notifications
You must be signed in to change notification settings - Fork 0
/
noop.go
44 lines (27 loc) · 1.25 KB
/
noop.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
package voucher
import (
"errors"
"math/big"
)
var _ Storer = (*NoOpBatchStore)(nil)
var ErrChainDisabled = errors.New("chain disabled")
// NoOpBatchStore is a placeholder implementation for voucher.Storer
type NoOpBatchStore struct{}
func (b *NoOpBatchStore) SetBatchExpiryHandler(BatchExpiryHandler) {}
func (b *NoOpBatchStore) Get([]byte) (*Batch, error) { return nil, ErrChainDisabled }
func (b *NoOpBatchStore) Exists([]byte) (bool, error) { return false, nil }
func (b *NoOpBatchStore) Iterate(func(*Batch) (bool, error)) error { return nil }
func (b *NoOpBatchStore) Save(*Batch) error { return nil }
func (b *NoOpBatchStore) Update(*Batch, *big.Int, uint8) error { return nil }
func (b *NoOpBatchStore) GetChainState() *ChainState {
return &ChainState{
TotalAmount: new(big.Int),
CurrentPrice: new(big.Int),
}
}
func (b *NoOpBatchStore) PutChainState(*ChainState) error { return nil }
func (b *NoOpBatchStore) GetReserveState() *ReserveState { return nil }
func (b *NoOpBatchStore) SetStorageRadius(func(uint8) uint8) error { return nil }
func (b *NoOpBatchStore) SetStorageRadiusSetter(StorageRadiusSetter) {}
func (b *NoOpBatchStore) Unreserve(UnreserveIteratorFn) error { return nil }
func (b *NoOpBatchStore) Reset() error { return nil }