generated from TrueCloudLab/basic
engine: Refactor LocalOverrideStorage #25
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#25
Loading…
Reference in a new issue
No description provided.
Delete branch "aarifullin/policy-engine:feature/revise_local_override_storage_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?
instead resource
only for container but also for namespace
0257f20056
toea4d41a973
[#XX] engine: Refactor LocalOverrideStorageto engine: Refactor LocalOverrideStorage@ -25,19 +25,36 @@ func NewDefaultChainRouterWithLocalOverrides(morph MorphRuleChainStorage, local
}
func (dr *defaultChainRouter) IsAllowed(name chain.Name, namespace string, r resource.Request) (status chain.Status, ruleFound bool, err error) {
By the way, why don't we use
target Target
insteadnamespace string
?I think I've got better idea: pass
targets ...Target
instead the onlynamespace
I found the router works correctly for
PutObject
cases because we can retrieveContainerTarget
from resource (native:object//LxGyWyL/*
) that allows to succesfully retrieve rule chains from local/morph storage, but it will stop working for other cases.We should check if the request is allowed against passed
targets
like:other combinations
That works
WDYT?
cc @fyrchik @alexvanin @dstepanov-yadro
@ -53,3 +53,3 @@
}
rc := s.nameToResourceChains[name]
rc[resource] = append(rc[resource], c)
rc[target] = append(rc[target], c)
Can we check that current list doesn't contain chain with the same ID?
Since it is replaced if IDs are equal
@ -30,1 +29,3 @@
status, localRuleFound, err = dr.checkLocalOverrides(name, r)
func (dr *defaultChainRouter) IsAllowed(name chain.Name, r resource.Request, targets ...Target) (status chain.Status, ruleFound bool, err error) {
// Container rule chains have higher priority.
sort.Slice(targets, func(i, j int) bool {
Shouldn't we use
sort.SliceStable
or considering names in sort in addition? Otherwise it seems we can get different result when providing two container targets.You're correct about using
sort.SliceStable
- it is exactly what I meant hereI suppose we do not need so keen about this - we just need to consider containers first, then - namespaces
@ -34,2 +54,3 @@
ruleFound = true
return
} else if ruleFound {
break
Why logic for handling local targets differ from handling morph targets?
This is a good point. In the first implementation local overrides were target-less and returned the result immediatly.
For now local overrides operate with several target types and I think you are right. The logic here (not above) should be the same with morph rules when
checkLocal
iterates all target rulesc8c0b0d95f
to67626c0019
67626c0019
to17bcde6b24
17bcde6b24
toddd305e867
LGTM
ddd305e867
toe78ae34bbd