metainfo

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidType error for inalid response type casting.
	ErrInvalidType = errs.New("invalid response type")
)
View Source
var (

	// Error is the errs class of standard metainfo errors.
	Error = errs.Class("metainfo error")
)

Functions

func PathForKey added in v1.1.2

func PathForKey(raw string) paths.Unencrypted

PathForKey removes the trailing `/` from the raw path, which is required so the derived key matches the final list path (which also has the trailing encrypted `/` part of the path removed).

func TypedDecryptStreamInfo added in v1.1.2

func TypedDecryptStreamInfo(ctx context.Context, bucket string, unencryptedKey paths.Unencrypted, streamMetaBytes []byte, encStore *encryption.Store) (
	_ *pb.StreamInfo, streamMeta pb.StreamMeta, err error)

TypedDecryptStreamInfo decrypts stream info.

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 (*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 BeginDeleteObjectParams

type BeginDeleteObjectParams struct {
	Bucket        []byte
	EncryptedPath []byte
	Version       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 BeginObjectParams

type BeginObjectParams struct {
	Bucket               []byte
	EncryptedPath        []byte
	Version              int32
	Redundancy           storj.RedundancyScheme
	EncryptionParameters storj.EncryptionParameters
	ExpiresAt            time.Time
}

BeginObjectParams parmaters for BeginObject method.

func (*BeginObjectParams) BatchItem

func (params *BeginObjectParams) BatchItem() *pb.BatchRequestItem

BatchItem returns single item for batch request.

type BeginObjectResponse

type BeginObjectResponse struct {
	StreamID             storj.StreamID
	RedundancyStrategy   eestream.RedundancyStrategy
	EncryptionParameters storj.EncryptionParameters
}

BeginObjectResponse response for BeginObject request.

type BeginSegmentParams

type BeginSegmentParams struct {
	StreamID      storj.StreamID
	Position      storj.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
}

BeginSegmentResponse response for BeginSegment request.

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 NewClient added in v1.1.2

func NewClient(client pb.DRPCMetainfoClient, apiKey *macaroon.APIKey, userAgent string) *Client

NewClient creates Metainfo API client.

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) BeginDeleteObject

func (client *Client) BeginDeleteObject(ctx context.Context, params BeginDeleteObjectParams) (_ RawObjectItem, err error)

BeginDeleteObject begins object deletion process.

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) (_ storj.SegmentID, limits []*pb.AddressedOrderLimit, piecePrivateKey storj.PiecePrivateKey, err error)

BeginSegment begins a segment upload.

func (*Client) Close

func (client *Client) Close() error

Close closes the dialed connection.

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 storj.Bucket, err error)

CreateBucket creates a new bucket.

func (*Client) DeleteBucket

func (client *Client) DeleteBucket(ctx context.Context, params DeleteBucketParams) (_ storj.Bucket, err error)

DeleteBucket deletes a bucket.

func (*Client) DownloadSegment

func (client *Client) DownloadSegment(ctx context.Context, params DownloadSegmentParams) (_ storj.SegmentDownloadInfo, _ []*pb.AddressedOrderLimit, err error)

DownloadSegment gets information for downloading remote segment or data from an inline segment.

func (*Client) GetBucket

func (client *Client) GetBucket(ctx context.Context, params GetBucketParams) (respBucket storj.Bucket, err error)

GetBucket returns a bucket.

func (*Client) GetObject

func (client *Client) GetObject(ctx context.Context, params GetObjectParams) (_ RawObjectItem, err error)

GetObject gets single object.

func (*Client) GetObjectIPs added in v1.3.0

func (client *Client) GetObjectIPs(ctx context.Context, params GetObjectIPParams) (ips []net.IP, err error)

GetObjectIPs returns the IP addresses of the nodes which hold the object.

func (*Client) GetProjectInfo

func (client *Client) GetProjectInfo(ctx context.Context) (resp *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) (_ storj.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) MakeInlineSegment

func (client *Client) MakeInlineSegment(ctx context.Context, params MakeInlineSegmentParams) (err error)

MakeInlineSegment creates an inline segment.

func (*Client) RevokeAPIKey added in v1.2.0

func (client *Client) RevokeAPIKey(ctx context.Context, params RevokeAPIKeyParams) (err error)

RevokeAPIKey revokes the APIKey provided in the params.

func (*Client) SetRawAPIKey

func (client *Client) SetRawAPIKey(key []byte)

SetRawAPIKey sets the client's raw API key. Mainly used for testing.

type CommitObjectParams

type CommitObjectParams struct {
	StreamID storj.StreamID

	EncryptedMetadataNonce storj.Nonce
	EncryptedMetadata      []byte
}

CommitObjectParams parmaters 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        storj.SegmentEncryption
	SizeEncryptedData int64

	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

	// TODO remove those values when satellite will be adjusted
	PathCipher                  storj.CipherSuite
	PartnerID                   []byte
	DefaultSegmentsSize         int64
	DefaultRedundancyScheme     storj.RedundancyScheme
	DefaultEncryptionParameters storj.EncryptionParameters
}

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 storj.Bucket
}

CreateBucketResponse response for CreateBucket request.

type CreateObject added in v1.1.2

type CreateObject struct {
	Metadata    map[string]string
	ContentType string
	Expires     time.Time

	storj.RedundancyScheme
	storj.EncryptionParameters
}

CreateObject has optional parameters that can be set.

func (CreateObject) Object added in v1.1.2

func (create CreateObject) Object(bucket storj.Bucket, path storj.Path) storj.Object

Object converts the CreateObject to an object with unitialized values.

type DB added in v1.1.2

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) Close added in v1.4.0

func (db *DB) Close() error

Close closes the underlying resources passed to the metainfo DB.

func (*DB) CreateBucket added in v1.1.2

func (db *DB) CreateBucket(ctx context.Context, bucketName string) (newBucket storj.Bucket, err error)

CreateBucket creates a new bucket with the specified information.

func (*DB) CreateObject added in v1.1.2

func (db *DB) CreateObject(ctx context.Context, bucket storj.Bucket, path storj.Path, createInfo *CreateObject) (object *MutableObject, err error)

CreateObject creates an uploading object and returns an interface for uploading Object information.

func (*DB) DeleteBucket added in v1.1.2

func (db *DB) DeleteBucket(ctx context.Context, bucketName string, deleteAll bool) (bucket storj.Bucket, err error)

DeleteBucket deletes bucket.

func (*DB) DeleteObject added in v1.1.2

func (db *DB) DeleteObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (_ storj.Object, err error)

DeleteObject deletes an object from database.

func (*DB) GetBucket added in v1.1.2

func (db *DB) GetBucket(ctx context.Context, bucketName string) (bucket storj.Bucket, err error)

GetBucket gets bucket information.

func (*DB) GetObject added in v1.1.2

func (db *DB) GetObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (info storj.Object, err error)

GetObject returns information about an object.

func (*DB) GetObjectIPs added in v1.3.0

func (db *DB) GetObjectIPs(ctx context.Context, bucket storj.Bucket, path storj.Path) (ips []net.IP, err error)

GetObjectIPs returns the IP addresses of the nodes which hold the object.

func (*DB) ListBuckets added in v1.1.2

func (db *DB) ListBuckets(ctx context.Context, options storj.BucketListOptions) (bucketList storj.BucketList, err error)

ListBuckets lists buckets.

func (*DB) ListObjects added in v1.1.2

func (db *DB) ListObjects(ctx context.Context, bucket storj.Bucket, options storj.ListOptions) (list storj.ObjectList, err error)

ListObjects lists objects in bucket based on the ListOptions.

func (*DB) ListPendingObjects added in v1.1.2

func (db *DB) ListPendingObjects(ctx context.Context, bucket storj.Bucket, options storj.ListOptions) (list storj.ObjectList, err error)

ListPendingObjects lists pending objects in bucket based on the ListOptions.

func (*DB) ModifyObject added in v1.1.2

func (db *DB) ModifyObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (object *MutableObject, err error)

ModifyObject modifies a committed object.

func (*DB) ModifyPendingObject added in v1.1.2

func (db *DB) ModifyPendingObject(ctx context.Context, bucket storj.Bucket, path storj.Path) (object *MutableObject, err error)

ModifyPendingObject creates an interface for updating a partially uploaded object.

type DeleteBucketParams

type DeleteBucketParams struct {
	Name      []byte
	DeleteAll bool
}

DeleteBucketParams parmaters for DeleteBucket method.

func (*DeleteBucketParams) BatchItem

func (params *DeleteBucketParams) BatchItem() *pb.BatchRequestItem

BatchItem returns single item for batch request.

type DownloadSegmentParams

type DownloadSegmentParams struct {
	StreamID storj.StreamID
	Position storj.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 storj.SegmentDownloadInfo

	Limits []*pb.AddressedOrderLimit
}

DownloadSegmentResponse response for DownloadSegment request.

type GetBucketParams

type GetBucketParams struct {
	Name []byte
}

GetBucketParams parmaters 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 storj.Bucket
}

GetBucketResponse response for GetBucket request.

type GetObjectIPParams added in v1.3.0

type GetObjectIPParams struct {
	Bucket        []byte
	EncryptedPath []byte
	Version       int32
}

GetObjectIPParams are params for the GetObectIPs request.

type GetObjectParams

type GetObjectParams struct {
	Bucket        []byte
	EncryptedPath []byte
	Version       int32
}

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 ListBucketsParams

type ListBucketsParams struct {
	ListOpts storj.BucketListOptions
}

ListBucketsParams parmaters 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 storj.BucketList
}

ListBucketsResponse response for ListBucket request.

type ListItem

type ListItem struct {
	Path     storj.Path
	Pointer  *pb.Pointer
	IsPrefix bool
}

ListItem is a single item in a listing.

type ListObjectsParams

type ListObjectsParams struct {
	Bucket          []byte
	EncryptedPrefix []byte
	EncryptedCursor []byte
	Limit           int32
	IncludeMetadata bool
	Recursive       bool
}

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 MakeInlineSegmentParams

type MakeInlineSegmentParams struct {
	StreamID            storj.StreamID
	Position            storj.SegmentPosition
	Encryption          storj.SegmentEncryption
	EncryptedInlineData []byte
}

MakeInlineSegmentParams parameters for MakeInlineSegment method.

func (*MakeInlineSegmentParams) BatchItem

func (params *MakeInlineSegmentParams) BatchItem() *pb.BatchRequestItem

BatchItem returns single item for batch request.

type Meta added in v1.1.2

type Meta struct {
	Modified   time.Time
	Expiration time.Time
	Size       int64
	Data       []byte
}

Meta info about a segment.

type MutableObject added in v1.1.2

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

MutableObject is for creating an object stream.

func (*MutableObject) CreateDynamicStream added in v1.4.0

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 added in v1.1.2

func (object *MutableObject) CreateStream(ctx context.Context) (_ *MutableStream, err error)

CreateStream creates a new stream for the object.

func (*MutableObject) Info added in v1.1.2

func (object *MutableObject) Info() storj.Object

Info gets the current information about the object.

type MutableStream added in v1.1.2

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

MutableStream is for manipulating stream information.

func (*MutableStream) BucketName added in v1.1.2

func (stream *MutableStream) BucketName() string

BucketName returns streams bucket name.

func (*MutableStream) Expires added in v1.1.2

func (stream *MutableStream) Expires() time.Time

Expires returns stream expiration time.

func (*MutableStream) Info added in v1.4.0

func (stream *MutableStream) Info() storj.Object

Info returns object info about the stream.

func (*MutableStream) Metadata added in v1.1.2

func (stream *MutableStream) Metadata() ([]byte, error)

Metadata returns metadata associated with the stream.

func (*MutableStream) Path added in v1.1.2

func (stream *MutableStream) Path() string

Path returns streams path.

type RawObjectItem added in v1.4.0

type RawObjectItem struct {
	Version       uint32
	Bucket        string
	EncryptedPath []byte

	StreamID storj.StreamID

	Created  time.Time
	Modified time.Time
	Expires  time.Time

	EncryptedMetadataNonce storj.Nonce
	EncryptedMetadata      []byte

	EncryptionParameters storj.EncryptionParameters
	RedundancyScheme     storj.RedundancyScheme
}

RawObjectItem represents raw object item from get request.

type RawObjectListItem added in v1.4.0

type RawObjectListItem struct {
	EncryptedPath          []byte
	Version                int32
	Status                 int32
	CreatedAt              time.Time
	StatusAt               time.Time
	ExpiresAt              time.Time
	PlainSize              int64
	EncryptedMetadataNonce storj.Nonce
	EncryptedMetadata      []byte
	StreamID               storj.StreamID
	IsPrefix               bool
}

RawObjectListItem represents raw object item from list objects request.

type RevokeAPIKeyParams added in v1.2.0

type RevokeAPIKeyParams struct {
	APIKey []byte
}

RevokeAPIKeyParams contain params for a RevokeAPIKey request.

type SerializableMeta added in v1.4.0

type SerializableMeta interface {
	Metadata() ([]byte, error)
}

SerializableMeta is an interface for getting pb.SerializableMeta.

Jump to

Keyboard shortcuts

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