getter

package
v2.3.0-rc10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultStrategy     = DATA                           // default prefetching strategy
	DefaultStrict       = false                          // default fallback modes
	DefaultFetchTimeout = retrieval.RetrieveChunkTimeout // timeout for each chunk retrieval
)

Variables

View Source
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

func SetFetchTimeout(ctx context.Context, timeout time.Duration) context.Context

SetFetchTimeout sets the timeout for each fetch

func SetLogger

func SetLogger(ctx context.Context, l log.Logger) context.Context

func SetStrategy

func SetStrategy(ctx context.Context, s Strategy) context.Context

SetStrategy sets the strategy for the retrieval

func SetStrict

func SetStrict(ctx context.Context, strict bool) context.Context

SetStrict sets the strict mode for the retrieval

Types

type Config

type Config struct {
	Strategy     Strategy
	Strict       bool
	FetchTimeout time.Duration
	Logger       log.Logger
}

Config is the configuration for the getter - public

func NewConfigFromContext

func NewConfigFromContext(ctx context.Context, def Config) (conf Config, err error)

NewConfigFromContext returns a new Config based on the context

type Strategy

type Strategy = int
const (
	NONE Strategy = iota // no prefetching and no decoding
	DATA                 // just retrieve data shards no decoding
	PROX                 // proximity driven selective fetching
	RACE                 // aggressive fetching racing all chunks

)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL