storage

package
v0.9.1-rc.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket interface {
	// File - Get a file reference for in this bucket
	File(key string) File
	// Files - Get all file references for this bucket
	Files(ctx context.Context) ([]File, error)
	// Name - Get the name of the bucket
	Name() string
}

Cloud storage bucket resource for large file storage.

type File

type File interface {
	// Name - Get the name of the file
	Name() string
	// Read - Read this object
	Read(ctx context.Context) ([]byte, error)
	// Write - Write this object
	Write(ctx context.Context, data []byte) error
	// Delete - Delete this object
	Delete(ctx context.Context) error
	// UploadUrl - Creates a signed Url for uploading this file reference
	UploadUrl(ctx context.Context, expiry int) (string, error)
	// DownloadUrl - Creates a signed Url for downloading this file reference
	DownloadUrl(ctx context.Context, expiry int) (string, error)
}

File - A file reference for a bucket

type Mode added in v0.8.0

type Mode int
const (
	ModeRead Mode = iota
	ModeWrite
)

type PresignUrlOptions added in v0.8.0

type PresignUrlOptions struct {
	Mode   Mode
	Expiry int
}

type Storage

type Storage interface {
	// Bucket - Get a bucket reference for the provided name
	Bucket(name string) Bucket
}

Storage - Nitric storage API client

func New

func New() (Storage, error)

New - Create a new Storage client with default options

Jump to

Keyboard shortcuts

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