object

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMethodNotAllowed = errors.New("method not allowed")

ErrMethodNotAllowed is returned when method is not allowed against specified entity (e.g. object).

View Source
var ErrNoObjectLockConfiguration = errors.New("destination bucket has no object lock configuration")

ErrNoObjectLockConfiguration is returned when a locked object is copied to a bucket without object lock configuration.

Functions

func GetObjectIPs

func GetObjectIPs(ctx context.Context, config uplink.Config, access *uplink.Access, bucket, key string) (_ [][]byte, err error)

GetObjectIPs returns the IP-s for a given object.

TODO: delete, once we have stopped using it.

func GetObjectRetention added in v1.13.1

func GetObjectRetention(ctx context.Context, project *uplink.Project, bucket, key string, version []byte) (retention *metaclient.Retention, err error)

GetObjectRetention retrieves the retention for the object at the specific key and version ID.

func SetObjectRetention added in v1.13.1

func SetObjectRetention(ctx context.Context, project *uplink.Project, bucket, key string, version []byte, retention metaclient.Retention) (err error)

SetObjectRetention sets the retention for the object at the specific key and version ID.

Types

type CopyObjectOptions added in v1.13.1

type CopyObjectOptions struct {
	Retention metaclient.Retention
}

CopyObjectOptions options for CopyObject method.

type IPSummary added in v1.4.6

type IPSummary = metaclient.GetObjectIPsResponse

IPSummary contains information about the object IP-s.

func GetObjectIPSummary added in v1.4.6

func GetObjectIPSummary(ctx context.Context, config uplink.Config, access *uplink.Access, bucket, key string) (_ *IPSummary, err error)

GetObjectIPSummary returns the object IP summary.

type ListObjectVersionsOptions added in v1.13.0

type ListObjectVersionsOptions struct {
	Prefix        string
	Cursor        string
	VersionCursor []byte
	Recursive     bool
	System        bool
	Custom        bool
	Limit         int
}

ListObjectVersionsOptions defines listing options for versioned objects.

type UploadOptions added in v1.13.1

type UploadOptions = metaclient.UploadOptions

UploadOptions contains additional options for uploading objects.

type VersionedDownload added in v1.13.0

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

VersionedDownload is a download from Storj Network.

func DownloadObject added in v1.13.0

func DownloadObject(ctx context.Context, project *uplink.Project, bucket, key string, version []byte, options *uplink.DownloadOptions) (_ *VersionedDownload, err error)

DownloadObject starts a download from the specific key and version. If version is empty latest object will be downloaded.

func (*VersionedDownload) Close added in v1.13.0

func (download *VersionedDownload) Close() error

Close closes the reader of the download.

func (*VersionedDownload) Info added in v1.13.0

func (download *VersionedDownload) Info() *VersionedObject

Info returns the last information about the object.

func (*VersionedDownload) Read added in v1.13.0

func (download *VersionedDownload) Read(p []byte) (n int, err error)

Read downloads up to len(p) bytes into p from the object's data stream. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.

type VersionedObject added in v1.12.2

type VersionedObject struct {
	uplink.Object
	Version        []byte
	IsDeleteMarker bool
	Retention      *metaclient.Retention
}

VersionedObject represents object with version. TODO find better place of name for this and related things.

func CommitUpload added in v1.13.0

func CommitUpload(ctx context.Context, project *uplink.Project, bucket, key, uploadID string, opts *uplink.CommitUploadOptions) (info *VersionedObject, err error)

CommitUpload commits a multipart upload to bucket and key started with BeginUpload.

uploadID is an upload identifier returned by BeginUpload.

func CopyObject added in v1.13.0

func CopyObject(ctx context.Context, project *uplink.Project, sourceBucket, sourceKey string, sourceVersion []byte, targetBucket, targetKey string, options CopyObjectOptions) (_ *VersionedObject, err error)

CopyObject atomically copies object to a different bucket or/and key.

func DeleteObject added in v1.13.0

func DeleteObject(ctx context.Context, project *uplink.Project, bucket, key string, version []byte) (info *VersionedObject, err error)

DeleteObject deletes the object at the specific key. Returned deleted is not nil when the access grant has read permissions and the object was deleted. TODO(ver) currently we are returning object that was returned by satellite if its regular object (status != delete marker) it means no delete marker was created.

func ListObjectVersions added in v1.13.0

func ListObjectVersions(ctx context.Context, project *uplink.Project, bucket string, options *ListObjectVersionsOptions) (_ []*VersionedObject, more bool, err error)

ListObjectVersions returns a list of objects and their versions.

func StatObject added in v1.12.2

func StatObject(ctx context.Context, project *uplink.Project, bucket, key string, version []byte) (info *VersionedObject, err error)

StatObject returns information about an object at the specific key and version.

type VersionedUpload added in v1.13.0

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

VersionedUpload represents upload which returnes object version at the end.

func UploadObject added in v1.13.0

func UploadObject(ctx context.Context, project *uplink.Project, bucket, key string, options *UploadOptions) (_ *VersionedUpload, err error)

UploadObject starts an upload to the specific key.

It is not guaranteed that the uncommitted object is visible through ListUploads while uploading.

func (*VersionedUpload) Abort added in v1.13.0

func (upload *VersionedUpload) Abort() error

Abort aborts the upload.

Returns ErrUploadDone when either Abort or Commit has already been called.

func (*VersionedUpload) Commit added in v1.13.0

func (upload *VersionedUpload) Commit() error

Commit commits data to the store.

Returns ErrUploadDone when either Abort or Commit has already been called.

func (*VersionedUpload) Info added in v1.13.0

func (upload *VersionedUpload) Info() *VersionedObject

Info returns the last information about the uploaded object.

func (*VersionedUpload) SetCustomMetadata added in v1.13.0

func (upload *VersionedUpload) SetCustomMetadata(ctx context.Context, custom uplink.CustomMetadata) error

SetCustomMetadata updates custom metadata to be included with the object. If it is nil, it won't be modified.

func (*VersionedUpload) Write added in v1.13.0

func (upload *VersionedUpload) Write(p []byte) (n int, err error)

Write uploads len(p) bytes from p to the object's data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early.

Jump to

Keyboard shortcuts

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