Documentation ¶
Index ¶
- Constants
- Variables
- func WithRetry(ctx context.Context, fn func(ctx context.Context) error) (err error)
- type BatchItem
- type BatchResponse
- func (resp *BatchResponse) BeginDeleteObject() (BeginDeleteObjectResponse, error)
- func (resp *BatchResponse) BeginObject() (BeginObjectResponse, error)
- func (resp *BatchResponse) BeginSegment() (BeginSegmentResponse, error)
- func (resp *BatchResponse) CreateBucket() (CreateBucketResponse, error)
- func (resp *BatchResponse) DownloadSegment() (DownloadSegmentResponse, error)
- func (resp *BatchResponse) GetBucket() (GetBucketResponse, error)
- func (resp *BatchResponse) GetObject() (GetObjectResponse, error)
- func (resp *BatchResponse) ListBuckets() (ListBucketsResponse, error)
- func (resp *BatchResponse) ListObjects() (ListObjectsResponse, error)
- type Batcher
- type BeginCopyObjectParams
- type BeginCopyObjectResponse
- type BeginDeleteObjectParams
- type BeginDeleteObjectResponse
- type BeginMoveObjectParams
- type BeginMoveObjectResponse
- type BeginObjectParams
- type BeginObjectResponse
- type BeginSegmentParams
- type BeginSegmentResponse
- type Bucket
- type BucketIterator
- type BucketList
- type BucketListOptions
- type Client
- func (client *Client) Batch(ctx context.Context, requests ...BatchItem) (resp []BatchResponse, err error)
- func (client *Client) BeginCopyObject(ctx context.Context, params BeginCopyObjectParams) (_ BeginCopyObjectResponse, err error)
- func (client *Client) BeginDeleteObject(ctx context.Context, params BeginDeleteObjectParams) (_ RawObjectItem, err error)
- func (client *Client) BeginMoveObject(ctx context.Context, params BeginMoveObjectParams) (_ BeginMoveObjectResponse, err error)
- func (client *Client) BeginObject(ctx context.Context, params BeginObjectParams) (_ BeginObjectResponse, err error)
- func (client *Client) BeginSegment(ctx context.Context, params BeginSegmentParams) (_ BeginSegmentResponse, err error)
- func (client *Client) Close() error
- func (client *Client) CommitObject(ctx context.Context, params CommitObjectParams) (err error)
- func (client *Client) CommitSegment(ctx context.Context, params CommitSegmentParams) (err error)
- func (client *Client) CreateBucket(ctx context.Context, params CreateBucketParams) (respBucket Bucket, err error)
- func (client *Client) DeleteBucket(ctx context.Context, params DeleteBucketParams) (_ Bucket, err error)
- func (client *Client) DownloadObject(ctx context.Context, params DownloadObjectParams) (_ DownloadObjectResponse, err error)
- func (client *Client) DownloadSegmentWithRS(ctx context.Context, params DownloadSegmentParams) (_ DownloadSegmentWithRSResponse, err error)
- func (client *Client) FinishCopyObject(ctx context.Context, params FinishCopyObjectParams) (_ FinishCopyObjectResponse, err error)
- func (client *Client) FinishMoveObject(ctx context.Context, params FinishMoveObjectParams) (err error)
- func (client *Client) GetBucket(ctx context.Context, params GetBucketParams) (respBucket Bucket, err error)
- func (client *Client) GetBucketLocation(ctx context.Context, params GetBucketLocationParams) (_ GetBucketLocationResponse, err error)
- func (client *Client) GetObject(ctx context.Context, params GetObjectParams) (_ RawObjectItem, err error)
- func (client *Client) GetObjectIPs(ctx context.Context, params GetObjectIPsParams) (r *GetObjectIPsResponse, err error)
- func (client *Client) GetProjectInfo(ctx context.Context) (response *pb.ProjectInfoResponse, err error)
- func (client *Client) ListBuckets(ctx context.Context, params ListBucketsParams) (_ BucketList, err error)
- func (client *Client) ListObjects(ctx context.Context, params ListObjectsParams) (_ []RawObjectListItem, more bool, err error)
- func (client *Client) ListPendingObjectStreams(ctx context.Context, params ListPendingObjectStreamsParams) (_ ListPendingObjectStreamsResponse, err error)
- func (client *Client) ListSegments(ctx context.Context, params ListSegmentsParams) (_ ListSegmentsResponse, err error)
- func (client *Client) MakeInlineSegment(ctx context.Context, params MakeInlineSegmentParams) (err error)
- func (client *Client) RetryBeginSegmentPieces(ctx context.Context, params RetryBeginSegmentPiecesParams) (_ RetryBeginSegmentPiecesResponse, err error)
- func (client *Client) RevokeAPIKey(ctx context.Context, params RevokeAPIKeyParams) (err error)
- func (client *Client) SetRawAPIKey(key []byte)
- func (client *Client) UpdateObjectMetadata(ctx context.Context, params UpdateObjectMetadataParams) (err error)
- type CommitObjectParams
- type CommitSegmentParams
- type CreateBucketParams
- type CreateBucketResponse
- type CreateObject
- type DB
- func (db *DB) Close() error
- func (db *DB) CreateBucket(ctx context.Context, bucketName string) (newBucket Bucket, err error)
- func (db *DB) CreateObject(ctx context.Context, bucket, key string, createInfo *CreateObject) (object *MutableObject, err error)
- func (db *DB) DeleteBucket(ctx context.Context, bucketName string, deleteAll bool) (bucket Bucket, err error)
- func (db *DB) DeleteObject(ctx context.Context, bucket, key string) (_ Object, err error)
- func (db *DB) DownloadObject(ctx context.Context, bucket, key string, options DownloadOptions) (info DownloadInfo, err error)
- func (db *DB) GetBucket(ctx context.Context, bucketName string) (bucket Bucket, err error)
- func (db *DB) GetObject(ctx context.Context, bucket, key string, version []byte) (info Object, err error)
- func (db *DB) GetObjectIPs(ctx context.Context, bucket Bucket, key string) (_ *GetObjectIPsResponse, err error)
- func (db *DB) ListBuckets(ctx context.Context, options BucketListOptions) (bucketList BucketList, err error)
- func (db *DB) ListObjects(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
- func (db *DB) ListPendingObjectStreams(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
- func (db *DB) ListPendingObjects(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
- func (db *DB) ListSegments(ctx context.Context, params ListSegmentsParams) (response ListSegmentsResponse, err error)
- func (db *DB) ModifyObject(ctx context.Context, bucket, key string) (object *MutableObject, err error)
- func (db *DB) ModifyPendingObject(ctx context.Context, bucket, key string) (object *MutableObject, err error)
- func (db *DB) ObjectFromRawObjectItem(ctx context.Context, bucket, key string, objectInfo RawObjectItem) (Object, error)
- func (db *DB) UpdateObjectMetadata(ctx context.Context, bucket, key string, newMetadata map[string]string) (err error)
- type DeleteBucketParams
- type DownloadInfo
- type DownloadObjectParams
- type DownloadObjectResponse
- type DownloadOptions
- type DownloadSegmentParams
- type DownloadSegmentResponse
- type DownloadSegmentWithRSResponse
- type EncryptedKeyAndNonce
- type ExponentialBackoff
- type FinishCopyObjectParams
- type FinishCopyObjectResponse
- type FinishMoveObjectParams
- type GetBucketLocationParams
- type GetBucketLocationResponse
- type GetBucketParams
- type GetBucketResponse
- type GetObjectIPsParams
- type GetObjectIPsResponse
- type GetObjectParams
- type GetObjectResponse
- type IterateBucketsOptions
- type LastSegment
- type ListBucketsParams
- type ListBucketsResponse
- type ListDirection
- type ListObjectsParams
- type ListObjectsResponse
- type ListOptions
- type ListPendingObjectStreamsParams
- type ListPendingObjectStreamsResponse
- type ListSegmentsParams
- type ListSegmentsResponse
- type MakeInlineSegmentParams
- type Meta
- type MutableObject
- type MutableStream
- type Object
- type ObjectList
- type RawObjectItem
- type RawObjectListItem
- type RetryBeginSegmentPiecesParams
- type RetryBeginSegmentPiecesResponse
- type RevokeAPIKeyParams
- type SegmentDownloadInfo
- type SegmentDownloadResponseInfo
- type SegmentEncryption
- type SegmentListItem
- type SegmentPosition
- type SerializableMeta
- type Stream
- type StreamRange
- type StreamRangeMode
- type UpdateObjectMetadataParams
Constants ¶
const ( // Forward lists forwards from cursor, including cursor. Forward = pb.ListDirection_FORWARD // After lists forwards from cursor, without cursor. After = pb.ListDirection_AFTER )
Variables ¶
var ( // ErrNoPath is an error class for using empty path. ErrNoPath = errs.Class("no path specified") // ErrObjectNotFound is an error class for non-existing object. ErrObjectNotFound = errs.Class("object not found") )
var ( // ErrBucket is an error class for general bucket errors. ErrBucket = errs.Class("bucket") // ErrNoBucket is an error class for using empty bucket name. ErrNoBucket = errs.Class("no bucket specified") // ErrBucketNotFound is an error class for non-existing bucket. ErrBucketNotFound = errs.Class("bucket not found") )
var ( // ErrInvalidType error for inalid response type casting. ErrInvalidType = errs.New("invalid response type") )
var ( // Error is the errs class of standard metainfo errors. Error = errs.Class("metaclient") )
Functions ¶
Types ¶
type BatchItem ¶
type BatchItem interface {
BatchItem() *pb.BatchRequestItem
}
BatchItem represents single request in batch.
type BatchResponse ¶
type BatchResponse struct {
// contains filtered or unexported fields
}
BatchResponse single response from batch call.
func MakeBatchResponse ¶ added in v1.11.0
func MakeBatchResponse(req *pb.BatchRequestItem, resp *pb.BatchResponseItem) BatchResponse
MakeBatchResponse makes a batch response from the request and response protobufs.
func (*BatchResponse) BeginDeleteObject ¶
func (resp *BatchResponse) BeginDeleteObject() (BeginDeleteObjectResponse, error)
BeginDeleteObject returns response for BeginDeleteObject request.
func (*BatchResponse) BeginObject ¶
func (resp *BatchResponse) BeginObject() (BeginObjectResponse, error)
BeginObject returns response for BeginObject request.
func (*BatchResponse) BeginSegment ¶
func (resp *BatchResponse) BeginSegment() (BeginSegmentResponse, error)
BeginSegment returns response for BeginSegment request.
func (*BatchResponse) CreateBucket ¶
func (resp *BatchResponse) CreateBucket() (CreateBucketResponse, error)
CreateBucket returns BatchResponse for CreateBucket request.
func (*BatchResponse) DownloadSegment ¶
func (resp *BatchResponse) DownloadSegment() (DownloadSegmentResponse, error)
DownloadSegment returns response for DownloadSegment request.
func (*BatchResponse) GetBucket ¶
func (resp *BatchResponse) GetBucket() (GetBucketResponse, error)
GetBucket returns response for GetBucket request.
func (*BatchResponse) GetObject ¶
func (resp *BatchResponse) GetObject() (GetObjectResponse, error)
GetObject returns response for GetObject request.
func (*BatchResponse) ListBuckets ¶
func (resp *BatchResponse) ListBuckets() (ListBucketsResponse, error)
ListBuckets returns response for ListBuckets request.
func (*BatchResponse) ListObjects ¶
func (resp *BatchResponse) ListObjects() (ListObjectsResponse, error)
ListObjects returns response for ListObjects request.
type Batcher ¶ added in v1.11.0
type Batcher interface { // Batch issues multiple requests in one batch. Batch(ctx context.Context, items ...BatchItem) ([]BatchResponse, error) }
Batcher issues batches.
type BeginCopyObjectParams ¶ added in v1.8.1
type BeginCopyObjectParams struct { Bucket []byte EncryptedObjectKey []byte NewBucket []byte NewEncryptedObjectKey []byte }
BeginCopyObjectParams parameters for BeginCopyObject method.
func (*BeginCopyObjectParams) BatchItem ¶ added in v1.8.1
func (params *BeginCopyObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type BeginCopyObjectResponse ¶ added in v1.8.1
type BeginCopyObjectResponse struct { StreamID storj.StreamID EncryptedMetadataKeyNonce storj.Nonce EncryptedMetadataKey []byte SegmentKeys []EncryptedKeyAndNonce }
BeginCopyObjectResponse response for BeginCopyObjectResponse request.
type BeginDeleteObjectParams ¶
type BeginDeleteObjectParams struct { Bucket []byte EncryptedObjectKey []byte Version int32 StreamID storj.StreamID Status int32 }
BeginDeleteObjectParams parameters for BeginDeleteObject method.
func (*BeginDeleteObjectParams) BatchItem ¶
func (params *BeginDeleteObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type BeginDeleteObjectResponse ¶
type BeginDeleteObjectResponse struct { }
BeginDeleteObjectResponse response for BeginDeleteObject request.
type BeginMoveObjectParams ¶
type BeginMoveObjectParams struct { Bucket []byte EncryptedObjectKey []byte NewBucket []byte NewEncryptedObjectKey []byte }
BeginMoveObjectParams parameters for BeginMoveObject method.
func (*BeginMoveObjectParams) BatchItem ¶
func (params *BeginMoveObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type BeginMoveObjectResponse ¶
type BeginMoveObjectResponse struct { StreamID storj.StreamID EncryptedMetadataKeyNonce storj.Nonce EncryptedMetadataKey []byte SegmentKeys []EncryptedKeyAndNonce }
BeginMoveObjectResponse response for BeginMoveObjectResponse request.
type BeginObjectParams ¶
type BeginObjectParams struct { Bucket []byte EncryptedObjectKey []byte Version int32 Redundancy storj.RedundancyScheme EncryptionParameters storj.EncryptionParameters ExpiresAt time.Time EncryptedMetadata []byte EncryptedMetadataEncryptedKey []byte EncryptedMetadataNonce storj.Nonce }
BeginObjectParams parameters for BeginObject method.
func (*BeginObjectParams) BatchItem ¶
func (params *BeginObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type BeginObjectResponse ¶
BeginObjectResponse response for BeginObject request.
type BeginSegmentParams ¶
type BeginSegmentParams struct { StreamID storj.StreamID Position SegmentPosition MaxOrderLimit int64 }
BeginSegmentParams parameters for BeginSegment method.
func (*BeginSegmentParams) BatchItem ¶
func (params *BeginSegmentParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type BeginSegmentResponse ¶
type BeginSegmentResponse struct { SegmentID storj.SegmentID Limits []*pb.AddressedOrderLimit PiecePrivateKey storj.PiecePrivateKey RedundancyStrategy eestream.RedundancyStrategy }
BeginSegmentResponse response for BeginSegment request.
type BucketIterator ¶ added in v1.10.0
type BucketIterator struct {
// contains filtered or unexported fields
}
BucketIterator is an iterator over a collection of buckets.
func IterateBuckets ¶ added in v1.10.0
func IterateBuckets(ctx context.Context, options IterateBucketsOptions) *BucketIterator
IterateBuckets returns iterator to go over buckets.
func (*BucketIterator) Err ¶ added in v1.10.0
func (buckets *BucketIterator) Err() error
Err returns error, if one happened during iteration.
func (*BucketIterator) Item ¶ added in v1.10.0
func (buckets *BucketIterator) Item() *Bucket
Item returns the current bucket in the iterator.
func (*BucketIterator) Next ¶ added in v1.10.0
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 BucketList ¶
BucketList is a list of buckets.
type BucketListOptions ¶
type BucketListOptions struct { Cursor string Direction ListDirection Limit int }
BucketListOptions lists objects.
func (BucketListOptions) NextPage ¶ added in v1.10.0
func (opts BucketListOptions) NextPage(list BucketList) BucketListOptions
NextPage returns options for listing the next page.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client creates a grpcClient.
func DialNodeURL ¶
func DialNodeURL(ctx context.Context, dialer rpc.Dialer, nodeURL string, apiKey *macaroon.APIKey, userAgent string) (*Client, error)
DialNodeURL dials to metainfo endpoint with the specified api key.
func (*Client) Batch ¶
func (client *Client) Batch(ctx context.Context, requests ...BatchItem) (resp []BatchResponse, err error)
Batch sends multiple requests in one batch.
func (*Client) BeginCopyObject ¶ added in v1.8.1
func (client *Client) BeginCopyObject(ctx context.Context, params BeginCopyObjectParams) (_ BeginCopyObjectResponse, err error)
BeginCopyObject requests data needed to copy an object from one key to another.
func (*Client) BeginDeleteObject ¶
func (client *Client) BeginDeleteObject(ctx context.Context, params BeginDeleteObjectParams) (_ RawObjectItem, err error)
BeginDeleteObject begins object deletion process.
func (*Client) BeginMoveObject ¶
func (client *Client) BeginMoveObject(ctx context.Context, params BeginMoveObjectParams) (_ BeginMoveObjectResponse, err error)
BeginMoveObject begins process of moving object from one key to another.
func (*Client) BeginObject ¶
func (client *Client) BeginObject(ctx context.Context, params BeginObjectParams) (_ BeginObjectResponse, err error)
BeginObject begins object creation.
func (*Client) BeginSegment ¶
func (client *Client) BeginSegment(ctx context.Context, params BeginSegmentParams) (_ BeginSegmentResponse, err error)
BeginSegment begins a segment upload.
func (*Client) CommitObject ¶
func (client *Client) CommitObject(ctx context.Context, params CommitObjectParams) (err error)
CommitObject commits a created object.
func (*Client) CommitSegment ¶
func (client *Client) CommitSegment(ctx context.Context, params CommitSegmentParams) (err error)
CommitSegment commits an uploaded segment.
func (*Client) CreateBucket ¶
func (client *Client) CreateBucket(ctx context.Context, params CreateBucketParams) (respBucket Bucket, err error)
CreateBucket creates a new bucket.
func (*Client) DeleteBucket ¶
func (client *Client) DeleteBucket(ctx context.Context, params DeleteBucketParams) (_ Bucket, err error)
DeleteBucket deletes a bucket.
func (*Client) DownloadObject ¶
func (client *Client) DownloadObject(ctx context.Context, params DownloadObjectParams) (_ DownloadObjectResponse, err error)
DownloadObject gets object information, lists segments and downloads the first segment.
func (*Client) DownloadSegmentWithRS ¶
func (client *Client) DownloadSegmentWithRS(ctx context.Context, params DownloadSegmentParams) (_ DownloadSegmentWithRSResponse, err error)
DownloadSegmentWithRS gets information for downloading remote segment or data from an inline segment.
func (*Client) FinishCopyObject ¶ added in v1.8.1
func (client *Client) FinishCopyObject(ctx context.Context, params FinishCopyObjectParams) (_ FinishCopyObjectResponse, err error)
FinishCopyObject finishes process of copying object from one key to another.
func (*Client) FinishMoveObject ¶
func (client *Client) FinishMoveObject(ctx context.Context, params FinishMoveObjectParams) (err error)
FinishMoveObject finishes process of moving object from one key to another.
func (*Client) GetBucket ¶
func (client *Client) GetBucket(ctx context.Context, params GetBucketParams) (respBucket Bucket, err error)
GetBucket returns a bucket.
func (*Client) GetBucketLocation ¶ added in v1.12.0
func (client *Client) GetBucketLocation(ctx context.Context, params GetBucketLocationParams) (_ GetBucketLocationResponse, err error)
GetBucketLocation returns a bucket location.
func (*Client) GetObject ¶
func (client *Client) GetObject(ctx context.Context, params GetObjectParams) (_ RawObjectItem, err error)
GetObject gets single object.
func (*Client) GetObjectIPs ¶
func (client *Client) GetObjectIPs(ctx context.Context, params GetObjectIPsParams) (r *GetObjectIPsResponse, err error)
GetObjectIPs returns the IP addresses of the nodes which hold the object.
func (*Client) GetProjectInfo ¶
func (client *Client) GetProjectInfo(ctx context.Context) (response *pb.ProjectInfoResponse, err error)
GetProjectInfo gets the ProjectInfo for the api key associated with the metainfo client.
func (*Client) ListBuckets ¶
func (client *Client) ListBuckets(ctx context.Context, params ListBucketsParams) (_ BucketList, err error)
ListBuckets lists buckets.
func (*Client) ListObjects ¶
func (client *Client) ListObjects(ctx context.Context, params ListObjectsParams) (_ []RawObjectListItem, more bool, err error)
ListObjects lists objects according to specific parameters.
func (*Client) ListPendingObjectStreams ¶
func (client *Client) ListPendingObjectStreams(ctx context.Context, params ListPendingObjectStreamsParams) (_ ListPendingObjectStreamsResponse, err error)
ListPendingObjectStreams lists pending objects with the specified object key in the specified bucket.
func (*Client) ListSegments ¶
func (client *Client) ListSegments(ctx context.Context, params ListSegmentsParams) (_ ListSegmentsResponse, err error)
ListSegments lists segments according to specific parameters.
func (*Client) MakeInlineSegment ¶
func (client *Client) MakeInlineSegment(ctx context.Context, params MakeInlineSegmentParams) (err error)
MakeInlineSegment creates an inline segment.
func (*Client) RetryBeginSegmentPieces ¶ added in v1.11.0
func (client *Client) RetryBeginSegmentPieces(ctx context.Context, params RetryBeginSegmentPiecesParams) (_ RetryBeginSegmentPiecesResponse, err error)
RetryBeginSegmentPieces exchanges piece orders.
func (*Client) RevokeAPIKey ¶
func (client *Client) RevokeAPIKey(ctx context.Context, params RevokeAPIKeyParams) (err error)
RevokeAPIKey revokes the APIKey provided in the params.
func (*Client) SetRawAPIKey ¶
SetRawAPIKey sets the client's raw API key. Mainly used for testing.
func (*Client) UpdateObjectMetadata ¶
func (client *Client) UpdateObjectMetadata(ctx context.Context, params UpdateObjectMetadataParams) (err error)
UpdateObjectMetadata replaces objects metadata.
type CommitObjectParams ¶
type CommitObjectParams struct { StreamID storj.StreamID EncryptedMetadataNonce storj.Nonce EncryptedMetadata []byte EncryptedMetadataEncryptedKey []byte }
CommitObjectParams parameters for CommitObject method.
func (*CommitObjectParams) BatchItem ¶
func (params *CommitObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type CommitSegmentParams ¶
type CommitSegmentParams struct { SegmentID storj.SegmentID Encryption SegmentEncryption SizeEncryptedData int64 PlainSize int64 EncryptedTag []byte UploadResult []*pb.SegmentPieceUploadResult }
CommitSegmentParams parameters for CommitSegment method.
func (*CommitSegmentParams) BatchItem ¶
func (params *CommitSegmentParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type CreateBucketParams ¶
type CreateBucketParams struct {
Name []byte
}
CreateBucketParams parameters for CreateBucket method.
func (*CreateBucketParams) BatchItem ¶
func (params *CreateBucketParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type CreateBucketResponse ¶
type CreateBucketResponse struct {
Bucket Bucket
}
CreateBucketResponse response for CreateBucket request.
type CreateObject ¶
type CreateObject struct { Metadata map[string]string ContentType string Expires time.Time storj.RedundancyScheme storj.EncryptionParameters }
CreateObject has optional parameters that can be set.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB implements metainfo database.
func New ¶
func New(metainfo *Client, encStore *encryption.Store) *DB
New creates a new metainfo database.
func (*DB) CreateBucket ¶
CreateBucket creates a new bucket with the specified information.
func (*DB) CreateObject ¶
func (db *DB) CreateObject(ctx context.Context, bucket, key string, createInfo *CreateObject) (object *MutableObject, err error)
CreateObject creates an uploading object and returns an interface for uploading Object information.
func (*DB) DeleteBucket ¶
func (db *DB) DeleteBucket(ctx context.Context, bucketName string, deleteAll bool) (bucket Bucket, err error)
DeleteBucket deletes bucket.
func (*DB) DeleteObject ¶
DeleteObject deletes an object from database.
func (*DB) DownloadObject ¶
func (db *DB) DownloadObject(ctx context.Context, bucket, key string, options DownloadOptions) (info DownloadInfo, err error)
DownloadObject gets object information, lists segments and downloads the first segment.
func (*DB) GetObject ¶
func (db *DB) GetObject(ctx context.Context, bucket, key string, version []byte) (info Object, err error)
GetObject returns information about an object.
func (*DB) GetObjectIPs ¶
func (db *DB) GetObjectIPs(ctx context.Context, bucket Bucket, key string) (_ *GetObjectIPsResponse, err error)
GetObjectIPs returns the IP addresses of the nodes which hold the object.
func (*DB) ListBuckets ¶
func (db *DB) ListBuckets(ctx context.Context, options BucketListOptions) (bucketList BucketList, err error)
ListBuckets lists buckets.
func (*DB) ListObjects ¶
func (db *DB) ListObjects(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
ListObjects lists objects in bucket based on the ListOptions.
func (*DB) ListPendingObjectStreams ¶
func (db *DB) ListPendingObjectStreams(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
ListPendingObjectStreams lists streams for a specific pending object key.
func (*DB) ListPendingObjects ¶
func (db *DB) ListPendingObjects(ctx context.Context, bucket string, options ListOptions) (list ObjectList, err error)
ListPendingObjects lists pending objects in bucket based on the ListOptions.
func (*DB) ListSegments ¶
func (db *DB) ListSegments(ctx context.Context, params ListSegmentsParams) (response ListSegmentsResponse, err error)
ListSegments returns paged segments list.
func (*DB) ModifyObject ¶
func (db *DB) ModifyObject(ctx context.Context, bucket, key string) (object *MutableObject, err error)
ModifyObject modifies a committed object.
func (*DB) ModifyPendingObject ¶
func (db *DB) ModifyPendingObject(ctx context.Context, bucket, key string) (object *MutableObject, err error)
ModifyPendingObject creates an interface for updating a partially uploaded object.
func (*DB) ObjectFromRawObjectItem ¶ added in v1.8.1
func (db *DB) ObjectFromRawObjectItem(ctx context.Context, bucket, key string, objectInfo RawObjectItem) (Object, error)
ObjectFromRawObjectItem converts RawObjectItem into storj.Object struct.
func (*DB) UpdateObjectMetadata ¶
func (db *DB) UpdateObjectMetadata(ctx context.Context, bucket, key string, newMetadata map[string]string) (err error)
UpdateObjectMetadata replaces the custom metadata for the object at the specific key with newMetadata. Any existing custom metadata will be deleted.
type DeleteBucketParams ¶
DeleteBucketParams parameters for DeleteBucket method.
func (*DeleteBucketParams) BatchItem ¶
func (params *DeleteBucketParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type DownloadInfo ¶
type DownloadInfo struct { Object Object EncPath paths.Encrypted DownloadedSegments []DownloadSegmentWithRSResponse ListSegments ListSegmentsResponse Range StreamRange }
DownloadInfo contains response for DownloadObject.
type DownloadObjectParams ¶
type DownloadObjectParams struct { Bucket []byte EncryptedObjectKey []byte Range StreamRange }
DownloadObjectParams parameters for DownloadSegment method.
func (*DownloadObjectParams) BatchItem ¶
func (params *DownloadObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type DownloadObjectResponse ¶
type DownloadObjectResponse struct { Object RawObjectItem DownloadedSegments []DownloadSegmentWithRSResponse ListSegments ListSegmentsResponse }
DownloadObjectResponse response for DownloadSegment request.
type DownloadOptions ¶
type DownloadOptions struct {
Range StreamRange
}
DownloadOptions contains additional options for downloading.
type DownloadSegmentParams ¶
type DownloadSegmentParams struct { StreamID storj.StreamID Position SegmentPosition }
DownloadSegmentParams parameters for DownloadSegment method.
func (*DownloadSegmentParams) BatchItem ¶
func (params *DownloadSegmentParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type DownloadSegmentResponse ¶
type DownloadSegmentResponse struct { Info SegmentDownloadResponseInfo Limits []*pb.AddressedOrderLimit }
DownloadSegmentResponse response for DownloadSegment request.
type DownloadSegmentWithRSResponse ¶
type DownloadSegmentWithRSResponse struct { Info SegmentDownloadInfo Limits []*pb.AddressedOrderLimit }
DownloadSegmentWithRSResponse contains information for downloading remote segment or data from an inline segment.
type EncryptedKeyAndNonce ¶
type EncryptedKeyAndNonce struct { Position SegmentPosition EncryptedKeyNonce storj.Nonce EncryptedKey []byte }
EncryptedKeyAndNonce holds single segment encrypted key.
type ExponentialBackoff ¶
type ExponentialBackoff struct { Max time.Duration Min time.Duration // contains filtered or unexported fields }
ExponentialBackoff keeps track of how long we should sleep between failing attempts.
func (*ExponentialBackoff) Maxed ¶
func (e *ExponentialBackoff) Maxed() bool
Maxed returns true if the wait time has maxed out.
type FinishCopyObjectParams ¶ added in v1.8.1
type FinishCopyObjectParams struct { StreamID storj.StreamID NewBucket []byte NewEncryptedObjectKey []byte NewEncryptedMetadataKeyNonce storj.Nonce NewEncryptedMetadataKey []byte NewSegmentKeys []EncryptedKeyAndNonce }
FinishCopyObjectParams parameters for FinishCopyObject method.
func (*FinishCopyObjectParams) BatchItem ¶ added in v1.8.1
func (params *FinishCopyObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type FinishCopyObjectResponse ¶ added in v1.8.1
type FinishCopyObjectResponse struct {
Info RawObjectItem
}
FinishCopyObjectResponse response for FinishCopyObjectResponse request.
type FinishMoveObjectParams ¶
type FinishMoveObjectParams struct { StreamID storj.StreamID NewBucket []byte NewEncryptedObjectKey []byte NewEncryptedMetadataKeyNonce storj.Nonce NewEncryptedMetadataKey []byte NewSegmentKeys []EncryptedKeyAndNonce }
FinishMoveObjectParams parameters for FinishMoveObject method.
func (*FinishMoveObjectParams) BatchItem ¶
func (params *FinishMoveObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type GetBucketLocationParams ¶ added in v1.12.0
type GetBucketLocationParams struct {
Name []byte
}
GetBucketLocationParams parameters for GetBucketLocation method.
func (*GetBucketLocationParams) BatchItem ¶ added in v1.12.0
func (params *GetBucketLocationParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type GetBucketLocationResponse ¶ added in v1.12.0
type GetBucketLocationResponse struct {
Location []byte
}
GetBucketLocationResponse response for GetBucketLocation request.
type GetBucketParams ¶
type GetBucketParams struct {
Name []byte
}
GetBucketParams parameters for GetBucketParams method.
func (*GetBucketParams) BatchItem ¶
func (params *GetBucketParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type GetBucketResponse ¶
type GetBucketResponse struct {
Bucket Bucket
}
GetBucketResponse response for GetBucket request.
type GetObjectIPsParams ¶
GetObjectIPsParams are params for the GetObjectIPs request.
type GetObjectIPsResponse ¶
type GetObjectIPsResponse struct { IPPorts [][]byte SegmentCount int64 PieceCount int64 ReliablePieceCount int64 }
GetObjectIPsResponse is the response from GetObjectIPs.
type GetObjectParams ¶
type GetObjectParams struct { Bucket []byte EncryptedObjectKey []byte Version []byte RedundancySchemePerSegment bool }
GetObjectParams parameters for GetObject method.
func (*GetObjectParams) BatchItem ¶
func (params *GetObjectParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type GetObjectResponse ¶
type GetObjectResponse struct {
Info RawObjectItem
}
GetObjectResponse response for GetObject request.
type IterateBucketsOptions ¶ added in v1.10.0
type IterateBucketsOptions struct { Cursor string Limit int DialClientFunc func() (*Client, error) }
IterateBucketsOptions buckets iterator options.
type LastSegment ¶
type LastSegment struct { Size int64 EncryptedKeyNonce storj.Nonce EncryptedKey storj.EncryptedPrivateKey }
LastSegment contains info about last segment.
type ListBucketsParams ¶
type ListBucketsParams struct {
ListOpts BucketListOptions
}
ListBucketsParams parameters for ListBucketsParams method.
func (*ListBucketsParams) BatchItem ¶
func (params *ListBucketsParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type ListBucketsResponse ¶
type ListBucketsResponse struct {
BucketList BucketList
}
ListBucketsResponse response for ListBucket request.
type ListDirection ¶
type ListDirection = pb.ListDirection
ListDirection specifies listing direction.
type ListObjectsParams ¶
type ListObjectsParams struct { Bucket []byte EncryptedPrefix []byte EncryptedCursor []byte Limit int32 IncludeCustomMetadata bool IncludeSystemMetadata bool Recursive bool Status int32 }
ListObjectsParams parameters for ListObjects method.
func (*ListObjectsParams) BatchItem ¶
func (params *ListObjectsParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type ListObjectsResponse ¶
type ListObjectsResponse struct { Items []RawObjectListItem More bool }
ListObjectsResponse response for ListObjects request.
type ListOptions ¶
type ListOptions struct { Prefix storj.Path Cursor storj.Path // Cursor is relative to Prefix, full path is Prefix + Cursor CursorEnc []byte Delimiter rune Recursive bool Direction ListDirection Limit int IncludeCustomMetadata bool IncludeSystemMetadata bool Status int32 }
ListOptions lists objects.
func (ListOptions) NextPage ¶
func (opts ListOptions) NextPage(list ObjectList) ListOptions
NextPage returns options for listing the next page.
type ListPendingObjectStreamsParams ¶
type ListPendingObjectStreamsParams struct { Bucket []byte EncryptedObjectKey []byte EncryptedCursor []byte Limit int32 }
ListPendingObjectStreamsParams parameters for ListPendingObjectStreams method.
func (*ListPendingObjectStreamsParams) BatchItem ¶
func (params *ListPendingObjectStreamsParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type ListPendingObjectStreamsResponse ¶
type ListPendingObjectStreamsResponse struct { Items []RawObjectListItem More bool }
ListPendingObjectStreamsResponse response for ListPendingObjectStreams request.
type ListSegmentsParams ¶
type ListSegmentsParams struct { StreamID []byte Cursor SegmentPosition Limit int32 Range StreamRange }
ListSegmentsParams parameters for ListSegments method.
func (*ListSegmentsParams) BatchItem ¶
func (params *ListSegmentsParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type ListSegmentsResponse ¶
type ListSegmentsResponse struct { Items []SegmentListItem More bool EncryptionParameters storj.EncryptionParameters }
ListSegmentsResponse response for ListSegments request.
type MakeInlineSegmentParams ¶
type MakeInlineSegmentParams struct { StreamID storj.StreamID Position SegmentPosition Encryption SegmentEncryption EncryptedInlineData []byte PlainSize int64 EncryptedTag []byte }
MakeInlineSegmentParams parameters for MakeInlineSegment method.
func (*MakeInlineSegmentParams) BatchItem ¶
func (params *MakeInlineSegmentParams) BatchItem() *pb.BatchRequestItem
BatchItem returns single item for batch request.
type MutableObject ¶
type MutableObject struct {
// contains filtered or unexported fields
}
MutableObject is for creating an object stream.
func (*MutableObject) CreateDynamicStream ¶
func (object *MutableObject) CreateDynamicStream(ctx context.Context, metadata SerializableMeta, expires time.Time) (_ *MutableStream, err error)
CreateDynamicStream creates a new dynamic stream for the object.
func (*MutableObject) CreateStream ¶
func (object *MutableObject) CreateStream(ctx context.Context) (_ *MutableStream, err error)
CreateStream creates a new stream for the object.
func (*MutableObject) Info ¶
func (object *MutableObject) Info() Object
Info gets the current information about the object.
type MutableStream ¶
type MutableStream struct {
// contains filtered or unexported fields
}
MutableStream is for manipulating stream information.
func (*MutableStream) BucketName ¶
func (stream *MutableStream) BucketName() string
BucketName returns streams bucket name.
func (*MutableStream) Expires ¶
func (stream *MutableStream) Expires() time.Time
Expires returns stream expiration time.
func (*MutableStream) Info ¶
func (stream *MutableStream) Info() Object
Info returns object info about the stream.
func (*MutableStream) Metadata ¶
func (stream *MutableStream) Metadata() ([]byte, error)
Metadata returns metadata associated with the stream.
type Object ¶
type Object struct { Version []byte Bucket Bucket Path string IsPrefix bool Metadata map[string]string ContentType string Created time.Time Modified time.Time Expires time.Time Stream }
Object contains information about a specific object.
type ObjectList ¶
type ObjectList struct { Bucket string Prefix string More bool Cursor []byte // Items paths are relative to Prefix // To get the full path use list.Prefix + list.Items[0].Path Items []Object }
ObjectList is a list of objects.
type RawObjectItem ¶
type RawObjectItem struct { Version []byte Bucket string EncryptedObjectKey []byte StreamID storj.StreamID Created time.Time Modified time.Time Expires time.Time PlainSize int64 EncryptedMetadataNonce storj.Nonce EncryptedMetadataEncryptedKey []byte EncryptedMetadata []byte EncryptionParameters storj.EncryptionParameters RedundancyScheme storj.RedundancyScheme }
RawObjectItem represents raw object item from get request.
type RawObjectListItem ¶
type RawObjectListItem struct { EncryptedObjectKey []byte Version []byte Status int32 CreatedAt time.Time StatusAt time.Time ExpiresAt time.Time PlainSize int64 EncryptedMetadataNonce storj.Nonce EncryptedMetadataEncryptedKey []byte EncryptedMetadata []byte StreamID storj.StreamID IsPrefix bool }
RawObjectListItem represents raw object item from list objects request.
type RetryBeginSegmentPiecesParams ¶ added in v1.11.0
RetryBeginSegmentPiecesParams parameters for RetryBeginSegmentPieces method.
type RetryBeginSegmentPiecesResponse ¶ added in v1.11.0
type RetryBeginSegmentPiecesResponse struct { SegmentID storj.SegmentID Limits []*pb.AddressedOrderLimit }
RetryBeginSegmentPiecesResponse response for RetryBeginSegmentPieces request.
type RevokeAPIKeyParams ¶
type RevokeAPIKeyParams struct {
APIKey []byte
}
RevokeAPIKeyParams contain params for a RevokeAPIKey request.
type SegmentDownloadInfo ¶
type SegmentDownloadInfo struct { SegmentID storj.SegmentID PlainOffset int64 PlainSize int64 EncryptedSize int64 EncryptedInlineData []byte PiecePrivateKey storj.PiecePrivateKey SegmentEncryption SegmentEncryption RedundancyScheme storj.RedundancyScheme Position *SegmentPosition }
SegmentDownloadInfo represents information necessary for downloading segment (inline and remote).
type SegmentDownloadResponseInfo ¶
type SegmentDownloadResponseInfo struct { SegmentID storj.SegmentID EncryptedSize int64 EncryptedInlineData []byte Next SegmentPosition Position SegmentPosition PiecePrivateKey storj.PiecePrivateKey SegmentEncryption SegmentEncryption }
SegmentDownloadResponseInfo represents segment download information inline/remote.
type SegmentEncryption ¶
type SegmentEncryption struct { EncryptedKeyNonce storj.Nonce EncryptedKey storj.EncryptedPrivateKey }
SegmentEncryption represents segment encryption key and nonce.
type SegmentListItem ¶
type SegmentListItem struct { Position SegmentPosition PlainSize int64 PlainOffset int64 CreatedAt time.Time EncryptedETag []byte EncryptedKeyNonce storj.Nonce EncryptedKey []byte }
SegmentListItem represents listed segment.
type SegmentPosition ¶
type SegmentPosition struct { // PartNumber indicates the ordinal of the part within an object. // A part contains one or more segments. // PartNumber is defined by the user. // This is only relevant for multipart objects. // A non-multipart object only has one Part, and its number is 0. PartNumber int32 // Index indicates the ordinal of this segment within a part. // Index is managed by uplink. // It is zero-indexed within each part. Index int32 }
SegmentPosition the segment position within its parent object. It is an identifier for the segment.
type SerializableMeta ¶
SerializableMeta is an interface for getting pb.SerializableMeta.
type Stream ¶
type Stream struct { ID storj.StreamID // Size is the total size of the stream in bytes Size int64 // SegmentCount is the number of segments SegmentCount int64 // FixedSegmentSize is the size of each segment, // when all segments have the same size. It is -1 otherwise. FixedSegmentSize int64 // RedundancyScheme specifies redundancy strategy used for this stream storj.RedundancyScheme // EncryptionParameters specifies encryption strategy used for this stream storj.EncryptionParameters LastSegment LastSegment // TODO: remove }
Stream is information about an object stream.
type StreamRange ¶
type StreamRange struct { Mode StreamRangeMode Start int64 Limit int64 Suffix int64 }
StreamRange contains range specification.
func (StreamRange) Normalize ¶
func (streamRange StreamRange) Normalize(plainSize int64) StreamRange
Normalize converts the range to a StreamRangeStartLimit or StreamRangeAll.
type StreamRangeMode ¶
type StreamRangeMode byte
StreamRangeMode contains different modes for range.
const ( // StreamRangeAll selects all. StreamRangeAll StreamRangeMode = iota // StreamRangeStart selects starting from range.Start. StreamRangeStart // StreamRangeStartLimit selects starting from range.Start to range.End (inclusive). StreamRangeStartLimit // StreamRangeSuffix selects last range.Suffix bytes. StreamRangeSuffix )
type UpdateObjectMetadataParams ¶
type UpdateObjectMetadataParams struct { Bucket []byte EncryptedObjectKey []byte StreamID storj.StreamID EncryptedMetadataNonce storj.Nonce EncryptedMetadata []byte EncryptedMetadataEncryptedKey []byte }
UpdateObjectMetadataParams are params for the UpdateObjectMetadata request.