dfstore

package
v2.0.4-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOjectInput

type CreateOjectInput 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
}

CreateOjectInput is used to construct request of creating object.

func (*CreateOjectInput) Validate

func (i *CreateOjectInput) Validate() error

Validate validates CreateOjectInput 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 {
	// GetObjectRequestWithContext returns *http.Request of getting object.
	GetObjectRequestWithContext(ctx context.Context, input *GetObjectInput) (*http.Request, error)

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

	// CreateObjectRequestWithContext returns *http.Request of creating object.
	CreateObjectRequestWithContext(ctx context.Context, input *CreateOjectInput) (*http.Request, error)

	// CreateObject creates data of object.
	CreateObject(ctx context.Context, input *CreateOjectInput) error

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

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

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

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

Dfstore is the interface used for object storage.

func New

func New(endpoint, accessKey, secretKey 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
}

GetObjectInput is used to construct request of getting object.

func (*GetObjectInput) Validate

func (i *GetObjectInput) Validate() error

Validate validates GetObjectInput 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(ds *dfstore)

Option is a functional option for configuring the dfstore.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient set http client for dfstore.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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