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,6 +1,9 @@
|
||||||
package policyengine
|
package policyengine
|
||||||
|
|
||||||
|
import "sync/atomic"
|
||||||
|
|
||||||
type inmemory struct {
|
type inmemory struct {
|
||||||
|
chainCounter atomic.Uint32
|
||||||
namespace map[Name][]chain
|
namespace map[Name][]chain
|
||||||
resource map[Name][]chain
|
resource map[Name][]chain
|
||||||
local map[Name][]*Chain
|
local map[Name][]*Chain
|
||||||
|
|
Loading…
Reference in a new issue