Documentation
¶
Index ¶
- Constants
- Variables
- func New(addrs []swarm.Address, shardCnt int, g storage.Getter, p storage.Putter, ...) storage.Getter
- func SetConfigInContext(ctx context.Context, s *Strategy, fallbackmode *bool, fetchTimeout *string, ...) (context.Context, error)
- func SetFetchTimeout(ctx context.Context, timeout time.Duration) context.Context
- func SetLogger(ctx context.Context, l log.Logger) context.Context
- func SetStrategy(ctx context.Context, s Strategy) context.Context
- func SetStrict(ctx context.Context, strict bool) context.Context
- type Config
- type ReDecoder
- type Recovery
- type Strategy
Constants ¶
const ( DefaultStrategy = DATA // default prefetching strategy DefaultStrict = false // default fallback modes DefaultFetchTimeout = retrieval.RetrieveChunkTimeout // timeout for each chunk retrieval )
Variables ¶
var DefaultConfig = Config{ Strategy: DefaultStrategy, Strict: DefaultStrict, FetchTimeout: DefaultFetchTimeout, Logger: log.Noop, }
DefaultConfig is the default configuration for the getter
Functions ¶
func New ¶
func New(addrs []swarm.Address, shardCnt int, g storage.Getter, p storage.Putter, remove func(error), conf Config) storage.Getter
New returns a decoder object used to retrieve children of an intermediate chunk
func SetConfigInContext ¶
func SetConfigInContext(ctx context.Context, s *Strategy, fallbackmode *bool, fetchTimeout *string, logger log.Logger) (context.Context, error)
SetConfigInContext sets the config params in the context
func SetFetchTimeout ¶
SetFetchTimeout sets the timeout for each fetch
func SetStrategy ¶
SetStrategy sets the strategy for the retrieval
Types ¶
type ReDecoder ¶ added in v2.7.0
type ReDecoder struct {
// contains filtered or unexported fields
}
ReDecoder is a wrapper around a Getter that first attempts to fetch a chunk directly from the network, and only falls back to recovery if the network fetch fails. This is used to handle cases where previously recovered chunks have been evicted from cache.
func NewReDecoder ¶ added in v2.7.0
NewReDecoder creates a new ReDecoder instance with the provided fetcher and recovery factory. The recovery decoder will only be created if needed (when network fetch fails).