r2

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	R2CredentialsEnv = "R2_CREDENTIALS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type R2

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

func (*R2) Attributes

func (r *R2) Attributes(bucket, prefix string) *system.Attrs

GetObjectAttributes gets the attributes of an object

func (*R2) BatchAttributes

func (r *R2) BatchAttributes(bucket, prefix string, recursive bool) []*system.Attrs

GetObjectsAttributes gets the attributes of all the objects under a prefix

func (*R2) Cat

func (r *R2) Cat(bucket, prefix string) []byte

OutputObject outputs an object

func (*R2) Copy

func (r *R2) Copy(srcBucket, srcPrefix, dstBucket, dstPrefix string)

CopyObject copies an object

func (*R2) Delete

func (r *R2) Delete(bucket, prefix string)

DeleteObject deletes an object

func (*R2) DiskUsage

func (r *R2) DiskUsage(bucket, prefix string, recursive bool) []system.DiskUsage

GetDiskUsageObjects gets disk usage of objects under a prefix

func (*R2) Download

func (r *R2) Download(
	bucket, prefix, dstFile string,
	forceChecksum bool,
	ctx system.RunContext,
)

DownloadObjectWithWorkerPool downloads a specific byte range of an object to a file.

func (*R2) IsDirectory

func (r *R2) IsDirectory(bucket, prefix string) bool

IsDirectory checks if is a directory case 1: gs://abc/def -> gs://abc/def/ : true case 2: gs://abc/de -> gs://abc/def/ : false case 3: gs://abc/def/ -> gs://abc/def/ : true case 4: gs://abc/def -> gs://abc/def : false

func (*R2) IsObject

func (r *R2) IsObject(bucket, prefix string) bool

IsObject checks if is an object case 1: gs://abc/def -> gs://abc/def/ : false case 2: gs://abc/de -> gs://abc/def/ : false case 3: gs://abc/def/ -> gs://abc/def/ : false case 4: gs://abc/def -> gs://abc/def : true

func (*R2) List

func (r *R2) List(bucket, prefix string, recursive bool) []*system.FileObject

List objects under a prefix

func (*R2) Move

func (r *R2) Move(srcBucket, srcPrefix, dstBucket, dstPrefix string)

MoveObject moves an object

func (*R2) MustEqualCRC32C

func (r *R2) MustEqualCRC32C(flag bool, localPath, bucket, object string)

MustEqualCRC32C compare CRC32C values if flag is set - compare a local file with an object from gcp - exit process if values are different

func (*R2) R2Attrs

func (r *R2) R2Attrs(bucket, prefix string) *R2Attributes

func (*R2) Scheme

func (g *R2) Scheme() string

func (*R2) Upload

func (r *R2) Upload(srcFile, bucket, prefix string, ctx system.RunContext)

UploadObject uploads an object from a file

type R2Attributes

type R2Attributes struct {
	S3Attrs *s3.GetObjectAttributesOutput
	Bucket  string
	Prefix  string
}

type R2Config

type R2Config struct {
	AccountID       string `json:"accountId"`
	AccessKeyID     string `json:"accessKeyId"`
	AccessKeySecret string `json:"accessKeySecret"`
}

Jump to

Keyboard shortcuts

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