forked from TrueCloudLab/frostfs-s3-gw
[#253] Caches refactoring
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
951eb6fda8
commit
19b917e3b5
30 changed files with 365 additions and 322 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||
cid "github.com/nspcc-dev/neofs-api-go/pkg/container/id"
|
||||
"github.com/nspcc-dev/neofs-s3-gw/api"
|
||||
"github.com/nspcc-dev/neofs-s3-gw/api/data"
|
||||
"github.com/nspcc-dev/neofs-s3-gw/api/errors"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/pool"
|
||||
"go.uber.org/zap"
|
||||
|
@ -20,19 +21,19 @@ import (
|
|||
type (
|
||||
// BucketACL extends BucketInfo by eacl.Table.
|
||||
BucketACL struct {
|
||||
Info *api.BucketInfo
|
||||
Info *data.BucketInfo
|
||||
EACL *eacl.Table
|
||||
}
|
||||
)
|
||||
|
||||
func (n *layer) containerInfo(ctx context.Context, cid *cid.ID) (*api.BucketInfo, error) {
|
||||
func (n *layer) containerInfo(ctx context.Context, cid *cid.ID) (*data.BucketInfo, error) {
|
||||
var (
|
||||
err error
|
||||
res *container.Container
|
||||
rid = api.GetRequestID(ctx)
|
||||
bearerOpt = n.BearerOpt(ctx)
|
||||
|
||||
info = &api.BucketInfo{
|
||||
info = &data.BucketInfo{
|
||||
CID: cid,
|
||||
Name: cid.String(),
|
||||
}
|
||||
|
@ -83,7 +84,7 @@ func (n *layer) containerInfo(ctx context.Context, cid *cid.ID) (*api.BucketInfo
|
|||
return info, nil
|
||||
}
|
||||
|
||||
func (n *layer) containerList(ctx context.Context) ([]*api.BucketInfo, error) {
|
||||
func (n *layer) containerList(ctx context.Context) ([]*data.BucketInfo, error) {
|
||||
var (
|
||||
err error
|
||||
own = n.Owner(ctx)
|
||||
|
@ -99,7 +100,7 @@ func (n *layer) containerList(ctx context.Context) ([]*api.BucketInfo, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
list := make([]*api.BucketInfo, 0, len(res))
|
||||
list := make([]*data.BucketInfo, 0, len(res))
|
||||
for _, cid := range res {
|
||||
info, err := n.containerInfo(ctx, cid)
|
||||
if err != nil {
|
||||
|
@ -117,7 +118,7 @@ func (n *layer) containerList(ctx context.Context) ([]*api.BucketInfo, error) {
|
|||
|
||||
func (n *layer) createContainer(ctx context.Context, p *CreateBucketParams) (*cid.ID, error) {
|
||||
var err error
|
||||
bktInfo := &api.BucketInfo{
|
||||
bktInfo := &data.BucketInfo{
|
||||
Name: p.Name,
|
||||
Owner: n.Owner(ctx),
|
||||
Created: time.Now(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue