Skip to content

Commit

Permalink
[#1111] object/acl: Refactor service
Browse files Browse the repository at this point in the history
Make all operations that related to `neofs-api-go` library be placed in `v2`
packages. They parse all v2-versioned structs info `neofs-sdk-go`
abstractions and pass them to the corresponding `acl`/`eacl` packages. `v2`
packages are the only packages that do import `neofs-api-go` library. `eacl`
and `acl` provide public functions that only accepts `sdk` structures.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
  • Loading branch information
carpawell committed Feb 28, 2022
1 parent e0dce10 commit 04c58bb
Show file tree
Hide file tree
Showing 19 changed files with 1,287 additions and 1,021 deletions.
30 changes: 16 additions & 14 deletions cmd/neofs-node/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
objectTransportGRPC "github.com/nspcc-dev/neofs-node/pkg/network/transport/object/grpc"
objectService "github.com/nspcc-dev/neofs-node/pkg/services/object"
"github.com/nspcc-dev/neofs-node/pkg/services/object/acl"
v2 "github.com/nspcc-dev/neofs-node/pkg/services/object/acl/v2"
deletesvc "github.com/nspcc-dev/neofs-node/pkg/services/object/delete"
deletesvcV2 "github.com/nspcc-dev/neofs-node/pkg/services/object/delete/v2"
getsvc "github.com/nspcc-dev/neofs-node/pkg/services/object/get"
Expand Down Expand Up @@ -194,7 +195,7 @@ func initObjectService(c *cfg) {

coreConstructor := (*coreClientConstructor)(clientConstructor)

var irFetcher acl.InnerRingFetcher
var irFetcher v2.InnerRingFetcher

if c.cfgMorph.client.ProbeNotary() {
irFetcher = &innerRingFetcherWithNotary{
Expand Down Expand Up @@ -345,21 +346,22 @@ func initObjectService(c *cfg) {
},
)

aclSvc := acl.New(
acl.WithSenderClassifier(
acl.NewSenderClassifier(
c.log,
irFetcher,
c.cfgNetmap.wrapper,
),
),
acl.WithContainerSource(
aclSvc := v2.New(
v2.WithLogger(c.log),
v2.WithIRFetcher(irFetcher),
v2.WithNetmapClient(c.cfgNetmap.wrapper),
v2.WithContainerSource(
c.cfgObject.cnrSource,
),
acl.WithNextService(splitSvc),
acl.WithLocalStorage(ls),
acl.WithEACLSource(c.cfgObject.eaclSource),
acl.WithNetmapState(c.cfgNetmap.state),
v2.WithNextService(splitSvc),
v2.WithEACLChecker(
acl.NewChecker(new(acl.CheckerPrm).
SetNetmapState(c.cfgNetmap.state).
SetEACLSource(c.cfgObject.eaclSource).
SetValidator(eaclSDK.NewValidator()).
SetLocalStorage(ls),
),
),
)

respSvc := objectService.NewResponseService(
Expand Down
Loading

0 comments on commit 04c58bb

Please sign in to comment.