azblob

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountRole added in v0.1.19

func AccountRole(account string) (string, bool)

AccountRole returns the role ("SRC" or "DST") registered for the given account, and a boolean indicating whether a role was registered.

func ClearAccountRole added in v0.1.19

func ClearAccountRole(account string)

ClearAccountRole removes the role registration for the given account. This is used in tests to reset state between subtests.

func CopyBlobServerSide added in v0.1.12

func CopyBlobServerSide(ctx context.Context, src AzurePath, dst AzurePath, concurrency int, sizeHint int64, onProgress CopyProgress) error

func Delete

func Delete(ctx context.Context, ap AzurePath) error

Delete deletes a single blob

func DeletePrefix

func DeletePrefix(ctx context.Context, ap AzurePath) error

DeletePrefix deletes all blobs under directory-like path

func Download

func Download(ctx context.Context, ap AzurePath) ([]byte, error)

Download returns blob content bytes (for small blobs)

func DownloadStream added in v0.1.8

func DownloadStream(ctx context.Context, ap AzurePath) (io.ReadCloser, error)

func HeadBlob

func HeadBlob(ctx context.Context, ap AzurePath) (int64, error)

HeadBlob returns size (bytes) of blob

func IsBlobURL added in v0.1.5

func IsBlobURL(raw string) bool

IsBlobURL performs a lightweight check whether the provided string is a blob endpoint URL.

func ListRecursiveStream added in v0.1.18

func ListRecursiveStream(ctx context.Context, ap AzurePath, scanConcurrency int, cb func(BlobMeta) error) error

func ListStream added in v0.1.16

func ListStream(ctx context.Context, ap AzurePath, cb func(BlobMeta) error) error

ListStream streams immediate children (non-recursive). If dir-like path provided, lists under it.

func MkContainer

func MkContainer(ctx context.Context, account, container string) error

MkContainer creates a new Azure Blob container

func PreAuthenticate added in v0.1.19

func PreAuthenticate(ctx context.Context, accounts ...string) error

PreAuthenticate eagerly authenticates to the given storage accounts sequentially. This ensures any interactive login popups happen one at a time before parallel workers start. It also pre-warms the blob client and UDC (User Delegation Credential) caches so that no credential acquisition happens during copy.

func RegisterAccountRole added in v0.1.19

func RegisterAccountRole(account, role string)

RegisterAccountRole tags the given storage account with a role ("SRC" or "DST"). When role-prefixed Azure identity environment variables are set (e.g. SRC_AZURE_TENANT_ID, DST_AZURE_CLIENT_ID, etc.), accounts tagged with the matching role will use those credentials instead of AzureCLI or interactive browser login. This makes authentication machine-friendly for CI/CD and multi-tenant environments.

func Touch added in v0.1.4

func Touch(ctx context.Context, ap AzurePath) error

Touch ensures the blob exists by creating an empty object when missing.

func Upload

func Upload(ctx context.Context, ap AzurePath, data []byte) error

Upload writes blob (overwrite)

func UploadStream added in v0.1.8

func UploadStream(ctx context.Context, ap AzurePath, reader io.Reader, concurrency int) error

UploadStream writes blob content from a reader (overwrite).

Types

type AzurePath

type AzurePath struct {
	Account   string
	Container string
	Blob      string // may be empty or end with '/' for virtual directory
}

AzurePath represents an az:// path (account/container/blob)

func Parse

func Parse(raw string) (AzurePath, error)

Parse parses az://account/container[/blob] or https://account.blob.* URLs.

func (AzurePath) Child

func (p AzurePath) Child(rel string) AzurePath

func (AzurePath) IsDirLike

func (p AzurePath) IsDirLike() bool

func (AzurePath) String

func (p AzurePath) String() string

func (AzurePath) WithDir

func (p AzurePath) WithDir() AzurePath

type BlobMeta

type BlobMeta struct {
	Name string
	Size int64
}

BlobMeta minimal metadata for listing

func List

func List(ctx context.Context, ap AzurePath) ([]BlobMeta, error)

List lists immediate children (non-recursive). If dir-like path provided, lists under it.

func ListContainers

func ListContainers(ctx context.Context, account string) ([]BlobMeta, error)

ListContainers lists all containers in the account

func ListRecursive

func ListRecursive(ctx context.Context, ap AzurePath) ([]BlobMeta, error)

ListRecursive retrieves all blobs under path (treats path as prefix root)

type CopyProgress added in v0.1.17

type CopyProgress func(copied, total int64)

CopyProgress is called during server-side copy with the number of bytes copied so far and the total size in bytes.

Jump to

Keyboard shortcuts

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