layer

package
v0.15.1-pre Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (

	// PathSeparator is a path components separator string.
	PathSeparator = string(os.PathSeparator)
)

Variables

View Source
var (
	// ErrObjectExists is returned on attempts to create already existing object.
	ErrObjectExists = errors.New("object exists")
	// ErrObjectNotExists is returned on attempts to work with non-existing object.
	ErrObjectNotExists = errors.New("object not exists")
)

Functions

func NameFromString

func NameFromString(name string) (string, string)

NameFromString splits name into base file name and directory path.

Types

type BucketInfo

type BucketInfo struct {
	Name    string
	CID     *cid.ID
	Owner   *owner.ID
	Created time.Time
}

BucketInfo stores basic bucket data.

type Client

type Client interface {
	NeoFS

	ListBuckets(ctx context.Context) ([]*BucketInfo, error)
	GetBucketInfo(ctx context.Context, name string) (*BucketInfo, error)

	GetObject(ctx context.Context, p *GetObjectParams) error
	GetObjectInfo(ctx context.Context, bucketName, objectName string) (*ObjectInfo, error)

	PutObject(ctx context.Context, p *PutObjectParams) (*ObjectInfo, error)

	CopyObject(ctx context.Context, p *CopyObjectParams) (*ObjectInfo, error)

	ListObjects(ctx context.Context, p *ListObjectsParams) (*ListObjectsInfo, error)

	DeleteObject(ctx context.Context, bucket, object string) error
	DeleteObjects(ctx context.Context, bucket string, objects []string) []error
}

Client provides S3 API client interface.

func NewLayer

func NewLayer(log *zap.Logger, conns pool.Pool) Client

NewLayer creates instance of layer. It checks credentials and establishes gRPC connection with node.

type CopyObjectParams

type CopyObjectParams struct {
	SrcBucket string
	DstBucket string
	SrcObject string
	DstObject string
	Header    map[string]string
}

CopyObjectParams stores object copy request parameters.

type GetObjectParams

type GetObjectParams struct {
	Bucket string
	Object string
	Offset int64
	Length int64
	Writer io.Writer
}

GetObjectParams stores object get request parameters.

type ListObjectsInfo

type ListObjectsInfo struct {
	// Indicates whether the returned list objects response is truncated. A
	// value of true indicates that the list was truncated. The list can be truncated
	// if the number of objects exceeds the limit allowed or specified
	// by max keys.
	IsTruncated bool

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects.
	//
	// NOTE: This element is returned only if you have delimiter request parameter
	// specified.
	ContinuationToken     string
	NextContinuationToken string

	// List of objects info for this request.
	Objects []*ObjectInfo

	// List of prefixes for this request.
	Prefixes []string
}

ListObjectsInfo - container for list objects.

type ListObjectsParams

type ListObjectsParams struct {
	Bucket    string
	Prefix    string
	Token     string
	Delimiter string
	MaxKeys   int
}

ListObjectsParams represents object listing request parameters.

type NeoFS

type NeoFS interface {
	Get(ctx context.Context, address *object.Address) (*object.Object, error)
}

NeoFS provides basic NeoFS interface.

type ObjectInfo

type ObjectInfo struct {
	Bucket      string
	Name        string
	Size        int64
	ContentType string
	Created     time.Time
	Owner       *owner.ID
	Headers     map[string]string
	// contains filtered or unexported fields
}

ObjectInfo holds S3 object data.

func (*ObjectInfo) ID

func (o *ObjectInfo) ID() *object.ID

ID returns object ID from ObjectInfo.

func (*ObjectInfo) IsDir

func (o *ObjectInfo) IsDir() bool

IsDir allows to check if object is a directory.

type Params

type Params struct {
	Pool    pool.Pool
	Logger  *zap.Logger
	Timeout time.Duration
	Key     *ecdsa.PrivateKey
}

Params stores basic API parameters.

type PutObjectParams

type PutObjectParams struct {
	Bucket string
	Object string
	Size   int64
	Reader io.Reader
	Header map[string]string
}

PutObjectParams stores object put request parameters.

Jump to

Keyboard shortcuts

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