Documentation ¶
Index ¶
- Constants
- func LoadKubernetesResiliency(log logger.Logger, runtimeID, namespace string, ...) []*resiliency_v1alpha.Resiliency
- func LoadStandaloneResiliency(log logger.Logger, runtimeID, path string) []*resiliency_v1alpha.Resiliency
- type ActorCircuitBreakerScope
- type ActorPolicies
- type ActorPostLockPolicyNames
- type ActorPreLockPolicyNames
- type BuiltInPolicyName
- type ComponentPolicyNames
- type NoOp
- func (*NoOp) ActorPostLockPolicy(ctx context.Context, actorType string, id string) Runner
- func (*NoOp) ActorPreLockPolicy(ctx context.Context, actorType string, id string) Runner
- func (*NoOp) BuiltInPolicy(ctx context.Context, name BuiltInPolicyName) Runner
- func (*NoOp) ComponentInboundPolicy(ctx context.Context, name string) Runner
- func (*NoOp) ComponentOutboundPolicy(ctx context.Context, name string) Runner
- func (*NoOp) EndpointPolicy(ctx context.Context, service string, endpoint string) Runner
- func (*NoOp) PolicyDefined(target string, policyType PolicyType) bool
- func (*NoOp) RoutePolicy(ctx context.Context, name string) Runner
- type Operation
- type PolicyNames
- type PolicyType
- type Provider
- type Resiliency
- func (r *Resiliency) ActorPostLockPolicy(ctx context.Context, actorType string, id string) Runner
- func (r *Resiliency) ActorPreLockPolicy(ctx context.Context, actorType string, id string) Runner
- func (r *Resiliency) BuiltInPolicy(ctx context.Context, name BuiltInPolicyName) Runner
- func (r *Resiliency) ComponentInboundPolicy(ctx context.Context, name string) Runner
- func (r *Resiliency) ComponentOutboundPolicy(ctx context.Context, name string) Runner
- func (r *Resiliency) DecodeConfiguration(c *resiliency_v1alpha.Resiliency) error
- func (r *Resiliency) EndpointPolicy(ctx context.Context, app string, endpoint string) Runner
- func (r *Resiliency) PolicyDefined(target string, policyType PolicyType) bool
- type Runner
Constants ¶
const ( BuiltInServiceRetries BuiltInPolicyName = "DaprBuiltInServiceRetries" BuiltInActorRetries BuiltInPolicyName = "DaprBuiltInActorRetries" BuiltInActorReminderRetries BuiltInPolicyName = "DaprBuiltInActorReminderRetries" BuiltInActorNotFoundRetries BuiltInPolicyName = "DaprBuiltInActorNotFoundRetries" BuiltInInitializationRetries BuiltInPolicyName = "DaprBuiltInInitializationRetries" Endpoint PolicyType = "endpoint" Component PolicyType = "component" Actor PolicyType = "actor" )
Variables ¶
This section is empty.
Functions ¶
func LoadKubernetesResiliency ¶
func LoadKubernetesResiliency(log logger.Logger, runtimeID, namespace string, operatorClient operatorv1pb.OperatorClient) []*resiliency_v1alpha.Resiliency
LoadKubernetesResiliency loads resiliency configurations from the Kubernetes operator.
func LoadStandaloneResiliency ¶
func LoadStandaloneResiliency(log logger.Logger, runtimeID, path string) []*resiliency_v1alpha.Resiliency
LoadStandaloneResiliency loads resiliency configurations from a file path.
Types ¶
type ActorCircuitBreakerScope ¶
type ActorCircuitBreakerScope int
ActorCircuitBreakerScope indicates the scope of the circuit breaker for an actor.
const ( // ActorCircuitBreakerScopeType indicates the type scope (less granular). ActorCircuitBreakerScopeType ActorCircuitBreakerScope = iota // ActorCircuitBreakerScopeID indicates the type+id scope (more granular). ActorCircuitBreakerScopeID // ActorCircuitBreakerScopeBoth indicates both type and type+id are used for scope. ActorCircuitBreakerScopeBoth // Usage is TODO. )
func ParseActorCircuitBreakerScope ¶
func ParseActorCircuitBreakerScope(val string) (ActorCircuitBreakerScope, error)
ParseActorCircuitBreakerScope parses a string to a `ActorCircuitBreakerScope`.
type ActorPolicies ¶
type ActorPolicies struct { PreLockPolicies ActorPreLockPolicyNames PostLockPolicies ActorPostLockPolicyNames }
Actors have different behavior before and after locking.
type ActorPostLockPolicyNames ¶
type ActorPostLockPolicyNames struct {
Timeout string
}
Policy used after an actor is locked. It only uses timeout as retry/circuit breaker is handled before locking.
type ActorPreLockPolicyNames ¶
type ActorPreLockPolicyNames struct { Retry string CircuitBreaker string CircuitBreakerScope ActorCircuitBreakerScope }
Policy used before an actor is locked. It does not include a timeout as we want to wait forever for the actor.
type BuiltInPolicyName ¶ added in v1.8.0
type BuiltInPolicyName string
type ComponentPolicyNames ¶
type ComponentPolicyNames struct { Inbound PolicyNames Outbound PolicyNames }
ComponentPolicyNames contains the policies for component input and output.
type NoOp ¶
type NoOp struct{}
NoOp is a true bypass implementation of `Provider`.
func (*NoOp) ActorPostLockPolicy ¶
ActorPostLockPolicy returns a NoOp policy runner for an actor instance.
func (*NoOp) ActorPreLockPolicy ¶
ActorPreLockPolicy returns a NoOp policy runner for an actor instance.
func (*NoOp) BuiltInPolicy ¶ added in v1.8.0
func (*NoOp) BuiltInPolicy(ctx context.Context, name BuiltInPolicyName) Runner
func (*NoOp) ComponentInboundPolicy ¶
ComponentInboundPolicy returns a NoOp inbound policy runner for a component.
func (*NoOp) ComponentOutboundPolicy ¶
ComponentOutboundPolicy returns a NoOp outbound policy runner for a component.
func (*NoOp) EndpointPolicy ¶
EndpointPolicy returns a NoOp policy runner for a service endpoint.
func (*NoOp) PolicyDefined ¶ added in v1.8.0
func (*NoOp) PolicyDefined(target string, policyType PolicyType) bool
type PolicyNames ¶
PolicyNames contains the policy names for a timeout, retry, and circuit breaker. Empty values mean that no policy is configured.
type PolicyType ¶ added in v1.8.0
type PolicyType string
type Provider ¶
type Provider interface { // EndpointPolicy returns the policy for a service endpoint. EndpointPolicy(ctx context.Context, service string, endpoint string) Runner // ActorPolicy returns the policy for an actor instance to be used before the lock is acquired. ActorPreLockPolicy(ctx context.Context, actorType string, id string) Runner // ActorPolicy returns the policy for an actor instance to be used after the lock is acquired. ActorPostLockPolicy(ctx context.Context, actorType string, id string) Runner // ComponentOutboundPolicy returns the outbound policy for a component. ComponentOutboundPolicy(ctx context.Context, name string) Runner // ComponentInboundPolicy returns the inbound policy for a component. ComponentInboundPolicy(ctx context.Context, name string) Runner // BuiltInPolicy are used to replace existing retries in Dapr which may not bind specifically to one of the above categories. BuiltInPolicy(ctx context.Context, name BuiltInPolicyName) Runner // PolicyDefined returns a boolean stating if the given target has a policy. PolicyDefined(target string, policyType PolicyType) bool }
Provider is the interface for returning a `Runner` for the various resiliency scenarios in the runtime.
type Resiliency ¶
type Resiliency struct {
// contains filtered or unexported fields
}
Resiliency encapsulates configuration for timeouts, retries, and circuit breakers. It maps services, actors, components, and routes to each of these configurations. Lastly, it maintains circuit breaker state across invocations.
func FromConfigurations ¶
func FromConfigurations(log logger.Logger, c ...*resiliency_v1alpha.Resiliency) *Resiliency
FromConfigurations creates a resiliency provider and decodes the configurations from `c`.
func (*Resiliency) ActorPostLockPolicy ¶
ActorPostLockPolicy returns the policy for an actor instance to be used after an actor lock is acquired.
func (*Resiliency) ActorPreLockPolicy ¶
ActorPreLockPolicy returns the policy for an actor instance to be used before an actor lock is acquired.
func (*Resiliency) BuiltInPolicy ¶ added in v1.8.0
func (r *Resiliency) BuiltInPolicy(ctx context.Context, name BuiltInPolicyName) Runner
BuiltInPolicy returns a policy that represents a specific built-in retry scenario.
func (*Resiliency) ComponentInboundPolicy ¶
func (r *Resiliency) ComponentInboundPolicy(ctx context.Context, name string) Runner
ComponentPolicy returns the policy for a component.
func (*Resiliency) ComponentOutboundPolicy ¶
func (r *Resiliency) ComponentOutboundPolicy(ctx context.Context, name string) Runner
ComponentPolicy returns the output policy for a component.
func (*Resiliency) DecodeConfiguration ¶
func (r *Resiliency) DecodeConfiguration(c *resiliency_v1alpha.Resiliency) error
DecodeConfiguration reads in a single resiliency configuration.
func (*Resiliency) EndpointPolicy ¶
EndpointPolicy returns the policy for a service endpoint.
func (*Resiliency) PolicyDefined ¶ added in v1.8.0
func (r *Resiliency) PolicyDefined(target string, policyType PolicyType) bool
Returns true if a target has a defined policy.