Documentation
¶
Index ¶
- Constants
- Variables
- func AddCommonBlobRequestHeaders(header http.Header)
- func DownloadBlob(ctx context.Context, metrics *TransferMetrics, ...) (*readData, *time.Time, error)
- func Gen(byteCount int64, outputWriter io.Writer) error
- func GetBufferAccessUrlFromFile(filename string) (*url.URL, error)
- func GetFreePort() (port int, err error)
- func MakeBlobPath(blobNumber int64) string
- func NewSshTunnelPool(ctx context.Context, sshParams client.SshParams, count int) *sshTunnelPool
- func ParseBufferAccessUrl(accessString string) (*url.URL, error)
- func Read(ctx context.Context, container *Container, outputWriter io.Writer, ...) error
- func RelayInputServer(ctx context.Context, listeners []net.Listener, bufferId string, ...) error
- func RelayOutputServer(ctx context.Context, listeners []net.Listener, containerId string, ...) error
- func RequestNewBufferAccessUrl(ctx context.Context, bufferId string, writable bool, accessTtl string) (*url.URL, error)
- func ValidateSas(containerId string, action SasAction, queryString url.Values, ...) error
- func Write(ctx context.Context, container *Container, inputReader io.Reader, ...) error
- type BufferBlob
- type BufferEndMetadata
- type BufferStartMetadata
- type BufferStatus
- type Container
- func NewContainer(accessUrl *url.URL) *Container
- func NewContainerFromAccessFile(ctx context.Context, filename string) (*Container, error)
- func NewContainerFromAccessString(ctx context.Context, accessString string) (*Container, error)
- func NewContainerFromBufferId(ctx context.Context, bufferId string, writeable bool, accessTtl string) (*Container, error)
- type ContainerClient
- func (c *ContainerClient) Do(req *retryablehttp.Request) (*http.Response, error)
- func (c *ContainerClient) NewNonRetryableRequestWithRelativeUrl(ctx context.Context, method string, relativeUrl string, body io.Reader) *http.Request
- func (c *ContainerClient) NewRequestWithRelativeUrl(ctx context.Context, method string, relativeUrl string, body any) *retryablehttp.Request
- type DownloadProgressReader
- type InvalidAccessUrlError
- type MergedContext
- type PartiallyBufferedReader
- type ReadOption
- type ReaderWithMetrics
- type SasAction
- type TransferMetrics
- type UploadProgressReader
- type ValidateSignatureFunc
- type ValueOrError
- type WriteOption
- func WithWriteBlockSize(blockSize int) WriteOption
- func WithWriteDop(dop int) WriteOption
- func WithWriteFlushInterval(flushInterval time.Duration) WriteOption
- func WithWriteHttpClient(httpClient *retryablehttp.Client) WriteOption
- func WithWriteMetadataEndWriteTimeout(timeout time.Duration) WriteOption
Constants ¶
View Source
const ( CurrentBufferFormatVersion = "0.3.0" BufferStatusComplete BufferStatus = "complete" BufferStatusFailed BufferStatus = "failed" HashChainHeader = "x-ms-meta-cumulative_hash_chain" ContentMD5Header = "Content-MD5" ErrorCodeHeader = "x-ms-error-code" StartMetadataBlobName = ".bufferstart" EndMetadataBlobName = ".bufferend" )
View Source
const ( DefaultReadDop = 32 MaxRetries = 6 ResponseTimeout = 100 * time.Second )
View Source
const ( DefaultWriteDop = 16 DefaultBlockSize = 4 * 1024 * 1024 EncodedHashChainInitialValue = "MDAwMDAwMDAwMDAwMDAwMA==" )
View Source
const (
AuthorizationPermissionMismatchErrorCode = "AuthorizationPermissionMismatch"
)
View Source
const CurrentSasVersion = "0.1.0"
Variables ¶
View Source
var ( ErrNotFound = errors.New("not found") ErrBufferFailedState = errors.New("the buffer is in a permanently failed state") )
View Source
var ( ErrInvalidSas = errors.New("the SAS token is not valid") ErrSasActionNotAllowed = errors.New("the requested action is not permissed with the given SAS token") )
View Source
var (
DefaultFlushInterval = 1 * time.Second
)
View Source
var (
ErrAccessStringNotUrl = errors.New("the buffer access string is invalid. It must be a URL or the path of a file whose contents is a URL")
)
Functions ¶
func DownloadBlob ¶
func GetFreePort ¶
func MakeBlobPath ¶
func NewSshTunnelPool ¶
func RelayInputServer ¶
func RelayOutputServer ¶
func RelayOutputServer( ctx context.Context, listeners []net.Listener, containerId string, inputReaderChan <-chan ValueOrError[io.ReadCloser], validateSignatureFunc ValidateSignatureFunc, ) error
func ValidateSas ¶
Types ¶
type BufferBlob ¶
type BufferEndMetadata ¶
type BufferEndMetadata struct {
Status BufferStatus `json:"status"`
}
type BufferStartMetadata ¶
type BufferStartMetadata struct {
Version string `json:"version"`
}
type BufferStatus ¶
type BufferStatus string
type Container ¶
type Container struct {
// contains filtered or unexported fields
}
func NewContainer ¶
func (*Container) GetContainerName ¶
func (*Container) NewContainerClient ¶
func (c *Container) NewContainerClient(httpClient *retryablehttp.Client) *ContainerClient
func (*Container) SupportsRelay ¶
type ContainerClient ¶
type ContainerClient struct {
// contains filtered or unexported fields
}
func (*ContainerClient) Do ¶
func (c *ContainerClient) Do(req *retryablehttp.Request) (*http.Response, error)
func (*ContainerClient) NewNonRetryableRequestWithRelativeUrl ¶
func (*ContainerClient) NewRequestWithRelativeUrl ¶
func (c *ContainerClient) NewRequestWithRelativeUrl(ctx context.Context, method string, relativeUrl string, body any) *retryablehttp.Request
type DownloadProgressReader ¶
type DownloadProgressReader struct {
Reader io.ReadCloser
TransferMetrics *TransferMetrics
}
func (*DownloadProgressReader) Close ¶
func (pr *DownloadProgressReader) Close() error
type InvalidAccessUrlError ¶
type InvalidAccessUrlError struct {
Reason string
}
func (*InvalidAccessUrlError) Error ¶
func (e *InvalidAccessUrlError) Error() string
type MergedContext ¶
type MergedContext struct {
context.Context // The context that is is used for deadlines and cancellation
// contains filtered or unexported fields
}
func (*MergedContext) Value ¶
func (c *MergedContext) Value(key any) any
type PartiallyBufferedReader ¶
An io.Reader that stores the first N bytes read from the underlying reader as they are read so that it can be rewound and read again, if <= N bytes were read.
func NewPartiallyBufferedReader ¶
func NewPartiallyBufferedReader(r io.Reader, capacity int) *PartiallyBufferedReader
func (*PartiallyBufferedReader) Read ¶
func (r *PartiallyBufferedReader) Read(p []byte) (n int, err error)
func (*PartiallyBufferedReader) Rewind ¶
func (r *PartiallyBufferedReader) Rewind() error
type ReadOption ¶
type ReadOption func(o *readOptions)
func WithReadDop ¶
func WithReadDop(dop int) ReadOption
func WithReadHttpClient ¶
func WithReadHttpClient(httpClient *retryablehttp.Client) ReadOption
type ReaderWithMetrics ¶
type ReaderWithMetrics struct {
// contains filtered or unexported fields
}
type TransferMetrics ¶
type TransferMetrics struct {
// contains filtered or unexported fields
}
func NewTransferMetrics ¶
func NewTransferMetrics(ctx context.Context) *TransferMetrics
func (*TransferMetrics) EnsureStarted ¶
func (ts *TransferMetrics) EnsureStarted(startTime *time.Time)
func (*TransferMetrics) Stop ¶
func (ts *TransferMetrics) Stop()
func (*TransferMetrics) UpdateCompleted ¶
func (ts *TransferMetrics) UpdateCompleted(byteCount uint64, completedBuffers uint64)
Called when a buffer or buffer have been completely transferred
func (*TransferMetrics) UpdateInFlight ¶
func (ts *TransferMetrics) UpdateInFlight(byteCount uint64)
Called when data HTTP body is being read or written. Note that because of retries, this
type UploadProgressReader ¶
type UploadProgressReader struct {
Reader *bytes.Reader
TransferMetrics *TransferMetrics
}
func (*UploadProgressReader) Len ¶
func (ts *UploadProgressReader) Len() int
Implement retryablehttp.LenReader
type ValidateSignatureFunc ¶
func CreateSignatureValidationFunc ¶
func CreateSignatureValidationFunc(primarySigningPublicKeyPath, secondarySigningPublicKeyPath string) (ValidateSignatureFunc, error)
type ValueOrError ¶
type WriteOption ¶
type WriteOption func(o *writeOptions)
func WithWriteBlockSize ¶
func WithWriteBlockSize(blockSize int) WriteOption
func WithWriteDop ¶
func WithWriteDop(dop int) WriteOption
func WithWriteFlushInterval ¶
func WithWriteFlushInterval(flushInterval time.Duration) WriteOption
func WithWriteHttpClient ¶
func WithWriteHttpClient(httpClient *retryablehttp.Client) WriteOption
func WithWriteMetadataEndWriteTimeout ¶
func WithWriteMetadataEndWriteTimeout(timeout time.Duration) WriteOption
Click to show internal directories.
Click to hide internal directories.