Documentation ¶
Index ¶
- Variables
- type Access
- type Bucket
- type BucketIterator
- type Config
- type CustomMetadata
- type Download
- type DownloadOptions
- type ListBucketsOptions
- type ListObjectsOptions
- type Object
- type ObjectIterator
- type Permission
- type Project
- func (project *Project) Close() error
- func (project *Project) CreateBucket(ctx context.Context, bucket string) (created *Bucket, err error)
- func (project *Project) DeleteBucket(ctx context.Context, bucket string) (deleted *Bucket, err error)
- func (project *Project) DeleteObject(ctx context.Context, bucket, key string) (deleted *Object, err error)
- func (project *Project) DownloadObject(ctx context.Context, bucket, key string, options *DownloadOptions) (download *Download, err error)
- func (project *Project) EnsureBucket(ctx context.Context, bucket string) (ensured *Bucket, err error)
- func (project *Project) ListBuckets(ctx context.Context, options *ListBucketsOptions) *BucketIterator
- func (project *Project) ListObjects(ctx context.Context, bucket string, options *ListObjectsOptions) *ObjectIterator
- func (project *Project) StatBucket(ctx context.Context, bucket string) (info *Bucket, err error)
- func (project *Project) StatObject(ctx context.Context, bucket, key string) (info *Object, err error)
- func (project *Project) UploadObject(ctx context.Context, bucket, key string, options *UploadOptions) (upload *Upload, err error)
- type SharePrefix
- type SystemMetadata
- type Upload
- type UploadOptions
Constants ¶
This section is empty.
Variables ¶
var ErrBucketAlreadyExists = errs.Class("bucket already exists")
ErrBucketAlreadyExists is returned when the bucket already exists during creation.
var ErrBucketNameInvalid = errs.Class("bucket name invalid")
ErrBucketNameInvalid is returned when the bucket name is invalid.
var ErrBucketNotEmpty = errs.Class("bucket not empty")
ErrBucketNotEmpty is returned when the bucket is not empty during deletion.
var ErrBucketNotFound = errs.Class("bucket not found")
ErrBucketNotFound is returned when the bucket is not found.
var ErrObjectKeyInvalid = errs.Class("object key invalid")
ErrObjectKeyInvalid is returned when the object key is invalid.
var ErrObjectNotFound = errs.Class("object not found")
ErrObjectNotFound is returned when the object is not found.
var ErrUploadDone = errs.Class("upload done")
ErrUploadDone is returned when either Abort or Commit has already been called.
var Error = errs.Class("uplink")
Error is default error class for uplink.
Functions ¶
This section is empty.
Types ¶
type Access ¶
type Access struct {
// contains filtered or unexported fields
}
Access contains everything to access a project and specific buckets.
func ParseAccess ¶
ParseAccess parses access string.
func RequestAccessWithPassphrase ¶
func RequestAccessWithPassphrase(ctx context.Context, satelliteAddress, apiKey, passphrase string) (*Access, error)
RequestAccessWithPassphrase requests satellite for a new access using a passhprase.
func (*Access) Share ¶
func (access *Access) Share(permission Permission, prefixes ...SharePrefix) (*Access, error)
Share creates new Access with specific permission. Permission will be applied to prefixes when defined.
type BucketIterator ¶
type BucketIterator struct {
// contains filtered or unexported fields
}
BucketIterator is an iterator over a collection of buckets.
func (*BucketIterator) Err ¶
func (buckets *BucketIterator) Err() error
Err returns error, if one happened during iteration.
func (*BucketIterator) Item ¶
func (buckets *BucketIterator) Item() *Bucket
Item returns the current bucket in the iterator.
func (*BucketIterator) Next ¶
func (buckets *BucketIterator) Next() bool
Next prepares next Bucket for reading. It returns false if the end of the iteration is reached and there are no more buckets, or if there is an error.
type Config ¶
type Config struct { UserAgent string // DialTimeout defines how long client should wait for establishing // a connection to peers. DialTimeout time.Duration }
Config defines configuration for using uplink library.
func (Config) OpenProject ¶
OpenProject opens a project with the specific access.
type CustomMetadata ¶
CustomMetadata contains custom user metadata about the object.
The keys and values in custom metadata are expected to be valid UTF-8.
When choosing a custom key for your application start it with a prefix "app:key", as an example application named "Image Board" might use a key "image-board:title".
func (CustomMetadata) Clone ¶
func (meta CustomMetadata) Clone() CustomMetadata
Clone makes a deep clone.
func (CustomMetadata) Verify ¶
func (meta CustomMetadata) Verify() error
Verify verifies whether CustomMetadata contains only "utf-8".
type Download ¶
type Download struct {
// contains filtered or unexported fields
}
Download is a download from Storj Network.
type DownloadOptions ¶
type DownloadOptions struct { Offset int64 // When Length is negative it will read until the end of the blob. Length int64 }
DownloadOptions contains additional options for downloading.
type ListBucketsOptions ¶
type ListBucketsOptions struct { // Cursor sets the starting position of the iterator. The first item listed will be the one after the cursor. Cursor string }
ListBucketsOptions defines bucket listing options.
type ListObjectsOptions ¶
type ListObjectsOptions struct { // Prefix allows to filter objects by a key prefix. If not empty, it must end with slash. Prefix string // Cursor sets the starting position of the iterator. The first item listed will be the one after the cursor. Cursor string // Recursive iterates the objects without collapsing prefixes. Recursive bool // System includes SystemMetadata in the results. System bool // Custom includes CustomMetadata in the results. Custom bool }
ListObjectsOptions defines object listing options.
type Object ¶
type Object struct { Key string // IsPrefix indicates whether the Key is a prefix for other objects. IsPrefix bool System SystemMetadata Custom CustomMetadata }
Object contains information about an object.
type ObjectIterator ¶
type ObjectIterator struct {
// contains filtered or unexported fields
}
ObjectIterator is an iterator over a collection of objects or prefixes.
func (*ObjectIterator) Err ¶
func (objects *ObjectIterator) Err() error
Err returns error, if one happened during iteration.
func (*ObjectIterator) Item ¶
func (objects *ObjectIterator) Item() *Object
Item returns the current object in the iterator.
func (*ObjectIterator) Next ¶
func (objects *ObjectIterator) Next() bool
Next prepares next Object for reading. It returns false if the end of the iteration is reached and there are no more objects, or if there is an error.
type Permission ¶
type Permission struct { // AllowDownaload gives permission to download the object's content. It // allows getting object metadata, but it does not allow listing buckets. AllowDownload bool // AllowUpload gives permission to create buckets and upload new objects. // It does not allow overwriting existing objects unless AllowDelete is // granted too. AllowUpload bool // AllowList gives permission to list buckets. It allows getting object // metadata, but it does not allow downloading the object's content. AllowList bool // AllowDelete gives permission to delete buckets and objects. Unless // either AllowDownload or AllowList is granted too, no object metadata and // no error info will be returned for deleted objects. AllowDelete bool // NotBefore if set should be always before NotAfter. NotBefore time.Time // NotAfter if set should be always after NotBefore. NotAfter time.Time }
Permission defines what actions can be used to share.
func FullPermission ¶
func FullPermission() Permission
FullPermission returns permission that allows all actions.
func ReadOnlyPermission ¶
func ReadOnlyPermission() Permission
ReadOnlyPermission returns permission that allows reading and listing.
func WriteOnlyPermission ¶
func WriteOnlyPermission() Permission
WriteOnlyPermission returns permission that allows writing and deleting.
type Project ¶
type Project struct {
// contains filtered or unexported fields
}
Project provides access to managing buckets and objects.
func OpenProject ¶
OpenProject opens a project with the specific access.
func (*Project) CreateBucket ¶
func (project *Project) CreateBucket(ctx context.Context, bucket string) (created *Bucket, err error)
CreateBucket creates a new bucket.
When bucket already exists it returns a valid Bucket and ErrBucketExists.
func (*Project) DeleteBucket ¶
func (project *Project) DeleteBucket(ctx context.Context, bucket string) (deleted *Bucket, err error)
DeleteBucket deletes a bucket.
When bucket is not empty it returns ErrBucketNotEmpty.
func (*Project) DeleteObject ¶
func (project *Project) DeleteObject(ctx context.Context, bucket, key string) (deleted *Object, err error)
DeleteObject deletes the object at the specific key.
func (*Project) DownloadObject ¶
func (project *Project) DownloadObject(ctx context.Context, bucket, key string, options *DownloadOptions) (download *Download, err error)
DownloadObject starts a download from the specific key.
func (*Project) EnsureBucket ¶
func (project *Project) EnsureBucket(ctx context.Context, bucket string) (ensured *Bucket, err error)
EnsureBucket ensures that a bucket exists or creates a new one.
When bucket already exists it returns a valid Bucket and no error.
func (*Project) ListBuckets ¶
func (project *Project) ListBuckets(ctx context.Context, options *ListBucketsOptions) *BucketIterator
ListBuckets returns an iterator over the buckets.
func (*Project) ListObjects ¶
func (project *Project) ListObjects(ctx context.Context, bucket string, options *ListObjectsOptions) *ObjectIterator
ListObjects returns an iterator over the objects.
func (*Project) StatBucket ¶
StatBucket returns information about a bucket.
func (*Project) StatObject ¶
func (project *Project) StatObject(ctx context.Context, bucket, key string) (info *Object, err error)
StatObject returns information about an object at the specific key.
func (*Project) UploadObject ¶
func (project *Project) UploadObject(ctx context.Context, bucket, key string, options *UploadOptions) (upload *Upload, err error)
UploadObject starts an upload to the specific key.
type SharePrefix ¶
type SharePrefix struct { string }Prefix
SharePrefix defines a prefix that will be shared.
type SystemMetadata ¶
SystemMetadata contains information about the object that cannot be changed directly.
type Upload ¶
type Upload struct {
// contains filtered or unexported fields
}
Upload is an upload to Storj Network.
func (*Upload) Abort ¶
Abort aborts the upload.
Returns ErrUploadDone when either Abort or Commit has already been called.
func (*Upload) Commit ¶
Commit commits data to the store.
Returns ErrUploadDone when either Abort or Commit has already been called.
func (*Upload) SetCustomMetadata ¶
func (upload *Upload) SetCustomMetadata(ctx context.Context, custom CustomMetadata) error
SetCustomMetadata updates custom metadata to be included with the object. If it is nil, it won't be modified.
type UploadOptions ¶
UploadOptions contains additional options for uploading.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package backcomp contains utilities for handling backwards incompatible changes.
|
Package backcomp contains utilities for handling backwards incompatible changes. |
internal
|
|
private
|
|