Documentation ¶
Index ¶
- Constants
- Variables
- func ShutdownSignal() chan os.Signal
- type ComponentAuthorizer
- type ComponentCategory
- type ComponentRegistry
- type ComponentsCallback
- type Config
- type DaprRuntime
- func (a *DaprRuntime) ApplyBulkSubscribeResiliency(ctx context.Context, bulkSubCallData *bulkSubscribeCallData, ...) (*[]pubsub.BulkSubscribeResponseEntry, error)
- func (a *DaprRuntime) BulkPublish(req *pubsub.BulkPublishRequest) (pubsub.BulkPublishResponse, error)
- func (a *DaprRuntime) GetPubSub(pubsubName string) pubsub.PubSub
- func (a *DaprRuntime) Publish(req *pubsub.PublishRequest) error
- func (a *DaprRuntime) Run(opts ...Option) error
- func (a *DaprRuntime) SetRunning(val bool)
- func (a *DaprRuntime) Shutdown(duration time.Duration)
- func (a *DaprRuntime) ShutdownWithWait()
- func (a *DaprRuntime) Subscribe(ctx context.Context, name string, routes map[string]compstore.TopicRouteElem) (err error)
- func (a *DaprRuntime) WaitUntilShutdown() error
- type HTTPEndpointAuthorizer
- type InitError
- type InitErrorKind
- type NewRuntimeConfigOpts
- type Option
- func WithBindings(registry *bindingsLoader.Registry) Option
- func WithComponentsCallback(componentsCallback ComponentsCallback) Option
- func WithConfigurations(registry *configurationLoader.Registry) Option
- func WithCryptoProviders(registry *cryptoLoader.Registry) Option
- func WithHTTPMiddlewares(registry *httpMiddlewareLoader.Registry) Option
- func WithLocks(registry *lockLoader.Registry) Option
- func WithNameResolutions(registry *nrLoader.Registry) Option
- func WithPubSubs(registry *pubsubLoader.Registry) Option
- func WithSecretStores(registry *secretstoresLoader.Registry) Option
- func WithStates(registry *stateLoader.Registry) Option
- func WithWorkflowComponents(registry *workflowsLoader.Registry) Option
- type Protocol
- type RetriableError
Constants ¶
const ( // GRPCProtocol is the gRPC communication protocol. GRPCProtocol Protocol = "grpc" // GRPCSProtocol is the gRPC communication protocol with TLS (without validating certificates). GRPCSProtocol Protocol = "grpcs" // HTTPProtocol is the HTTP communication protocol. HTTPProtocol Protocol = "http" // HTTPSProtocol is the HTTPS communication protocol with TLS (without validating certificates). HTTPSProtocol Protocol = "https" // H2CProtocol is the HTTP/2 Cleartext communication protocol (HTTP/2 without TLS). H2CProtocol Protocol = "h2c" // DefaultDaprHTTPPort is the default http port for Dapr. DefaultDaprHTTPPort = 3500 // DefaultDaprPublicPort is the default http port for Dapr. DefaultDaprPublicPort = 3501 // DefaultDaprAPIGRPCPort is the default API gRPC port for Dapr. DefaultDaprAPIGRPCPort = 50001 // DefaultProfilePort is the default port for profiling endpoints. DefaultProfilePort = 7777 // DefaultMetricsPort is the default port for metrics endpoints. DefaultMetricsPort = 9090 // DefaultMaxRequestBodySize is the default option for the maximum body size in MB for Dapr HTTP servers. DefaultMaxRequestBodySize = 4 // DefaultAPIListenAddress is which address to listen for the Dapr HTTP and GRPC APIs. Empty string is all addresses. DefaultAPIListenAddress = "" // DefaultReadBufferSize is the default option for the maximum header size in KB for Dapr HTTP servers. DefaultReadBufferSize = 4 // DefaultGracefulShutdownDuration is the default option for the duration of the graceful shutdown. DefaultGracefulShutdownDuration = time.Second * 5 // DefaultAppHealthCheckPath is the default path for HTTP health checks. DefaultAppHealthCheckPath = "/healthz" // DefaultChannelAddress is the default local network address that user application listen on. DefaultChannelAddress = "127.0.0.1" )
Variables ¶
var ErrUnexpectedEnvelopeData = errors.New("unexpected data type encountered in envelope")
ErrUnexpectedEnvelopeData denotes that an unexpected data type was encountered when processing a cloud event's data property.
Functions ¶
func ShutdownSignal ¶ added in v1.10.0
ShutdownSignal returns a signal that receives a message when the app needs to shut down
Types ¶
type ComponentAuthorizer ¶ added in v1.9.0
type ComponentAuthorizer func(component componentsV1alpha1.Component) bool
Type of function that determines if a component is authorized. The function receives the component and must return true if the component is authorized.
type ComponentCategory ¶ added in v0.11.0
type ComponentCategory string
type ComponentRegistry ¶ added in v1.5.0
type ComponentRegistry struct { Actors actors.Actors DirectMessaging messaging.DirectMessaging CompStore *compstore.ComponentStore }
type ComponentsCallback ¶ added in v1.5.0
type ComponentsCallback func(components ComponentRegistry) error
type Config ¶
type Config struct { ID string HTTPPort int PublicPort *int ProfilePort int EnableProfiling bool APIGRPCPort int InternalGRPCPort int ApplicationPort int APIListenAddresses []string ApplicationProtocol Protocol Mode modes.DaprMode PlacementAddresses []string AllowedOrigins string Standalone config.StandaloneConfig Kubernetes config.KubernetesConfig MaxConcurrency int SentryServiceAddress string CertChain *credentials.CertChain MaxRequestBodySize int UnixDomainSocket string ReadBufferSize int GracefulShutdownDuration time.Duration EnableAPILogging bool DisableBuiltinK8sSecretStore bool AppHealthCheck *apphealth.Config AppHealthCheckHTTPPath string AppChannelAddress string // contains filtered or unexported fields }
Config holds the Dapr Runtime configuration.
func NewRuntimeConfig ¶
func NewRuntimeConfig(opts NewRuntimeConfigOpts) *Config
NewRuntimeConfig returns a new runtime config.
type DaprRuntime ¶
type DaprRuntime struct {
// contains filtered or unexported fields
}
DaprRuntime holds all the core components of the runtime.
func FromFlags ¶ added in v0.4.0
func FromFlags() (*DaprRuntime, error)
FromFlags parses command flags and returns DaprRuntime instance.
func NewDaprRuntime ¶
func NewDaprRuntime(runtimeConfig *Config, globalConfig *config.Configuration, accessControlList *config.AccessControlList, resiliencyProvider resiliency.Provider) *DaprRuntime
NewDaprRuntime returns a new runtime with the given runtime config and global config.
func (*DaprRuntime) ApplyBulkSubscribeResiliency ¶ added in v1.10.0
func (a *DaprRuntime) ApplyBulkSubscribeResiliency(ctx context.Context, bulkSubCallData *bulkSubscribeCallData, psm pubsubBulkSubscribedMessage, deadLetterTopic string, path string, policyDef *resiliency.PolicyDefinition, rawPayload bool, envelope map[string]interface{}, ) (*[]pubsub.BulkSubscribeResponseEntry, error)
ApplyBulkSubscribeResiliency applies resiliency support to bulk subscribe. It tries to filter out the messages that have been successfully processed and only retries the ones that have failed
func (*DaprRuntime) BulkPublish ¶ added in v1.10.0
func (a *DaprRuntime) BulkPublish(req *pubsub.BulkPublishRequest) (pubsub.BulkPublishResponse, error)
func (*DaprRuntime) GetPubSub ¶ added in v1.0.0
func (a *DaprRuntime) GetPubSub(pubsubName string) pubsub.PubSub
GetPubSub is an adapter method to find a pubsub by name.
func (*DaprRuntime) Publish ¶ added in v0.6.0
func (a *DaprRuntime) Publish(req *pubsub.PublishRequest) error
Publish is an adapter method for the runtime to pre-validate publish requests And then forward them to the Pub/Sub component. This method is used by the HTTP and gRPC APIs.
func (*DaprRuntime) Run ¶
func (a *DaprRuntime) Run(opts ...Option) error
Run performs initialization of the runtime with the runtime and global configurations.
func (*DaprRuntime) SetRunning ¶ added in v1.10.0
func (a *DaprRuntime) SetRunning(val bool)
SetRunning updates the value of the running flag. This method is used by tests in dapr/components-contrib.
func (*DaprRuntime) Shutdown ¶ added in v1.5.0
func (a *DaprRuntime) Shutdown(duration time.Duration)
func (*DaprRuntime) ShutdownWithWait ¶ added in v1.1.0
func (a *DaprRuntime) ShutdownWithWait()
ShutdownWithWait will gracefully stop runtime and wait outstanding operations.
func (*DaprRuntime) Subscribe ¶ added in v1.9.0
func (a *DaprRuntime) Subscribe(ctx context.Context, name string, routes map[string]compstore.TopicRouteElem) (err error)
Subscribe is used by APIs to start a subscription to a topic.
func (*DaprRuntime) WaitUntilShutdown ¶ added in v1.5.0
func (a *DaprRuntime) WaitUntilShutdown() error
WaitUntilShutdown waits until the Shutdown() method is done. This method is used by tests in dapr/components-contrib.
type HTTPEndpointAuthorizer ¶ added in v1.11.0
type HTTPEndpointAuthorizer func(endpoint httpEndpointV1alpha1.HTTPEndpoint) bool
Type of function that determines if an http endpoint is authorized. The function receives the http endpoint and must return true if the http endpoint is authorized.
type InitError ¶ added in v1.9.0
type InitError struct {
// contains filtered or unexported fields
}
func NewInitError ¶ added in v1.9.0
func NewInitError(kind InitErrorKind, entity string, err error) *InitError
NewInitError returns an InitError wrapping an existing context error.
type InitErrorKind ¶ added in v1.9.0
type InitErrorKind string
const ( InitFailure InitErrorKind = "INIT_FAILURE" InitComponentFailure InitErrorKind = "INIT_COMPONENT_FAILURE" CreateComponentFailure InitErrorKind = "CREATE_COMPONENT_FAILURE" )
type NewRuntimeConfigOpts ¶ added in v1.9.0
type NewRuntimeConfigOpts struct { ID string PlacementAddresses []string ControlPlaneAddress string AllowedOrigins string ResourcesPath []string AppProtocol string Mode string HTTPPort int InternalGRPCPort int APIGRPCPort int APIListenAddresses []string PublicPort *int AppPort int ProfilePort int EnableProfiling bool MaxConcurrency int MTLSEnabled bool SentryAddress string MaxRequestBodySize int UnixDomainSocket string ReadBufferSize int GracefulShutdownDuration time.Duration EnableAPILogging bool DisableBuiltinK8sSecretStore bool EnableAppHealthCheck bool AppHealthCheckPath string AppHealthProbeInterval time.Duration AppHealthProbeTimeout time.Duration AppHealthThreshold int32 AppChannelAddress string }
NewRuntimeConfigOpts contains options for NewRuntimeConfig.
type Option ¶ added in v0.4.0
type Option func(o *runtimeOpts)
Option is a function that customizes the runtime.
func WithBindings ¶ added in v1.9.0
func WithBindings(registry *bindingsLoader.Registry) Option
WithBindings adds binding components to the runtime.
func WithComponentsCallback ¶ added in v1.5.0
func WithComponentsCallback(componentsCallback ComponentsCallback) Option
WithComponentsCallback sets the components callback for applications that embed Dapr.
func WithConfigurations ¶ added in v1.5.0
func WithConfigurations(registry *configurationLoader.Registry) Option
WithConfigurations adds configuration store components to the runtime.
func WithCryptoProviders ¶ added in v1.11.0
func WithCryptoProviders(registry *cryptoLoader.Registry) Option
WithCryptoProviders adds crypto provider components to the runtime.
func WithHTTPMiddlewares ¶ added in v1.9.0
func WithHTTPMiddlewares(registry *httpMiddlewareLoader.Registry) Option
WithHTTPMiddlewares adds HTTP middleware components to the runtime.
func WithLocks ¶ added in v1.8.0
func WithLocks(registry *lockLoader.Registry) Option
WithLocks add lock store components to the runtime.
func WithNameResolutions ¶ added in v0.9.0
WithNameResolutions adds name resolution components to the runtime.
func WithPubSubs ¶ added in v0.4.0
func WithPubSubs(registry *pubsubLoader.Registry) Option
WithPubSubs adds pubsub store components to the runtime.
func WithSecretStores ¶ added in v0.4.0
func WithSecretStores(registry *secretstoresLoader.Registry) Option
WithSecretStores adds secret store components to the runtime.
func WithStates ¶ added in v0.4.0
func WithStates(registry *stateLoader.Registry) Option
WithStates adds state store components to the runtime.
func WithWorkflowComponents ¶ added in v1.10.0
func WithWorkflowComponents(registry *workflowsLoader.Registry) Option
WithWorkflowComponents adds workflow components to the runtime.
type RetriableError ¶ added in v1.11.0
type RetriableError struct {
// contains filtered or unexported fields
}
func NewRetriableError ¶ added in v1.11.0
func NewRetriableError(err error) *RetriableError
NewRetriableError returns a RetriableError wrapping an existing context error.
func (*RetriableError) Error ¶ added in v1.11.0
func (e *RetriableError) Error() string
func (*RetriableError) Unwrap ¶ added in v1.11.0
func (e *RetriableError) Unwrap() error