blobx

package
v0.1.26 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlobNotFound           = errors.New("no blob with that name found")
	ErrBlobBusy               = errors.New("blob is busy, can't perform this action")
	ErrUnknownStorageAccount  = errors.New("unknown storage account")
	ErrBlockCountLimitReached = errors.New("block count limit reached for blob")
	ErrUploadFailed           = errors.New("blob upload failed")
	LockfileAlreadyExist      = errors.New("lockfile already exist")
	ErrMsgSizeTooBig          = errors.New("message exceeded 4 MB which is the limit")
)

Functions

func ParseAzureError added in v0.1.11

func ParseAzureError(err error) error

todo: add more errors

Types

type AccountConfig

type AccountConfig struct {
	Name string `validate:"required,min=2"`
	Key  string `validate:"required,min=2"`
}

type AccountConn added in v0.1.8

type AccountConn struct {
	// contains filtered or unexported fields
}

func NewAccount

func NewAccount(config *AccountConfig) (*AccountConn, error)

NewAccount returns an Azure implementation of a Storage account

func (*AccountConn) AcquireLease added in v0.1.9

func (a *AccountConn) AcquireLease(ctx context.Context, container string, blobName string) (string, error)

returns the leaseId for the file, and error if one occurred

func (*AccountConn) AppendBlob added in v0.1.8

func (a *AccountConn) AppendBlob(ctx context.Context, container string, reader io.Reader, blobName string, leaseId string) error

this method will handle acquire and release of the lease of the file if you already have the lease - then send in the leaseID

func (*AccountConn) BlobBytes added in v0.1.8

func (a *AccountConn) BlobBytes(ctx context.Context, container string, blob string) ([]byte, error)

func (*AccountConn) BlobReader added in v0.1.8

func (a *AccountConn) BlobReader(ctx context.Context, container string, blob string) (io.ReadCloser, error)

func (*AccountConn) GetBlobSASURI added in v0.1.8

func (a *AccountConn) GetBlobSASURI(ctx context.Context, container string, blobName string, opts SASOptions) (string, error)

func (*AccountConn) GetContainerSASURI added in v0.1.8

func (a *AccountConn) GetContainerSASURI(ctx context.Context, container string, opts SASOptions) (string, error)

func (*AccountConn) ListBlobs added in v0.1.8

func (a *AccountConn) ListBlobs(ctx context.Context, container string, prefix string) ([]string, error)

func (*AccountConn) ListBlobsByPattern added in v0.1.8

func (a *AccountConn) ListBlobsByPattern(ctx context.Context, container string, pattern string) ([]string, error)

func (*AccountConn) NewContainer added in v0.1.8

func (a *AccountConn) NewContainer(containerName string) (*ContainerConn, error)

Get the connection to a container in the storage account.

func (*AccountConn) ReleaseLease added in v0.1.9

func (a *AccountConn) ReleaseLease(ctx context.Context, container string, blobName string, leaseId string) error

func (*AccountConn) TruncateBlob added in v0.1.8

func (a *AccountConn) TruncateBlob(ctx context.Context, container string, blobName string, leaseId string) error

delete the blob if it exist and create an empty blob with the same name if you have the lease - send it in

type BlobStorage added in v0.1.8

type BlobStorage struct {
	// contains filtered or unexported fields
}

func New

func New(confs []*AccountConfig) (*BlobStorage, error)

A collection of storage accounts Send in confs for all blob storage accounts you want to connect to

func (*BlobStorage) AcquireLease added in v0.1.9

func (bs *BlobStorage) AcquireLease(ctx context.Context, account string, container string, blobName string) (string, error)

returns the leaseId for the file, and error if one occurred

func (*BlobStorage) AppendBlob added in v0.1.8

func (bs *BlobStorage) AppendBlob(ctx context.Context, account string, container string, reader io.Reader, blobName string, leaseId string) error

this method will handle acquire and release of the lease of the file if you already have the lease - then send in the leaseID

func (*BlobStorage) BlobBytes added in v0.1.8

func (bs *BlobStorage) BlobBytes(ctx context.Context, account string, container string, blob string) ([]byte, error)

func (*BlobStorage) BlobReader added in v0.1.8

func (bs *BlobStorage) BlobReader(ctx context.Context, account string, container string, blob string) (io.ReadCloser, error)

func (*BlobStorage) GetBlobSASURI added in v0.1.8

func (bs *BlobStorage) GetBlobSASURI(ctx context.Context, account string, container string, blobName string, opts SASOptions) (string, error)

func (*BlobStorage) GetContainerSASURI added in v0.1.8

func (bs *BlobStorage) GetContainerSASURI(ctx context.Context, account string, container string, opts SASOptions) (string, error)

func (*BlobStorage) ListBlobs added in v0.1.8

func (bs *BlobStorage) ListBlobs(ctx context.Context, account string, container string, prefix string) ([]string, error)

func (*BlobStorage) ListBlobsByPattern added in v0.1.8

func (bs *BlobStorage) ListBlobsByPattern(ctx context.Context, account string, container string, pattern string) ([]string, error)

func (*BlobStorage) ReleaseLease added in v0.1.9

func (bs *BlobStorage) ReleaseLease(ctx context.Context, account string, container string, blobName string, leaseId string) error

func (*BlobStorage) TruncateBlob added in v0.1.8

func (bs *BlobStorage) TruncateBlob(ctx context.Context, account string, container string, blobName string, leaseId string) error

delete the blob if it exist and create an empty blob with the same name if you have the lease - send it in

type ContainerConfig added in v0.1.8

type ContainerConfig struct {
	AccountName   string `validate:"required,min=2"`
	AccountKey    string `validate:"required,min=2"`
	ContainerName string `validate:"required,min=2"`
}

type ContainerConn added in v0.1.8

type ContainerConn struct {
	// contains filtered or unexported fields
}

func NewAccountContainerConn added in v0.1.8

func NewAccountContainerConn(conf ContainerConfig) (*ContainerConn, error)

Get a connection to a container in an azure storage account. Use this func if you don't have a connection to an Azure account already.

func NewContainerConn added in v0.1.8

func NewContainerConn(storage storage.BlobStorageClient, containerName string) (*ContainerConn, error)

Get a connection to a container in an azure storage account. Use this func if you already have a connection to an Azure storage account.

func (*ContainerConn) AcquireLease added in v0.1.9

func (c *ContainerConn) AcquireLease(ctx context.Context, blobName string) (string, error)

returns the leaseId for the file, and error if one occurred

func (*ContainerConn) AppendBlob added in v0.1.8

func (c *ContainerConn) AppendBlob(ctx context.Context, reader io.Reader, blobName string, leaseId string) error

this method will handle acquire and release of the lease of the file if you already have the lease - send in the current leaseID

func (*ContainerConn) BlobBytes added in v0.1.8

func (c *ContainerConn) BlobBytes(ctx context.Context, blob string) ([]byte, error)

func (*ContainerConn) BlobReader added in v0.1.8

func (c *ContainerConn) BlobReader(ctx context.Context, blobName string) (io.ReadCloser, error)

func (*ContainerConn) GetBlobSASURI added in v0.1.8

func (c *ContainerConn) GetBlobSASURI(ctx context.Context, blobName string, opts SASOptions) (string, error)

func (*ContainerConn) GetContainerSASURI added in v0.1.8

func (c *ContainerConn) GetContainerSASURI(ctx context.Context, opts SASOptions) (string, error)

func (*ContainerConn) ListBlobs added in v0.1.8

func (c *ContainerConn) ListBlobs(ctx context.Context, prefix string) ([]string, error)

func (*ContainerConn) ListBlobsByPattern added in v0.1.8

func (c *ContainerConn) ListBlobsByPattern(ctx context.Context, pattern string) ([]string, error)

func (*ContainerConn) ReleaseLease added in v0.1.9

func (c *ContainerConn) ReleaseLease(ctx context.Context, blobName string, leaseId string) error

func (*ContainerConn) TruncateBlob added in v0.1.8

func (c *ContainerConn) TruncateBlob(ctx context.Context, blobName string, leaseId string) error

delete the blob if it exist and create an empty blob with the same name if you have the lease - send it in

type SASOptions added in v0.1.8

type SASOptions struct {
	ValidFrom    time.Time
	ValidTo      time.Time
	ReadAccess   bool
	AddAccess    bool
	CreateAccess bool
	WriteAccess  bool
	DeleteAccess bool
	ListAccess   bool
}

Jump to

Keyboard shortcuts

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