Documentation ¶
Index ¶
- Constants
- Variables
- func LoadKubernetesResiliency(log logger.Logger, runtimeID, namespace string, ...) []*resiliencyV1alpha.Resiliency
- func LoadStandaloneResiliency(log logger.Logger, runtimeID, path string) []*resiliencyV1alpha.Resiliency
- type ActorCircuitBreakerScope
- type ActorPolicies
- type ActorPolicy
- type ActorPostLockPolicyNames
- type ActorPreLockPolicyNames
- type BuiltInPolicyName
- type ComponentPolicy
- type ComponentPolicyNames
- type ComponentType
- type DefaultPolicyTemplate
- type EndpointPolicy
- 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, componentName ComponentType) Runner
- func (*NoOp) ComponentOutboundPolicy(ctx context.Context, name string, componentName ComponentType) Runner
- func (*NoOp) EndpointPolicy(ctx context.Context, service string, endpoint string) Runner
- func (*NoOp) GetPolicy(target string, policyType PolicyType) *PolicyDescription
- func (*NoOp) RoutePolicy(ctx context.Context, name string) Runner
- type Operation
- type PolicyDescription
- type PolicyNames
- type PolicyType
- type PolicyTypeName
- 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, componentType ComponentType) Runner
- func (r *Resiliency) ComponentOutboundPolicy(ctx context.Context, name string, componentType ComponentType) Runner
- func (r *Resiliency) DecodeConfiguration(c *resiliencyV1alpha.Resiliency) error
- func (r *Resiliency) EndpointPolicy(ctx context.Context, app string, endpoint string) Runner
- func (r *Resiliency) GetPolicy(target string, policyType PolicyType) *PolicyDescription
- type Runner
Constants ¶
const ( BuiltInServiceRetries BuiltInPolicyName = "DaprBuiltInServiceRetries" BuiltInActorRetries BuiltInPolicyName = "DaprBuiltInActorRetries" BuiltInActorReminderRetries BuiltInPolicyName = "DaprBuiltInActorReminderRetries" BuiltInActorNotFoundRetries BuiltInPolicyName = "DaprBuiltInActorNotFoundRetries" BuiltInInitializationRetries BuiltInPolicyName = "DaprBuiltInInitializationRetries" DefaultRetryTemplate DefaultPolicyTemplate = "Default%sRetryPolicy" DefaultTimeoutTemplate DefaultPolicyTemplate = "Default%sTimeoutPolicy" DefaultCircuitBreakerTemplate DefaultPolicyTemplate = "Default%sCircuitBreakerPolicy" Endpoint PolicyTypeName = "App" Component PolicyTypeName = "Component" Actor PolicyTypeName = "Actor" Binding ComponentType = "Binding" Configuration ComponentType = "Configuration" Lock ComponentType = "Lock" Pubsub ComponentType = "Pubsub" Secretstore ComponentType = "Secretstore" Statestore ComponentType = "Statestore" )
Variables ¶
var ComponentInboundPolicy = ComponentPolicy{ // contains filtered or unexported fields }
var ComponentOutboundPolicy = ComponentPolicy{ // contains filtered or unexported fields }
Functions ¶
func LoadKubernetesResiliency ¶
func LoadKubernetesResiliency(log logger.Logger, runtimeID, namespace string, operatorClient operatorv1pb.OperatorClient) []*resiliencyV1alpha.Resiliency
LoadKubernetesResiliency loads resiliency configurations from the Kubernetes operator.
func LoadStandaloneResiliency ¶
func LoadStandaloneResiliency(log logger.Logger, runtimeID, path string) []*resiliencyV1alpha.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 ActorPolicy ¶ added in v1.9.0
type ActorPolicy struct{}
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 ComponentPolicy ¶ added in v1.9.0
type ComponentPolicy struct {
// contains filtered or unexported fields
}
type ComponentPolicyNames ¶
type ComponentPolicyNames struct { Inbound PolicyNames Outbound PolicyNames }
ComponentPolicyNames contains the policies for component input and output.
type ComponentType ¶ added in v1.9.0
type ComponentType string
type DefaultPolicyTemplate ¶ added in v1.9.0
type DefaultPolicyTemplate string
type EndpointPolicy ¶ added in v1.9.0
type EndpointPolicy struct{}
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 ¶
func (*NoOp) ComponentInboundPolicy(ctx context.Context, name string, componentName ComponentType) Runner
ComponentInboundPolicy returns a NoOp inbound policy runner for a component.
func (*NoOp) ComponentOutboundPolicy ¶
func (*NoOp) ComponentOutboundPolicy(ctx context.Context, name string, componentName ComponentType) Runner
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) GetPolicy ¶ added in v1.9.0
func (*NoOp) GetPolicy(target string, policyType PolicyType) *PolicyDescription
type PolicyDescription ¶ added in v1.9.0
type PolicyDescription struct { RetryPolicy *retry.Config TimeoutPolicy time.Duration CircuitBreaker *breaker.CircuitBreaker }
PolicyDescription contains the policies that are applied to a target.
func (PolicyDescription) HasRetries ¶ added in v1.9.0
func (p PolicyDescription) HasRetries() bool
HasRetries returns true if the policy is configured to have more than 1 retry.
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 interface {
// contains filtered or unexported methods
}
PolicyTypes have to return an array of their possible levels. Ex. [App], Actor, [Component, Inbound|Outbound, ComponentType]
type PolicyTypeName ¶ added in v1.9.0
type PolicyTypeName 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, componentType ComponentType) Runner // ComponentInboundPolicy returns the inbound policy for a component. ComponentInboundPolicy(ctx context.Context, name string, componentType ComponentType) 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 // GetPolicy returns the policy that applies to the target, or nil if there is none. GetPolicy(target string, policyType PolicyType) *PolicyDescription }
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 ...*resiliencyV1alpha.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, componentType ComponentType) Runner
ComponentInboundPolicy returns the inbound policy for a component.
func (*Resiliency) ComponentOutboundPolicy ¶
func (r *Resiliency) ComponentOutboundPolicy(ctx context.Context, name string, componentType ComponentType) Runner
ComponentOutboundPolicy returns the outbound policy for a component.
func (*Resiliency) DecodeConfiguration ¶
func (r *Resiliency) DecodeConfiguration(c *resiliencyV1alpha.Resiliency) error
DecodeConfiguration reads in a single resiliency configuration.
func (*Resiliency) EndpointPolicy ¶
EndpointPolicy returns the policy for a service endpoint.
func (*Resiliency) GetPolicy ¶ added in v1.9.0
func (r *Resiliency) GetPolicy(target string, policyType PolicyType) *PolicyDescription
GetPolicy returns the policy that applies to the target, or nil if there is none.