download

package
v0.3.2-consistent-hash... Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EqualSplit added in v0.3.2

func EqualSplit(number int64, parts int64) []int64

Types

type BufferMode

type BufferMode struct {
	Client *client.HTTPClient
	Options
}

func GetBufferMode added in v0.2.1

func GetBufferMode(opts Options) *BufferMode

func (*BufferMode) Fetch added in v0.2.1

func (m *BufferMode) Fetch(ctx context.Context, url string) (result io.Reader, fileSize int64, err error)

type ConsistentHashingMode added in v0.3.2

type ConsistentHashingMode struct {
	Client *client.HTTPClient
	Options
}

func (*ConsistentHashingMode) Fetch added in v0.3.2

func (m *ConsistentHashingMode) Fetch(ctx context.Context, urlString string) (io.Reader, int64, error)

type Options added in v0.2.0

type Options struct {
	// Maximum number of chunks to download. If set to zero, GOMAXPROCS*4
	// will be used.
	MaxConcurrency int

	// SliceSize is the number of bytes per slice in nginx.
	// See https://nginx.org/en/docs/http/ngx_http_slice_module.html
	SliceSize int64

	// Minimum number of bytes per chunk. If set to zero, 16 MiB will be
	// used.
	MinChunkSize int64
	Client       client.Options

	// DomainsToCache is an allowlist of domains which may be routed via a
	// pull-through cache
	DomainsToCache []string

	// CacheHosts is a slice of hostnames to use as pull-through caches.
	// The ordering is significant and will be used with the consistent
	// hashing algorithm.  The slice may contain empty entries which
	// correspond to a cache host which is currently unavailable.
	CacheHosts []string

	// Semaphore is used to manage maximum concurrency. If nil, concurrency
	// is unlimited.
	Semaphore *semaphore.Weighted
}

type Strategy added in v0.2.1

type Strategy interface {
	Fetch(ctx context.Context, url string) (result io.Reader, fileSize int64, err error)
}

func GetConsistentHashingMode added in v0.3.2

func GetConsistentHashingMode(opts Options) (Strategy, error)

Jump to

Keyboard shortcuts

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