[#13] chain: Introduce ChainID type

Signed-off-by: aarifullin <aarifullin@yadro.com>
This commit is contained in:
aarifullin 2023-10-31 01:52:04 +03:00
parent 31a308ea61
commit 35f24627f0
2 changed files with 11 additions and 3 deletions

View file

@ -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
} }

View file

@ -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 {