blobfs

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 19 Imported by: 20

README

PkgGoDev

blobfs

Like ioutil but for various cloud object stores like AWS S3, GCS, etc. using GoCloud.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBucketURL added in v0.2.1

func CreateBucketURL(bucketURL, endpoint, region string) string

Types

type BlobFS

type BlobFS struct {
	CACert []byte
	// contains filtered or unexported fields
}

BlobFS provides a filesystem abstraction over various blob storage backends

func New

func New(storageURL string, prefix ...string) *BlobFS

func (*BlobFS) DeleteFile added in v0.1.8

func (fs *BlobFS) DeleteFile(ctx context.Context, filepath string) (err error)

func (*BlobFS) Exists

func (fs *BlobFS) Exists(ctx context.Context, filepath string) (exists bool, err error)

func (*BlobFS) OpenBucket added in v0.2.0

func (fs *BlobFS) OpenBucket(ctx context.Context, dir string) (bucket *blob.Bucket, err error)

func (*BlobFS) ReadFile

func (fs *BlobFS) ReadFile(ctx context.Context, filepath string) (bytes []byte, err error)

func (*BlobFS) SignedURL

func (fs *BlobFS) SignedURL(ctx context.Context, filepath string, opts *blob.SignedURLOptions) (url string, err error)

func (*BlobFS) WithCACert added in v0.2.3

func (fs *BlobFS) WithCACert(caCert []byte) *BlobFS

func (*BlobFS) WithMetricsHook added in v0.2.3

func (fs *BlobFS) WithMetricsHook(metricsHook TelemetryHook) *BlobFS

WithMetricsHook adds a telemetry hook to the BlobFS instance. NOTE: Any telemetry hook must be registered right after calling New() NOT safe for concurrent use

func (*BlobFS) WriteFile

func (fs *BlobFS) WriteFile(ctx context.Context, filepath string, data []byte) (err error)

type Interface added in v0.1.9

type Interface interface {
	WriteFile(ctx context.Context, filepath string, data []byte) error
	ReadFile(ctx context.Context, filepath string) ([]byte, error)
	DeleteFile(ctx context.Context, filepath string) error
	Exists(ctx context.Context, filepath string) (bool, error)
	SignedURL(ctx context.Context, filepath string, opts *blob.SignedURLOptions) (string, error)
	OpenBucket(ctx context.Context, dir string) (*blob.Bucket, error)
}

func NewInMemoryFS added in v0.1.4

func NewInMemoryFS() Interface

func NewOsFs added in v0.1.7

func NewOsFs() Interface

type Operation added in v0.2.3

type Operation int

Operation represents a filesystem operation

const (
	Write Operation = iota
	Read
	Delete
	Exists
	SignedURL
	OpenBucket
)

func (Operation) String added in v0.2.3

func (op Operation) String() string

type TelemetryHook added in v0.2.3

type TelemetryHook func(
	ctx context.Context,
	op Operation,
	dirName string,
	fileName string,
	storageType string,
	err error,
)

TelemetryHook is invoked after each filesystem operation It is intended for metrics, tracing, and observability

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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