testuplink

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableConcurrentSegmentUploads added in v1.12.0

func DisableConcurrentSegmentUploads(ctx context.Context) context.Context

DisableConcurrentSegmentUploads creates a context that disables the new concurrent segment upload codepath.

func GetListLimit added in v1.7.1

func GetListLimit(ctx context.Context) int

GetListLimit returns value for list limit if exists in context. Only for testing purposes.

func GetLogWriter added in v1.11.0

func GetLogWriter(ctx context.Context) io.Writer

GetLogWriter returns upload log file from context if exists.

func GetMaxSegmentSize

func GetMaxSegmentSize(ctx context.Context) (memory.Size, bool)

GetMaxSegmentSize returns max segment size from context if exists.

func IsWithoutPlainSize added in v1.4.6

func IsWithoutPlainSize(ctx context.Context) bool

IsWithoutPlainSize returns true if information about not sending segment plain size exists in context. Only for testing purposes.

func Log added in v1.11.0

func Log(ctx context.Context, args ...interface{})

Log writes to upload log file if exists.

func WithConcurrentSegmentUploadsConfig added in v1.11.0

func WithConcurrentSegmentUploadsConfig(ctx context.Context, config ConcurrentSegmentUploadsConfig) context.Context

WithConcurrentSegmentUploadsConfig creates a context that enables the new concurrent segment upload codepath for testing purposes using the given scheduler options.

The context needs to be used with uplink.OpenProject to have effect.

func WithConcurrentSegmentUploadsDefaultConfig added in v1.11.0

func WithConcurrentSegmentUploadsDefaultConfig(ctx context.Context) context.Context

WithConcurrentSegmentUploadsDefaultConfig creates a context that enables the new concurrent segment upload codepath for testing purposes using the default configuration.

The context needs to be used with uplink.OpenProject to have effect.

func WithListLimit added in v1.7.1

func WithListLimit(ctx context.Context, limit int) context.Context

WithListLimit creates context with information about list limit that will be used with request. Only for testing purposes.

func WithLogWriter added in v1.11.0

func WithLogWriter(ctx context.Context, w io.Writer) context.Context

WithLogWriter creates context with information about upload log file.

func WithLogWriterContext added in v1.11.0

func WithLogWriterContext(ctx context.Context, kvs ...string) context.Context

WithLogWriterContext appends the key/val pair to the context that is logged with each Log call.

func WithMaxSegmentSize

func WithMaxSegmentSize(ctx context.Context, segmentSize memory.Size) context.Context

WithMaxSegmentSize creates context with max segment size for testing purposes.

Created context needs to be used with uplink.OpenProject to manipulate default segment size.

func WithoutPlainSize added in v1.4.6

func WithoutPlainSize(ctx context.Context) context.Context

WithoutPlainSize creates context with information that segment plain size shouldn't be sent. Only for testing purposes.

Types

type ConcurrentSegmentUploadsConfig added in v1.11.0

type ConcurrentSegmentUploadsConfig struct {
	// SchedulerOptions are the options for the scheduler used to place limits
	// on the amount of concurrent piece limits per-upload, across all
	// segments.
	SchedulerOptions scheduler.Options

	// LongTailMargin represents the maximum number of piece uploads beyond the
	// optimal threshold that will be uploaded for a given segment. Once an
	// upload has reached the optimal threshold, the remaining piece uploads
	// are cancelled.
	LongTailMargin int
}

ConcurrentSegmentUploadsConfig is the configuration for concurrent segment uploads using the new upload codepath.

func DefaultConcurrentSegmentUploadsConfig added in v1.11.0

func DefaultConcurrentSegmentUploadsConfig() ConcurrentSegmentUploadsConfig

DefaultConcurrentSegmentUploadsConfig returns the default ConcurrentSegmentUploadsConfig.

func GetConcurrentSegmentUploadsConfig added in v1.11.0

func GetConcurrentSegmentUploadsConfig(ctx context.Context) *ConcurrentSegmentUploadsConfig

GetConcurrentSegmentUploadsConfig returns the scheduler options to use with the new concurrent segment upload codepath, if no scheduler options have been set it will return default configuration. Concurrent segment upload code path can be disabled with DisableConcurrentSegmentUploads.

Jump to

Keyboard shortcuts

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