layer

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const PathSeparator = string(os.PathSeparator)

PathSeparator is a path components separator string.

Variables

This section is empty.

Functions

func GetBoxData added in v0.17.0

func GetBoxData(ctx context.Context) (*accessbox.Box, error)

GetBoxData extracts accessbox.Box from context.

func NameFromString

func NameFromString(name string) (string, string)

NameFromString splits name into base file name and directory path.

Types

type BucketACL added in v0.17.0

type BucketACL struct {
	Info *data.BucketInfo
	EACL *eacl.Table
}

BucketACL extends BucketInfo by eacl.Table.

type BucketSettings added in v0.17.0

type BucketSettings struct {
	VersioningEnabled bool
}

BucketSettings stores settings such as versioning.

type CachesConfig added in v0.17.0

type CachesConfig struct {
	Objects     *cache.Config
	ObjectsList *cache.Config
	Names       *cache.Config
	Buckets     *cache.Config
	System      *cache.Config
}

CachesConfig contains params for caches.

func DefaultCachesConfigs added in v0.17.0

func DefaultCachesConfigs() *CachesConfig

DefaultCachesConfigs returns filled configs.

type Client

type Client interface {
	NeoFS

	PutBucketVersioning(ctx context.Context, p *PutVersioningParams) (*data.ObjectInfo, error)
	GetBucketVersioning(ctx context.Context, name string) (*BucketSettings, error)

	ListBuckets(ctx context.Context) ([]*data.BucketInfo, error)
	GetBucketInfo(ctx context.Context, name string) (*data.BucketInfo, error)
	GetBucketACL(ctx context.Context, name string) (*BucketACL, error)
	PutBucketACL(ctx context.Context, p *PutBucketACLParams) error
	CreateBucket(ctx context.Context, p *CreateBucketParams) (*cid.ID, error)
	DeleteBucket(ctx context.Context, p *DeleteBucketParams) error

	GetObject(ctx context.Context, p *GetObjectParams) error
	GetObjectInfo(ctx context.Context, p *HeadObjectParams) (*data.ObjectInfo, error)
	GetObjectTagging(ctx context.Context, p *data.ObjectInfo) (map[string]string, error)
	GetBucketTagging(ctx context.Context, bucket string) (map[string]string, error)

	PutObject(ctx context.Context, p *PutObjectParams) (*data.ObjectInfo, error)
	PutObjectTagging(ctx context.Context, p *PutTaggingParams) error
	PutBucketTagging(ctx context.Context, bucket string, tagSet map[string]string) error

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

	ListObjectsV1(ctx context.Context, p *ListObjectsParamsV1) (*ListObjectsInfoV1, error)
	ListObjectsV2(ctx context.Context, p *ListObjectsParamsV2) (*ListObjectsInfoV2, error)
	ListObjectVersions(ctx context.Context, p *ListObjectVersionsParams) (*ListObjectVersionsInfo, error)

	DeleteObjects(ctx context.Context, bucket string, objects []*VersionedObject) ([]*VersionedObject, error)
	DeleteObjectTagging(ctx context.Context, p *data.ObjectInfo) error
	DeleteBucketTagging(ctx context.Context, bucket string) error
}

Client provides S3 API client interface.

func NewLayer

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

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

type CopyObjectParams

type CopyObjectParams struct {
	SrcObject *data.ObjectInfo
	DstBucket string
	DstObject string
	SrcSize   int64
	Header    map[string]string
}

CopyObjectParams stores object copy request parameters.

type CreateBucketParams added in v0.16.0

type CreateBucketParams struct {
	Name    string
	ACL     uint32
	Policy  *netmap.PlacementPolicy
	EACL    *eacl.Table
	BoxData *accessbox.Box
}

CreateBucketParams stores bucket create request parameters.

type DeleteBucketParams added in v0.16.0

type DeleteBucketParams struct {
	Name string
}

DeleteBucketParams stores delete bucket request parameters.

type GetObjectParams

type GetObjectParams struct {
	Range      *RangeParams
	ObjectInfo *data.ObjectInfo
	Offset     int64
	Length     int64
	Writer     io.Writer
	VersionID  string
}

GetObjectParams stores object get request parameters.

type HeadObjectParams added in v0.17.0

type HeadObjectParams struct {
	Bucket    string
	Object    string
	VersionID string
}

HeadObjectParams stores object head request parameters.

type ListObjectVersionsInfo added in v0.16.0

type ListObjectVersionsInfo struct {
	CommonPrefixes      []string
	IsTruncated         bool
	KeyMarker           string
	NextKeyMarker       string
	NextVersionIDMarker string
	Version             []*ObjectVersionInfo
	DeleteMarker        []*ObjectVersionInfo
	VersionIDMarker     string
}

ListObjectVersionsInfo stores info and list of objects' versions.

type ListObjectVersionsParams added in v0.16.0

type ListObjectVersionsParams struct {
	Bucket          string
	Delimiter       string
	KeyMarker       string
	MaxKeys         int
	Prefix          string
	VersionIDMarker string
	Encode          string
}

ListObjectVersionsParams stores list objects versions parameters.

type ListObjectsInfo

type ListObjectsInfo struct {
	Prefixes    []string
	Objects     []*data.ObjectInfo
	IsTruncated bool
}

ListObjectsInfo contains common fields of data for ListObjectsV1 and ListObjectsV2.

type ListObjectsInfoV1 added in v0.17.0

type ListObjectsInfoV1 struct {
	ListObjectsInfo
	NextMarker string
}

ListObjectsInfoV1 holds data which ListObjectsV1 returns.

type ListObjectsInfoV2 added in v0.17.0

type ListObjectsInfoV2 struct {
	ListObjectsInfo
	NextContinuationToken string
}

ListObjectsInfoV2 holds data which ListObjectsV2 returns.

type ListObjectsParamsCommon added in v0.17.0

type ListObjectsParamsCommon struct {
	Bucket    string
	Delimiter string
	Encode    string
	MaxKeys   int
	Prefix    string
}

ListObjectsParamsCommon contains common parameters for ListObjectsV1 and ListObjectsV2.

type ListObjectsParamsV1 added in v0.17.0

type ListObjectsParamsV1 struct {
	ListObjectsParamsCommon
	Marker string
}

ListObjectsParamsV1 contains params for ListObjectsV1.

type ListObjectsParamsV2 added in v0.17.0

type ListObjectsParamsV2 struct {
	ListObjectsParamsCommon
	ContinuationToken string
	StartAfter        string
	FetchOwner        bool
}

ListObjectsParamsV2 contains params for ListObjectsV2.

type NeoFS

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

NeoFS provides basic NeoFS interface.

type ObjectVersionInfo added in v0.16.0

type ObjectVersionInfo struct {
	Object   *data.ObjectInfo
	IsLatest bool
}

ObjectVersionInfo stores info about objects versions.

type Params

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

Params stores basic API parameters.

type PutBucketACLParams added in v0.17.0

type PutBucketACLParams struct {
	Name string
	EACL *eacl.Table
}

PutBucketACLParams stores put bucket acl request 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.

type PutTaggingParams added in v0.17.0

type PutTaggingParams struct {
	ObjectInfo *data.ObjectInfo
	TagSet     map[string]string
}

PutTaggingParams stores tag set params.

type PutVersioningParams added in v0.17.0

type PutVersioningParams struct {
	Bucket   string
	Settings *BucketSettings
}

PutVersioningParams stores object copy request parameters.

type RangeParams added in v0.16.0

type RangeParams struct {
	Start uint64
	End   uint64
}

RangeParams stores range header request parameters.

type VersionedObject added in v0.17.0

type VersionedObject struct {
	Name              string
	VersionID         string
	DeleteMarkVersion string
	Error             error
}

VersionedObject stores info about objects to delete.

func (*VersionedObject) String added in v0.17.0

func (t *VersionedObject) String() string

Jump to

Keyboard shortcuts

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