forked from TrueCloudLab/policy-engine
[#13] chain: Introduce ChainID type
Signed-off-by: aarifullin <aarifullin@yadro.com>
This commit is contained in:
parent
31a308ea61
commit
35f24627f0
2 changed files with 11 additions and 3 deletions
5
chain.go
5
chain.go
|
@ -13,7 +13,12 @@ type Engine interface {
|
||||||
IsAllowed(name Name, namespace string, r Request) (Status, bool)
|
IsAllowed(name Name, namespace string, r Request) (Status, bool)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ChainID is the ID of rule chain.
|
||||||
|
type ChainID string
|
||||||
|
|
||||||
type Chain struct {
|
type Chain struct {
|
||||||
|
ID ChainID
|
||||||
|
|
||||||
Rules []Rule
|
Rules []Rule
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
package policyengine
|
package policyengine
|
||||||
|
|
||||||
|
import "sync/atomic"
|
||||||
|
|
||||||
type inmemory struct {
|
type inmemory struct {
|
||||||
namespace map[Name][]chain
|
chainCounter atomic.Uint32
|
||||||
resource map[Name][]chain
|
namespace map[Name][]chain
|
||||||
local map[Name][]*Chain
|
resource map[Name][]chain
|
||||||
|
local map[Name][]*Chain
|
||||||
}
|
}
|
||||||
|
|
||||||
type chain struct {
|
type chain struct {
|
||||||
|
|
Loading…
Reference in a new issue