driver

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCloser

func AddCloser(closer Closer)

func FreeCloser

func FreeCloser()

func RegisterDriverFactory

func RegisterDriverFactory(driverType string, factory DriverFactory)

Types

type Closer

type Closer interface {
	Close()
}

type DriverFactory

type DriverFactory interface {
	CreateDriver(detail *backendpb.BackendDetail) (StorageDriver, error)
}

type StorageDriver

type StorageDriver interface {
	Put(ctx context.Context, stream io.Reader, object *pb.Object) (dscommon.PutResult, error)
	Get(ctx context.Context, object *pb.Object, start int64, end int64) (io.ReadCloser, error)
	Delete(ctx context.Context, object *pb.DeleteObjectInput) error
	// TODO AppendObject
	Copy(ctx context.Context, stream io.Reader, target *pb.Object) (dscommon.PutResult, error)

	InitMultipartUpload(ctx context.Context, object *pb.Object) (*pb.MultipartUpload, error)
	UploadPart(ctx context.Context, stream io.Reader, multipartUpload *pb.MultipartUpload,
		partNumber int64, upBytes int64) (*model.UploadPartResult, error)
	CompleteMultipartUpload(ctx context.Context, multipartUpload *pb.MultipartUpload,
		completeUpload *model.CompleteMultipartUpload) (*model.CompleteMultipartUploadResult, error)
	AbortMultipartUpload(ctx context.Context, multipartUpload *pb.MultipartUpload) error
	ListParts(ctx context.Context, multipartUpload *pb.ListParts) (*model.ListPartsOutput, error)
	BackendCheck(ctx context.Context, backendDetail *pb.BackendDetailS3) error
	Restore(ctx context.Context, restoreObj *pb.Restore) error
	// Close: cleanup when driver needs to be stopped.
	Close() error

	// change storage class
	ChangeStorageClass(ctx context.Context, object *pb.Object, newClass *string) error
}

func CreateStorageDriver

func CreateStorageDriver(driverType string, detail *backendpb.BackendDetail) (StorageDriver, error)

Jump to

Keyboard shortcuts

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