util

package
v0.0.0-...-a55ed6e Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockSize

func GetBlockSize(filesize int64, minBlockSize int64) (blockSize int64)

func GetKVSecret

func GetKVSecret(kvURL, kvSecretName string) (secret string, err error)

GetKVSecret returns string secret by name 'kvSecretName' in keyvault 'kvName' Uses MSI auth to login

func HTTPClientFactory

func HTTPClientFactory(client *http.Client) pipeline.FactoryFunc

HTTPClientFactory returns http sender with given client

func InitJobLogger

func InitJobLogger(minimumLevelToLog pipeline.LogLevel)

func Log

func Log(logLevel pipeline.LogLevel, msg string)

func NewAzCopyLogSanitizer

func NewAzCopyLogSanitizer() pipeline.LogSanitizer

func NewPipeline

NewPipeline creates a blobpipeline with these options

func NewRateLimiterPolicy

func NewRateLimiterPolicy(ctx context.Context, pacer Pacer) pipeline.Factory

func NewReadLogFunc

func NewReadLogFunc(redactedURL string) func(int, error, int64, int64, bool)

func NewTokenBucketPacer

func NewTokenBucketPacer(bytesPerSecond int64, expectedBytesPerCoarseRequest int64) *tokenBucketPacer

* NewTokenBucketPacer creates a new pacer with given config

Types

type ILogger

type ILogger interface {
	OpenLog()
	CloseLog()
	Log(level pipeline.LogLevel, msg string)
	Panic(err error)
}

type Pacer

type Pacer interface {

	// RequestTrafficAllocation blocks until the caller is allowed to process byteCount bytes.
	RequestTrafficAllocation(ctx context.Context, byteCount int64) error

	// UndoRequest reverses a previous request to process n bytes.  Is used when
	// the caller did not need all of the allocation they previously requested
	// e.g. when they asked for enough for a big buffer, but never filled it, they would
	// call this method to return the unused portion.
	UndoRequest(byteCount int64)

	// GetTotalTraffic returns the cumulative count of all traffic that has been processed
	GetTotalTraffic() int64

	Close() error
}

pacer is used by callers whose activity must be controlled to a certain pace

Jump to

Keyboard shortcuts

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