package shared
import "github.com/Azure/azure-sdk-for-go/sdk/storage/azblob/internal/shared"
Index ¶
- Constants
- func CopyOptions[T any](opts *T) *T
- func DoBatchTransfer(ctx context.Context, o *BatchTransferOptions) error
- func GenerateLeaseID(leaseID *string) (*string, error)
- func GetClientOptions[T any](o *T) *T
- func IsIPEndpointStyle(host string) bool
- func NewBytesWriter(b []byte) bytesWriter
- func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser
- func RangeToString(offset, count int64) string
- func SerializeBlobTags(tagsMap map[string]string) *generated.BlobTags
- func SerializeBlobTagsToStrPtr(tagsMap map[string]string) *string
- func ValidateSeekableStreamAt0AndGetCount(body io.ReadSeeker) (int64, error)
- type BatchTransferOptions
- type ParsedConnectionString
- type SectionWriter
- func NewSectionWriter(c io.WriterAt, off int64, count int64) *SectionWriter
- func (c *SectionWriter) Write(p []byte) (int, error)
- type TransferManager
Constants ¶
const ( HeaderAuthorization = "Authorization" HeaderXmsDate = "x-ms-date" HeaderContentLength = "Content-Length" HeaderContentEncoding = "Content-Encoding" HeaderContentLanguage = "Content-Language" HeaderContentType = "Content-Type" HeaderContentMD5 = "Content-MD5" HeaderIfModifiedSince = "If-Modified-Since" HeaderIfMatch = "If-Match" HeaderIfNoneMatch = "If-None-Match" HeaderIfUnmodifiedSince = "If-Unmodified-Since" HeaderRange = "Range" )
const (
TokenScope = "https://storage.azure.com/.default"
)
Functions ¶
func CopyOptions ¶
func CopyOptions[T any](opts *T) *T
CopyOptions returns a zero-value T if opts is nil. If opts is not nil, a copy is made and its address returned.
func DoBatchTransfer ¶
func DoBatchTransfer(ctx context.Context, o *BatchTransferOptions) error
DoBatchTransfer helps to execute operations in a batch manner. Can be used by users to customize batch works (for other scenarios that the SDK does not provide)
func GenerateLeaseID ¶
func GetClientOptions ¶
func GetClientOptions[T any](o *T) *T
func IsIPEndpointStyle ¶
IsIPEndpointStyle checkes if URL's host is IP, in this case the storage account endpoint will be composed as: http(s)://IP(:port)/storageaccount/container/... As url's Host property, host could be both host or host:port
func NewBytesWriter ¶
func NewBytesWriter(b []byte) bytesWriter
func NopCloser ¶
func NopCloser(rs io.ReadSeeker) io.ReadSeekCloser
NopCloser returns a ReadSeekCloser with a no-op close method wrapping the provided io.ReadSeeker.
func RangeToString ¶
func SerializeBlobTags ¶
SerializeBlobTags converts tags to generated.BlobTags
func SerializeBlobTagsToStrPtr ¶
func ValidateSeekableStreamAt0AndGetCount ¶
func ValidateSeekableStreamAt0AndGetCount(body io.ReadSeeker) (int64, error)
Types ¶
type BatchTransferOptions ¶
type BatchTransferOptions struct { TransferSize int64 ChunkSize int64 Concurrency uint16 Operation func(offset int64, chunkSize int64, ctx context.Context) error OperationName string }
BatchTransferOptions identifies options used by doBatchTransfer.
type ParsedConnectionString ¶
func ParseConnectionString ¶
func ParseConnectionString(connectionString string) (ParsedConnectionString, error)
type SectionWriter ¶
func NewSectionWriter ¶
func NewSectionWriter(c io.WriterAt, off int64, count int64) *SectionWriter
func (*SectionWriter) Write ¶
func (c *SectionWriter) Write(p []byte) (int, error)
type TransferManager ¶
type TransferManager interface { // Get provides a buffer that will be used to read data into and write out to the stream. // It is guaranteed by this package to not read or write beyond the size of the slice. Get() []byte // Put may or may not put the buffer into underlying storage, depending on settings. // The buffer must not be touched after this has been called. Put(b []byte) // nolint // Run will use a goroutine pool entry to run a function. This blocks until a pool // goroutine becomes available. Run(func()) // Close shuts down all internal goroutines. This must be called when the TransferManager // will no longer be used. Not closing it will cause a goroutine leak. Close() }
TransferManager provides a buffer and thread pool manager for certain transfer options. It is undefined behavior if code outside this package call any of these methods.
func NewStaticBuffer ¶
func NewStaticBuffer(size, max int) (TransferManager, error)
NewStaticBuffer creates a TransferManager that will use a channel as a circular buffer that can hold "max" buffers of "size". The goroutine pool is also sized at max. This can be shared between calls if you wish to control maximum memory and concurrency with multiple concurrent calls.
func NewSyncPool ¶
func NewSyncPool(size, concurrency int) (TransferManager, error)
NewSyncPool creates a TransferManager that will use a sync.Pool that can hold a non-capped number of buffers constrained by concurrency. This can be shared between calls if you wish to share memory and concurrency.
Source Files ¶
batch_transfer.go bytes_writer.go section_writer.go shared.go transfer_manager.go
- Version
- v0.5.1
- Published
- Oct 11, 2022
- Platform
- js/wasm
- Imports
- 12 packages
- Last checked
- 50 minutes ago –
Tools for package owners.