github.com/ethersphere/bee/v2@v2.2.0/pkg/postage/noop.go (about)

     1  // Copyright 2022 The Swarm Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package postage
     6  
     7  import (
     8  	"errors"
     9  	"math/big"
    10  
    11  	"github.com/ethersphere/bee/v2/pkg/swarm"
    12  )
    13  
    14  var _ Storer = (*NoOpBatchStore)(nil)
    15  
    16  var ErrChainDisabled = errors.New("chain disabled")
    17  
    18  // NoOpBatchStore is a placeholder implementation for postage.Storer
    19  type NoOpBatchStore struct{}
    20  
    21  func (b *NoOpBatchStore) SetBatchExpiryHandler(BatchExpiryHandler) {}
    22  
    23  func (b *NoOpBatchStore) Get([]byte) (*Batch, error) { return nil, ErrChainDisabled }
    24  
    25  func (b *NoOpBatchStore) Exists([]byte) (bool, error) { return false, nil }
    26  
    27  func (b *NoOpBatchStore) Iterate(func(*Batch) (bool, error)) error { return nil }
    28  
    29  func (b *NoOpBatchStore) Save(*Batch) error { return nil }
    30  
    31  func (b *NoOpBatchStore) Update(*Batch, *big.Int, uint8) error { return nil }
    32  
    33  func (b *NoOpBatchStore) GetChainState() *ChainState {
    34  	return &ChainState{
    35  		TotalAmount:  new(big.Int),
    36  		CurrentPrice: new(big.Int),
    37  	}
    38  }
    39  
    40  func (b *NoOpBatchStore) PutChainState(*ChainState) error { return nil }
    41  
    42  func (b *NoOpBatchStore) Radius() uint8 { return 0 }
    43  
    44  func (b *NoOpBatchStore) IsWithinStorageRadius(swarm.Address) bool { return false }
    45  
    46  func (b *NoOpBatchStore) StorageRadius() uint8 { return 0 }
    47  
    48  func (b *NoOpBatchStore) SetStorageRadius(func(uint8) uint8) error { return nil }
    49  
    50  func (b *NoOpBatchStore) Commitment() (uint64, error) { return 0, nil }
    51  
    52  func (b *NoOpBatchStore) Reset() error { return nil }