layer

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2022 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UploadIDAttributeName         = "S3-Upload-Id"
	UploadPartNumberAttributeName = "S3-Upload-Part-Number"
	UploadKeyAttributeName        = "S3-Upload-Key"
	UploadCompletedParts          = "S3-Completed-Parts"
	UploadPartKeyPrefix           = ".upload-"

	MaxSizeUploadsList  = 1000
	MaxSizePartsList    = 1000
	UploadMinPartNumber = 1
	UploadMaxPartNumber = 10000
)
View Source
const (
	AttributeComplianceMode  = ".s3-compliance-mode"
	AttributeRetainUntil     = ".s3-retain-until"
	AttributeExpirationEpoch = "__NEOFS__EXPIRATION_EPOCH"
	AttributeSysTickEpoch    = "__NEOFS__TICK_EPOCH"
	AttributeSysTickTopic    = "__NEOFS__TICK_TOPIC"
)
View Source
const (
	VersionsDeleteMarkAttr = "S3-Versions-delete-mark"
	DelMarkFullObject      = "*"
)
View Source
const (
	AttributeLockEnabled = "LockEnabled"
)
View Source
const PathSeparator = string(os.PathSeparator)

PathSeparator is a path components separator string.

Variables

This section is empty.

Functions

func FormUploadPartName added in v0.20.0

func FormUploadPartName(uploadID, key string, partNumber int) string

func GetBoxData added in v0.17.0

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

GetBoxData extracts accessbox.Box from context.

func IsAuthenticatedRequest added in v0.19.0

func IsAuthenticatedRequest(ctx context.Context) bool

IsAuthenticatedRequest checks if access box exists in the current request.

func IsSystemHeader added in v0.19.0

func IsSystemHeader(key string) bool

func NameFromString

func NameFromString(name string) (string, string)

NameFromString splits name into a base file name and a directory path.

Types

type AnonymousKey added in v0.18.0

type AnonymousKey struct {
	Key *keys.PrivateKey
}

AnonymousKey contains data for anonymous requests.

type BucketACL added in v0.17.0

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

BucketACL extends BucketInfo by eacl.Table.

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 {
	Initialize(ctx context.Context, c EventListener) error
	EphemeralKey() *keys.PublicKey

	GetBucketSettings(ctx context.Context, bktInfo *data.BucketInfo) (*data.BucketSettings, error)
	PutBucketSettings(ctx context.Context, p *PutSettingsParams) error

	PutBucketCORS(ctx context.Context, p *PutCORSParams) error
	GetBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) (*data.CORSConfiguration, error)
	DeleteBucketCORS(ctx context.Context, bktInfo *data.BucketInfo) error

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

	GetObject(ctx context.Context, p *GetObjectParams) error
	HeadSystemObject(ctx context.Context, bktInfo *data.BucketInfo, name string) (*data.ObjectInfo, 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, bktInfo *data.BucketInfo) (map[string]string, error)

	PutObject(ctx context.Context, p *PutObjectParams) (*data.ObjectInfo, error)
	PutSystemObject(ctx context.Context, p *PutSystemObjectParams) (*data.ObjectInfo, error)
	PutObjectTagging(ctx context.Context, p *PutTaggingParams) error
	PutBucketTagging(ctx context.Context, bktInfo *data.BucketInfo, 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, p *DeleteObjectParams) ([]*VersionedObject, error)
	DeleteSystemObject(ctx context.Context, bktInfo *data.BucketInfo, name string) error
	DeleteObjectTagging(ctx context.Context, bktInfo *data.BucketInfo, objInfo *data.ObjectInfo) error
	DeleteBucketTagging(ctx context.Context, bktInfo *data.BucketInfo) error

	CompleteMultipartUpload(ctx context.Context, p *CompleteMultipartParams) (*data.ObjectInfo, error)
	UploadPart(ctx context.Context, p *UploadPartParams) (*data.ObjectInfo, error)
	UploadPartCopy(ctx context.Context, p *UploadCopyParams) (*data.ObjectInfo, error)
	ListMultipartUploads(ctx context.Context, p *ListMultipartUploadsParams) (*ListMultipartUploadsInfo, error)
	AbortMultipartUpload(ctx context.Context, p *UploadInfoParams) error
	ListParts(ctx context.Context, p *ListPartsParams) (*ListPartsInfo, error)
	GetUploadInitInfo(ctx context.Context, p *UploadInfoParams) (*data.ObjectInfo, error)

	PutBucketNotificationConfiguration(ctx context.Context, p *PutBucketNotificationConfigurationParams) error
	GetBucketNotificationConfiguration(ctx context.Context, bktInfo *data.BucketInfo) (*data.NotificationConfiguration, error)
}

Client provides S3 API client interface.

func NewLayer

func NewLayer(log *zap.Logger, neoFS neofs.NeoFS, config *Config) Client

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

type CompleteMultipartParams added in v0.18.0

type CompleteMultipartParams struct {
	Info  *UploadInfoParams
	Parts []*CompletedPart
}

type CompletedPart added in v0.18.0

type CompletedPart struct {
	ETag       string
	PartNumber int
}

type Config added in v0.18.0

type Config struct {
	ChainAddress string
	Caches       *CachesConfig
	AnonKey      AnonymousKey
	Resolver     *resolver.BucketResolver
}

type CopyObjectParams

type CopyObjectParams struct {
	SrcObject  *data.ObjectInfo
	DstBktInfo *data.BucketInfo
	DstObject  string
	SrcSize    int64
	Header     map[string]string
	Range      *RangeParams
	Lock       *data.ObjectLock
}

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
	SessionToken       *session.Container
	LocationConstraint string
	ObjectLockEnabled  bool
}

CreateBucketParams stores bucket create request parameters.

type DeleteBucketParams added in v0.16.0

type DeleteBucketParams struct {
	BktInfo *data.BucketInfo
}

DeleteBucketParams stores delete bucket request parameters.

type DeleteObjectParams added in v0.20.0

type DeleteObjectParams struct {
	BktInfo     *data.BucketInfo
	BktSettings *data.BucketSettings
	Objects     []*VersionedObject
}

type EventListener added in v0.21.0

type EventListener interface {
	Subscribe(context.Context, string, MsgHandler) error
	Listen(context.Context)
}

type GetObjectParams

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

GetObjectParams stores object get request parameters.

type HeadObjectParams added in v0.17.0

type HeadObjectParams struct {
	BktInfo   *data.BucketInfo
	Object    string
	VersionID string
}

HeadObjectParams stores object head request parameters.

type ListMultipartUploadsInfo added in v0.18.0

type ListMultipartUploadsInfo struct {
	Prefixes           []string
	Uploads            []*UploadInfo
	IsTruncated        bool
	NextKeyMarker      string
	NextUploadIDMarker string
}

type ListMultipartUploadsParams added in v0.18.0

type ListMultipartUploadsParams struct {
	Bkt            *data.BucketInfo
	Delimiter      string
	EncodingType   string
	KeyMarker      string
	MaxUploads     int
	Prefix         string
	UploadIDMarker string
}

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 {
	BktInfo         *data.BucketInfo
	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 {
	BktInfo   *data.BucketInfo
	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 ListPartsInfo added in v0.18.0

type ListPartsInfo struct {
	Parts                []*Part
	Owner                *user.ID
	NextPartNumberMarker int
	IsTruncated          bool
}

type ListPartsParams added in v0.18.0

type ListPartsParams struct {
	Info             *UploadInfoParams
	MaxParts         int
	PartNumberMarker int
}

type MsgHandler added in v0.20.0

type MsgHandler interface {
	HandleMessage(context.Context, *nats.Msg) error
}

type MsgHandlerFunc added in v0.20.0

type MsgHandlerFunc func(context.Context, *nats.Msg) error

func (MsgHandlerFunc) HandleMessage added in v0.20.0

func (f MsgHandlerFunc) HandleMessage(ctx context.Context, msg *nats.Msg) error

type ObjectVersionInfo added in v0.16.0

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

ObjectVersionInfo stores info about objects versions.

type Part added in v0.18.0

type Part struct {
	ETag         string
	LastModified string
	PartNumber   int
	Size         int64
}

type PutBucketACLParams added in v0.17.0

type PutBucketACLParams struct {
	BktInfo *data.BucketInfo
	EACL    *eacl.Table
}

PutBucketACLParams stores put bucket acl request parameters.

type PutBucketNotificationConfigurationParams added in v0.19.0

type PutBucketNotificationConfigurationParams struct {
	RequestInfo   *api.ReqInfo
	BktInfo       *data.BucketInfo
	Configuration *data.NotificationConfiguration
}

type PutCORSParams added in v0.18.0

type PutCORSParams struct {
	BktInfo *data.BucketInfo
	Reader  io.Reader
}

PutCORSParams stores PutCORS request parameters.

type PutObjectParams

type PutObjectParams struct {
	BktInfo *data.BucketInfo
	Object  string
	Size    int64
	Reader  io.Reader
	Header  map[string]string
	Lock    *data.ObjectLock
}

PutObjectParams stores object put request parameters.

type PutSettingsParams added in v0.20.0

type PutSettingsParams struct {
	BktInfo  *data.BucketInfo
	Settings *data.BucketSettings
}

PutSettingsParams stores object copy request parameters.

type PutSystemObjectParams added in v0.18.0

type PutSystemObjectParams struct {
	BktInfo  *data.BucketInfo
	ObjName  string
	Metadata map[string]string
	Prefix   string
	Reader   io.Reader
	Lock     *data.ObjectLock
}

PutSystemObjectParams stores putSystemObject parameters.

type PutTaggingParams added in v0.17.0

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

PutTaggingParams stores tag set params.

type RangeParams added in v0.16.0

type RangeParams struct {
	Start uint64
	End   uint64
}

RangeParams stores range header request parameters.

type UploadCopyParams added in v0.18.0

type UploadCopyParams struct {
	Info       *UploadInfoParams
	SrcObjInfo *data.ObjectInfo
	PartNumber int
	Range      *RangeParams
}

type UploadInfo added in v0.18.0

type UploadInfo struct {
	IsDir    bool
	Key      string
	UploadID string
	Owner    *user.ID
	Created  time.Time
}

type UploadInfoParams added in v0.18.0

type UploadInfoParams struct {
	UploadID string
	Bkt      *data.BucketInfo
	Key      string
}

type UploadPartParams added in v0.18.0

type UploadPartParams struct {
	Info       *UploadInfoParams
	PartNumber int
	Size       int64
	Reader     io.Reader
	Header     map[string]string
}

type VersionOption added in v0.19.0

type VersionOption func(*versionOptions)

func FromUnversioned added in v0.19.0

func FromUnversioned() VersionOption

type VersionedObject added in v0.17.0

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

VersionedObject stores info about objects to delete.

func (*VersionedObject) String added in v0.17.0

func (t *VersionedObject) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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