dfstore

package
v2.1.19 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGetObjectMetadatasLimit is the default limit of get object metadatas.
	DefaultGetObjectMetadatasLimit = 1000

	// MaxGetObjectMetadatasLimit is the max limit of get object metadatas.
	MaxGetObjectMetadatasLimit = 1000
	// DefaultPutObjectBufferSize is the buffer size of io.CopyBuffer
	DefaultPutObjectBufferSize = 64 * 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CopyObjectInput added in v2.0.30

type CopyObjectInput struct {
	// BucketName is bucket name.
	BucketName string

	// SourceObjectKey is the key of object to be copied.
	SourceObjectKey string

	// DestinationObjectKey is the object key of the destination.
	DestinationObjectKey string
}

CopyObjectInput is used to construct request of copying object.

func (*CopyObjectInput) Validate added in v2.0.30

func (i *CopyObjectInput) Validate() error

Validate validates CopyObjectInput fields.

type CreateBucketInput added in v2.0.30

type CreateBucketInput struct {
	// BucketName is bucket name.
	BucketName string
}

CreateBucketInput is used to construct request of creating bucket.

func (*CreateBucketInput) Validate added in v2.0.30

func (i *CreateBucketInput) Validate() error

Validate validates CreateBucketInput fields.

type DeleteObjectInput

type DeleteObjectInput struct {
	// BucketName is bucket name.
	BucketName string

	// ObjectKey is object key.
	ObjectKey string
}

DeleteObjectInput is used to construct request of deleting object.

func (*DeleteObjectInput) Validate

func (i *DeleteObjectInput) Validate() error

Validate validates DeleteObjectInput fields.

type Dfstore

type Dfstore interface {
	// CreateBucketRequestWithContext returns *http.Request of create bucket.
	CreateBucketRequestWithContext(ctx context.Context, input *CreateBucketInput) (*http.Request, error)

	// CreateBucket creates bucket.
	CreateBucketWithContext(ctx context.Context, input *CreateBucketInput) error

	// GetObjectMetadataRequestWithContext returns *http.Request of getting object metadata.
	GetObjectMetadataRequestWithContext(ctx context.Context, input *GetObjectMetadataInput) (*http.Request, error)

	// GetObjectMetadataWithContext returns matedata of object.
	GetObjectMetadataWithContext(ctx context.Context, input *GetObjectMetadataInput) (*pkgobjectstorage.ObjectMetadata, error)

	// GetObjectRequestWithContext returns *http.Request of getting object.
	GetObjectRequestWithContext(ctx context.Context, input *GetObjectInput) (*http.Request, error)

	// GetObjectWithContext returns data of object.
	GetObjectWithContext(ctx context.Context, input *GetObjectInput) (io.ReadCloser, error)

	// GetObjectMetadatasRequestWithContext returns *http.Request of getting object metadatas.
	GetObjectMetadatasRequestWithContext(ctx context.Context, input *GetObjectMetadatasInput) (*http.Request, error)

	// GetObjectMetadatasWithContext returns list of object metadatas.
	GetObjectMetadatasWithContext(ctx context.Context, input *GetObjectMetadatasInput) (*pkgobjectstorage.ObjectMetadatas, error)

	// PutObjectRequestWithContext returns *http.Request of putting object.
	PutObjectRequestWithContext(ctx context.Context, input *PutObjectInput) (*http.Request, error)

	// PutObjectWithContext puts data of object.
	PutObjectWithContext(ctx context.Context, input *PutObjectInput) error

	// CopyObjectRequestWithContext returns *http.Request of copying object.
	CopyObjectRequestWithContext(ctx context.Context, input *CopyObjectInput) (*http.Request, error)

	// CopyObjectWithContext copy object from source to destination.
	CopyObjectWithContext(ctx context.Context, input *CopyObjectInput) error

	// DeleteObjectRequestWithContext returns *http.Request of deleting object.
	DeleteObjectRequestWithContext(ctx context.Context, input *DeleteObjectInput) (*http.Request, error)

	// DeleteObjectWithContext deletes data of object.
	DeleteObjectWithContext(ctx context.Context, input *DeleteObjectInput) error

	// IsObjectExistRequestWithContext returns *http.Request of heading object.
	IsObjectExistRequestWithContext(ctx context.Context, input *IsObjectExistInput) (*http.Request, error)

	// IsObjectExistWithContext returns whether the object exists.
	IsObjectExistWithContext(ctx context.Context, input *IsObjectExistInput) (bool, error)
}

Dfstore is the interface used for object storage.

func New

func New(endpoint string, options ...Option) Dfstore

New dfstore instance.

type GetObjectInput

type GetObjectInput struct {
	// BucketName is bucket name.
	BucketName string

	// ObjectKey is object key.
	ObjectKey string

	// Filter is used to generate a unique Task ID by
	// filtering unnecessary query params in the URL,
	// it is separated by & character.
	Filter string

	// Range is the HTTP range header.
	Range string
}

GetObjectInput is used to construct request of getting object.

func (*GetObjectInput) Validate

func (i *GetObjectInput) Validate() error

Validate validates GetObjectInput fields.

type GetObjectMetadataInput added in v2.0.5

type GetObjectMetadataInput struct {
	// BucketName is bucket name.
	BucketName string

	// ObjectKey is object key.
	ObjectKey string
}

GetObjectMetadataInput is used to construct request of getting object metadata.

func (*GetObjectMetadataInput) Validate added in v2.0.5

func (i *GetObjectMetadataInput) Validate() error

Validate validates GetObjectMetadataInput fields.

type GetObjectMetadatasInput added in v2.0.30

type GetObjectMetadatasInput struct {
	// BucketName is the bucket name.
	BucketName string

	// Prefix filters the objects by their key's prefix.
	Prefix string

	// Marker is used for pagination, indicating the object key to start listing from.
	Marker string

	// Delimiter is used to create a hierarchical structure, simulating directories in the listing results.
	Delimiter string

	// Limit specifies the maximum number of objects to be returned in a single listing request.
	Limit int64
}

GetObjectMetadatasInput is used to construct request of getting object metadatas.

func (*GetObjectMetadatasInput) Convert added in v2.0.30

func (i *GetObjectMetadatasInput) Convert()

Convert converts GetObjectMetadatasInput fields.

func (*GetObjectMetadatasInput) Validate added in v2.0.30

func (i *GetObjectMetadatasInput) Validate() error

Validate validates GetObjectMetadatasInput fields.

type IsObjectExistInput

type IsObjectExistInput struct {
	// BucketName is bucket name.
	BucketName string

	// ObjectKey is object key.
	ObjectKey string
}

IsObjectExistInput is used to construct request of heading object.

func (*IsObjectExistInput) Validate

func (i *IsObjectExistInput) Validate() error

Validate validates IsObjectExistInput fields.

type Option

type Option func(dfs *dfstore)

Option is a functional option for configuring the dfstore.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient set http client for dfstore.

type PutObjectInput added in v2.0.9

type PutObjectInput struct {
	// BucketName is bucket name.
	BucketName string

	// ObjectKey is object key.
	ObjectKey string

	// Filter is used to generate a unique Task ID by
	// filtering unnecessary query params in the URL,
	// it is separated by & character.
	Filter string

	// Mode is the mode in which the backend is written,
	// including WriteBack and AsyncWriteBack.
	Mode int

	// MaxReplicas is the maximum number of
	// replicas of an object cache in seed peers.
	MaxReplicas int

	// Reader is reader of object.
	Reader io.Reader
}

PutObjectInput is used to construct request of putting object.

func (*PutObjectInput) Validate added in v2.0.9

func (i *PutObjectInput) Validate() error

Validate validates PutObjectInput fields.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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