Documentation
¶
Index ¶
- Variables
- func NewPolicyComputationTable(db *statedb.DB) (statedb.RWTable[Result], statedb.Index[Result, identity.NumericIdentity], ...)
- func PolicyComputerScriptCmds(pc *IdentityPolicyComputer) map[string]script.Cmd
- type IdentityPolicyComputer
- func (r *IdentityPolicyComputer) GetAuthTypes(localID, remoteID identity.NumericIdentity) types.AuthTypes
- func (r *IdentityPolicyComputer) GetIdentityPolicyByIdentity(identity *identity.Identity) (Result, statedb.Revision, <-chan struct{}, bool)
- func (r *IdentityPolicyComputer) GetIdentityPolicyByNumericIdentity(identity identity.NumericIdentity) (Result, statedb.Revision, <-chan struct{}, bool)
- func (r *IdentityPolicyComputer) GetPolicySnapshot() map[identity.NumericIdentity]policy.SelectorPolicy
- func (r *IdentityPolicyComputer) LocalEndpointIdentityAdded(id *identity.Identity)
- func (r *IdentityPolicyComputer) LocalEndpointIdentityRemoved(id *identity.Identity)
- func (r *IdentityPolicyComputer) RecomputeIdentityPolicy(identity *identity.Identity, toRev uint64) (<-chan struct{}, error)
- func (r *IdentityPolicyComputer) RecomputeIdentityPolicyForAllIdentities(toRev uint64) (*statedb.WatchSet, error)
- func (r *IdentityPolicyComputer) UpdatePolicy(idsToRegen set.Set[identity.NumericIdentity], _, toRev uint64)
- type Params
- type PolicyRecomputer
- type Result
Constants ¶
This section is empty.
Variables ¶
var ( PolicyComputationNameIndex = statedb.Index[Result, identity.NumericIdentity]{ Name: "numeric-identity", FromObject: func(r Result) index.KeySet { return index.NewKeySet(index.Uint32(uint32(r.Identity))) }, FromKey: func(i identity.NumericIdentity) index.Key { return index.Uint32(uint32(i)) }, FromString: index.Uint32String, Unique: true, } PolicyComputationByIdentity = PolicyComputationNameIndex.Query )
var Cell = cell.Module( "identity-policy-computer", "Handles policy computation per identity", cell.ProvidePrivate(NewPolicyComputationTable), cell.Provide( func(params Params) PolicyRecomputer { return NewIdentityPolicyComputer(params) }, statedb.RWTable[Result].ToTable, ), )
Cell provides the IdentityPolicyRecomputer as a hive cell.
Functions ¶
func PolicyComputerScriptCmds ¶
func PolicyComputerScriptCmds(pc *IdentityPolicyComputer) map[string]script.Cmd
Types ¶
type IdentityPolicyComputer ¶
type IdentityPolicyComputer struct {
// contains filtered or unexported fields
}
IdentityPolicyComputer handles policy computation for specific identities.
func NewIdentityPolicyComputer ¶
func NewIdentityPolicyComputer(params Params) *IdentityPolicyComputer
func (*IdentityPolicyComputer) GetAuthTypes ¶
func (r *IdentityPolicyComputer) GetAuthTypes(localID, remoteID identity.NumericIdentity) types.AuthTypes
GetAuthTypes returns the AuthTypes required by the policy between localID and remoteID. Returns nil if the local identity has no computed policy yet or if no auth is required.
func (*IdentityPolicyComputer) GetIdentityPolicyByIdentity ¶
func (*IdentityPolicyComputer) GetIdentityPolicyByNumericIdentity ¶
func (r *IdentityPolicyComputer) GetIdentityPolicyByNumericIdentity(identity identity.NumericIdentity) (Result, statedb.Revision, <-chan struct{}, bool)
func (*IdentityPolicyComputer) GetPolicySnapshot ¶
func (r *IdentityPolicyComputer) GetPolicySnapshot() map[identity.NumericIdentity]policy.SelectorPolicy
GetPolicySnapshot returns the current SelectorPolicy for every identity in the compute table. The returned map is a snapshot taken at a single statedb revision.
func (*IdentityPolicyComputer) LocalEndpointIdentityAdded ¶
func (r *IdentityPolicyComputer) LocalEndpointIdentityAdded(id *identity.Identity)
LocalEndpointIdentityAdded is part of the identitymanager.Observer interface.
The subject selectorcache must be updated with the identity before recomputation, otherwise policy will not be computed properly.
func (*IdentityPolicyComputer) LocalEndpointIdentityRemoved ¶
func (r *IdentityPolicyComputer) LocalEndpointIdentityRemoved(id *identity.Identity)
LocalEndpointIdentityRemoved is part of the identitymanager.Observer interface.
func (*IdentityPolicyComputer) RecomputeIdentityPolicy ¶
func (r *IdentityPolicyComputer) RecomputeIdentityPolicy(identity *identity.Identity, toRev uint64) (<-chan struct{}, error)
RecomputeIdentityPolicy schedules a policy recomputation for identity at toRev. The returned channel closes once the result is committed to the table. A pending request for the same identity is reused, bumping its toRev to max(existing, toRev), so there is at most one in-flight request per identity.
func (*IdentityPolicyComputer) RecomputeIdentityPolicyForAllIdentities ¶
func (r *IdentityPolicyComputer) RecomputeIdentityPolicyForAllIdentities(toRev uint64) (*statedb.WatchSet, error)
RecomputeIdentityPolicyForAllIdentities recomputes policy for all local identities.
func (*IdentityPolicyComputer) UpdatePolicy ¶
func (r *IdentityPolicyComputer) UpdatePolicy(idsToRegen set.Set[identity.NumericIdentity], _, toRev uint64)
type PolicyRecomputer ¶
type PolicyRecomputer interface {
RecomputeIdentityPolicy(identity *identity.Identity, toRev uint64) (<-chan struct{}, error)
RecomputeIdentityPolicyForAllIdentities(toRev uint64) (*statedb.WatchSet, error)
UpdatePolicy(idsToRegen set.Set[identity.NumericIdentity], fromRev, toRev uint64)
GetIdentityPolicyByNumericIdentity(identity identity.NumericIdentity) (Result, statedb.Revision, <-chan struct{}, bool)
GetIdentityPolicyByIdentity(identity *identity.Identity) (Result, statedb.Revision, <-chan struct{}, bool)
GetAuthTypes(localID, remoteID identity.NumericIdentity) policyTypes.AuthTypes
GetPolicySnapshot() map[identity.NumericIdentity]policy.SelectorPolicy
}