diff --git a/pkg/innerring/processors/container/handlers.go b/pkg/innerring/processors/container/handlers.go index a29445676..3fabdb157 100644 --- a/pkg/innerring/processors/container/handlers.go +++ b/pkg/innerring/processors/container/handlers.go @@ -42,3 +42,22 @@ func (cp *Processor) handleDelete(ev event.Event) { zap.Int("capacity", cp.pool.Cap())) } } + +func (cp *Processor) handleSetEACL(ev event.Event) { + e := ev.(containerEvent.SetEACL) + + cp.log.Info("notification", + zap.String("type", "set EACL"), + ) + + // send event to the worker pool + + err := cp.pool.Submit(func() { + cp.processSetEACL(e) + }) + if err != nil { + // there system can be moved into controlled degradation stage + cp.log.Warn("container processor worker pool drained", + zap.Int("capacity", cp.pool.Cap())) + } +} diff --git a/pkg/innerring/processors/container/process_eacl.go b/pkg/innerring/processors/container/process_eacl.go new file mode 100644 index 000000000..9c014605c --- /dev/null +++ b/pkg/innerring/processors/container/process_eacl.go @@ -0,0 +1,37 @@ +package container + +import ( + "github.com/nspcc-dev/neofs-node/pkg/morph/event/container" + "go.uber.org/zap" +) + +func (cp *Processor) processSetEACL(e container.SetEACL) { + if !cp.alphabetState.IsAlphabet() { + cp.log.Info("non alphabet mode, ignore set EACL") + return + } + + err := cp.checkSetEACL(e) + if err != nil { + cp.log.Error("set EACL check failed", + zap.String("error", err.Error()), + ) + + return + } + + cp.approveSetEACL(e) +} + +func (cp *Processor) checkSetEACL(e container.SetEACL) error { + return nil +} + +func (cp *Processor) approveSetEACL(e container.SetEACL) { + err := cp.cnrClient.PutEACLBinary(e.Table(), e.PublicKey(), e.Signature()) + if err != nil { + cp.log.Error("could not approve set EACL", + zap.String("error", err.Error()), + ) + } +} diff --git a/pkg/innerring/processors/container/processor.go b/pkg/innerring/processors/container/processor.go index c37c50e93..de664754e 100644 --- a/pkg/innerring/processors/container/processor.go +++ b/pkg/innerring/processors/container/processor.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neofs-node/pkg/innerring/config" "github.com/nspcc-dev/neofs-node/pkg/morph/client" + "github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper" "github.com/nspcc-dev/neofs-node/pkg/morph/event" containerEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/container" "github.com/panjf2000/ants/v2" @@ -27,6 +28,7 @@ type ( morphClient *client.Client alphabetState AlphabetState feeProvider *config.FeeConfig + cnrClient *wrapper.Wrapper } // Params of the processor constructor.