forked from ethersphere/bee
/
noop.go
52 lines (32 loc) · 1.49 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
45
46
47
48
49
50
51
52
// Copyright 2022 The Swarm Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package postage
import (
"errors"
"math/big"
"github.com/ethersphere/bee/pkg/swarm"
)
var _ Storer = (*NoOpBatchStore)(nil)
var ErrChainDisabled = errors.New("chain disabled")
// NoOpBatchStore is a placeholder implementation for postage.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) Radius() uint8 { return 0 }
func (b *NoOpBatchStore) IsWithinStorageRadius(swarm.Address) bool { return false }
func (b *NoOpBatchStore) StorageRadius() uint8 { return 0 }
func (b *NoOpBatchStore) SetStorageRadius(func(uint8) uint8) error { return nil }
func (b *NoOpBatchStore) Commitment() (uint64, error) { return 0, nil }
func (b *NoOpBatchStore) Reset() error { return nil }