frostfs-node/pkg/services/object/acl/eacl/opts.go
Leonard Lyubich 69a69cdbee [#67] object/eacl: Implement eACL validator
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-02 19:46:45 +03:00

38 lines
722 B
Go

package eacl
import (
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
"github.com/nspcc-dev/neofs-api-go/pkg/container"
"github.com/nspcc-dev/neofs-node/pkg/morph/client/container/wrapper"
"github.com/nspcc-dev/neofs-node/pkg/util/logger"
)
type morphStorage struct {
w *wrapper.Wrapper
}
func (s *morphStorage) GetEACL(cid *container.ID) (*eacl.Table, error) {
table, _, err := s.w.GetEACL(cid)
return table, err
}
func WithLogger(v *logger.Logger) Option {
return func(c *cfg) {
c.logger = v
}
}
func WithEACLStorage(v Storage) Option {
return func(c *cfg) {
c.storage = v
}
}
func WithMorphClient(v *wrapper.Wrapper) Option {
return func(c *cfg) {
c.storage = &morphStorage{
w: v,
}
}
}