generated from TrueCloudLab/basic
[#7] engine: Revise storage interface #15
No reviewers
TrueCloudLab/storage-core-developers
TrueCloudLab/storage-services-developers
Labels
No labels
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/policy-engine#15
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/policy-engine:feature/7-revise_iface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
local overrides
chains in the policy contract
Signed-off-by: aarifullin aarifullin@yadro.com
aa76ef86a6
tod3e9d0a52d
d3e9d0a52d
to5f103a7a5f
There conflicts and linters fail, please, take a look.
@ -11,3 +10,3 @@
// IsAllowed returns status for the operation after all checks.
// The second return value signifies whether a matching rule was found.
IsAllowed(name Name, namespace string, r Request) (Status, bool)
IsAllowed(name Name, target string, r Request) (status Status, found bool, err error)
At first glance, the question arises: why is
found
not theStatus
field?Probably you are right. I suppose that's was first implementation's flavour and we can use just
NoRuleFound
without flag but since we need the error because we will list rules either from a local db or from the contract@ -0,0 +3,4 @@
import "errors"
var (
errUnknownTarget = errors.New("unknown target type")
The same as in
inmemory.go
. Maybe unify?Sorry. That's was after incorrect rebase. This problem is not actual
@ -0,0 +12,4 @@
morph ape.MorphRuleChainStorage
}
func NewInMemory() ape.Engine {
Looks like
inmemory.go
duplicateSorry. That's was after incorrect rebase. This problem is not actual
5f103a7a5f
toc2dc96931a
c2dc96931a
to48bb4a110c
@ -0,0 +9,4 @@
"github.com/stretchr/testify/require"
)
func TestInmemory(t *testing.T) {
@TrueCloudLab/storage-core-developers
Even I tried to move to this file with
git mv
it's showed as the new created file because I changed the file in next commits. But I want to emphasize I have not changed the logical structure of the unittest and changed only signatures48bb4a110c
to0f427b496f
0f427b496f
to63aa1e4708
63aa1e4708
to45b524d8db
45b524d8db
to97fe723559
97fe723559
to99994dcc4c
@ -4,3 +4,3 @@
"testing"
policyengine "git.frostfs.info/TrueCloudLab/policy-engine"
chainpkg "git.frostfs.info/TrueCloudLab/policy-engine/pkg/chain"
Why do we use alias here? In the previous version it was because of the hyphen.
Because tests use
So, either we need to make either an alias for the package or rename
chain
. Would we prefer the second option?I think the second option is better. I will fix
@ -0,0 +13,4 @@
type ID string
type Chain struct {
ID *ID
Why is it a pointer? Empty value can equal to missing ID is is not a valid name.
Fixed
@ -0,0 +24,4 @@
}
}
func (s *inmemoryLocalStorage) generateChainID(name chain.Name, resource string) *chain.ID {
Does chain id have a specific structure?
No, it does not.
I glimpsed at the chain names in policy contract unit-tests and found the idea to name a chain like
ingress:resource:name
more useful than a numeric ID. Anyway,inmemory
implementation will only be used for a while and will be kept only for unit-tests. I think such names are fine and readableWill we have some in-memory implementation for
LocalOverrideStorage
that can be used in s3-gw/node? Or it's expected that s3-gw and node must implement their ownLocalOverrideStorage
?Good question.
It assumed that
LocalOverrideStorage
should be implemented by each service separately. For example, frostfs-node will use DB to keep and retrieve local overrides that doesn't seem applicable for s3-gw.But I am wondering was it implied to define local overrides for
s3-gw
? If it was not, then probably it makes sense to separate the interface:I'm not sure. It seems we will have only some cache layer, but it be a part of
MorphRuleChainStorage
implementation I think@alexvanin
I have splitted the interface into two:
LocalOverrideEngine
andEngine
(the first one contains the second). Please, check@ -0,0 +17,4 @@
return r.properties[name]
}
func NewResource(name string, properties map[string]string) *Resource {
Why do both request and resource accept a map now?
I don't know. I just moved the file and made constructors importable :) (
new..
->New...
). What is your concern about these maps?Also, this structs are usable only for unit-tests witihn policy-engine
Oh, I see, missed testutil package
99994dcc4c
to89a1896cb1
89a1896cb1
to0b6526fad0
0b6526fad0
to342551d2c0
342551d2c0
to4455219384
4455219384
to73959e4747
73959e4747
to5a306794c7
5a306794c7
toe47af4b111