Documentation ¶
Index ¶
- func ChunkType(ch swarm.Chunk) swarm.ChunkType
- type BatchRadiusItem
- type BinItem
- type ChunkBinItem
- type ChunkItem
- type EpochItem
- type Reserve
- func (r *Reserve) AddSize(diff int)
- func (r *Reserve) Capacity() int
- func (r *Reserve) CleanupBinIndex(ctx context.Context, batch storage.Batch, chunkAddress swarm.Address, ...)
- func (r *Reserve) DeleteChunk(ctx context.Context, store internal.Storage, batch storage.Writer, ...) error
- func (r *Reserve) EvictBatchBin(ctx context.Context, txExecutor internal.TxExecutor, bin uint8, batchID []byte) (int, error)
- func (r *Reserve) EvictionTarget() int
- func (r *Reserve) Get(ctx context.Context, storage internal.Storage, addr swarm.Address, ...) (swarm.Chunk, error)
- func (r *Reserve) Has(store storage.Store, addr swarm.Address, batchID []byte) (bool, error)
- func (r *Reserve) IncBinID(store storage.Store, bin uint8) (uint64, error)
- func (r *Reserve) IsWithinCapacity() bool
- func (r *Reserve) IterateBin(store storage.Store, bin uint8, startBinID uint64, ...) error
- func (r *Reserve) IterateChunks(store internal.Storage, startBin uint8, cb func(swarm.Chunk) (bool, error)) error
- func (r *Reserve) IterateChunksItems(store internal.Storage, startBin uint8, cb func(ChunkItem) (bool, error)) error
- func (r *Reserve) LastBinIDs(store storage.Store) ([]uint64, uint64, error)
- func (r *Reserve) Put(ctx context.Context, store internal.Storage, chunk swarm.Chunk) (bool, error)
- func (r *Reserve) Radius() uint8
- func (r *Reserve) SetRadius(store storage.Store, rad uint8) error
- func (r *Reserve) Size() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BatchRadiusItem ¶ added in v1.17.2
BatchRadiusItem allows iteration of the chunks with respect to bin and batchID. Used for batch evictions of certain bins.
func (*BatchRadiusItem) Clone ¶ added in v1.17.2
func (b *BatchRadiusItem) Clone() storage.Item
func (*BatchRadiusItem) ID ¶ added in v1.17.2
func (b *BatchRadiusItem) ID() string
batchID/bin/ChunkAddr
func (*BatchRadiusItem) Marshal ¶ added in v1.17.2
func (b *BatchRadiusItem) Marshal() ([]byte, error)
func (*BatchRadiusItem) Namespace ¶ added in v1.17.2
func (b *BatchRadiusItem) Namespace() string
func (*BatchRadiusItem) String ¶ added in v1.17.2
func (b *BatchRadiusItem) String() string
func (*BatchRadiusItem) Unmarshal ¶ added in v1.17.2
func (b *BatchRadiusItem) Unmarshal(buf []byte) error
type BinItem ¶ added in v1.17.2
BinItem stores the latest binIDs for each bin between 0 and swarm.MaxBins
type ChunkBinItem ¶ added in v1.17.2
type ChunkBinItem struct { Bin uint8 BinID uint64 Address swarm.Address BatchID []byte ChunkType swarm.ChunkType }
ChunkBinItem allows for iterating on ranges of bin and binIDs for chunks. BinIDs come in handy when syncing the reserve contents with other peers.
func (*ChunkBinItem) Clone ¶ added in v1.17.2
func (c *ChunkBinItem) Clone() storage.Item
func (*ChunkBinItem) Marshal ¶ added in v1.17.2
func (c *ChunkBinItem) Marshal() ([]byte, error)
func (*ChunkBinItem) Namespace ¶ added in v1.17.2
func (c *ChunkBinItem) Namespace() string
func (*ChunkBinItem) String ¶ added in v1.17.2
func (c *ChunkBinItem) String() string
func (*ChunkBinItem) Unmarshal ¶ added in v1.17.2
func (c *ChunkBinItem) Unmarshal(buf []byte) error
type EpochItem ¶ added in v1.17.4
type EpochItem struct {
Timestamp uint64
}
EpochItem stores the timetamp in seconds of the initial creation of the reserve.
type Reserve ¶
type Reserve struct {
// contains filtered or unexported fields
}
func (*Reserve) CleanupBinIndex ¶
func (r *Reserve) CleanupBinIndex( ctx context.Context, batch storage.Batch, chunkAddress swarm.Address, binID uint64, )
CleanupBinIndex removes the bin index entry for the chunk. This is called mainly to cleanup the bin index if other indexes are missing during reserve cleanup.
func (*Reserve) DeleteChunk ¶
func (*Reserve) EvictBatchBin ¶
func (r *Reserve) EvictBatchBin( ctx context.Context, txExecutor internal.TxExecutor, bin uint8, batchID []byte, ) (int, error)
EvictBatchBin evicts all chunks from bins upto the bin provided.