2022-04-22 07:18:21 +00:00
|
|
|
package layer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-s3-gw/api/data"
|
|
|
|
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
2022-05-12 01:50:52 +00:00
|
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
2022-04-22 07:18:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// TreeService provide interface to interact with tree service using s3 data models.
|
|
|
|
type TreeService interface {
|
|
|
|
// PutSettingsNode update or create new settings node in tree service.
|
2022-05-17 13:52:51 +00:00
|
|
|
PutSettingsNode(context.Context, *cid.ID, *data.BucketSettings) error
|
2022-04-22 07:18:21 +00:00
|
|
|
|
|
|
|
// GetSettingsNode retrieves the settings node from the tree service and form data.BucketSettings.
|
|
|
|
//
|
2022-05-12 01:48:17 +00:00
|
|
|
// If node is not found returns ErrNodeNotFound error.
|
2022-05-17 13:52:51 +00:00
|
|
|
GetSettingsNode(context.Context, *cid.ID) (*data.BucketSettings, error)
|
2022-05-12 01:50:52 +00:00
|
|
|
|
2022-05-17 13:52:51 +00:00
|
|
|
GetNotificationConfigurationNode(ctx context.Context, cnrID *cid.ID) (*oid.ID, error)
|
|
|
|
// PutNotificationConfigurationNode puts a node to a system tree
|
|
|
|
// and returns objectID of a previous notif config which must be deleted in NeoFS
|
|
|
|
PutNotificationConfigurationNode(ctx context.Context, cnrID *cid.ID, objID *oid.ID) (*oid.ID, error)
|
2022-05-12 02:33:03 +00:00
|
|
|
|
2022-05-17 13:52:51 +00:00
|
|
|
GetBucketCORS(ctx context.Context, cnrID *cid.ID) (*oid.ID, error)
|
|
|
|
// PutBucketCORS puts a node to a system tree and returns objectID of a previous cors config which must be deleted in NeoFS
|
|
|
|
PutBucketCORS(ctx context.Context, cnrID *cid.ID, objID *oid.ID) (*oid.ID, error)
|
|
|
|
// DeleteBucketCORS removes a node from a system tree and returns objID which must be deleted in NeoFS
|
|
|
|
DeleteBucketCORS(ctx context.Context, cnrID *cid.ID) (*oid.ID, error)
|
2022-05-17 14:56:05 +00:00
|
|
|
|
2022-05-20 15:02:00 +00:00
|
|
|
GetVersions(ctx context.Context, cnrID *cid.ID, objectName string) ([]*data.NodeVersion, error)
|
|
|
|
GetLatestVersion(ctx context.Context, cnrID *cid.ID, objectName string) (*data.NodeVersion, error)
|
2022-05-20 08:26:35 +00:00
|
|
|
GetLatestVersionsByPrefix(ctx context.Context, cnrID *cid.ID, prefix string) ([]oid.ID, error)
|
2022-05-20 15:02:00 +00:00
|
|
|
GetAllVersionsByPrefix(ctx context.Context, cnrID *cid.ID, prefix string) ([]*data.NodeVersion, error)
|
|
|
|
GetUnversioned(ctx context.Context, cnrID *cid.ID, objectName string) (*data.NodeVersion, error)
|
|
|
|
AddVersion(ctx context.Context, cnrID *cid.ID, objectName string, newVersion *data.NodeVersion) error
|
2022-05-17 14:56:05 +00:00
|
|
|
RemoveVersion(ctx context.Context, cnrID *cid.ID, nodeID uint64) error
|
|
|
|
|
2022-05-20 15:02:00 +00:00
|
|
|
AddSystemVersion(ctx context.Context, cnrID *cid.ID, objectName string, newVersion *data.BaseNodeVersion) error
|
|
|
|
GetSystemVersion(ctx context.Context, cnrID *cid.ID, objectName string) (*data.BaseNodeVersion, error)
|
2022-05-17 14:56:05 +00:00
|
|
|
RemoveSystemVersion(ctx context.Context, cnrID *cid.ID, nodeID uint64) error
|
|
|
|
}
|
|
|
|
|
2022-05-12 01:48:17 +00:00
|
|
|
// ErrNodeNotFound is returned from Tree service in case of not found error.
|
|
|
|
var ErrNodeNotFound = errors.New("not found")
|