runtime

package
v1.10.9-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 100 Imported by: 10

Documentation

Index

Constants

View Source
const (
	// GRPCProtocol is a gRPC communication protocol.
	GRPCProtocol Protocol = "grpc"
	// HTTPProtocol is a HTTP communication protocol.
	HTTPProtocol Protocol = "http"
	// 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 = "/health"
)

Variables

View Source
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

func ShutdownSignal() chan os.Signal

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
	StateStores     map[string]state.Store
	InputBindings   map[string]bindings.InputBinding
	OutputBindings  map[string]bindings.OutputBinding
	SecretStores    map[string]secretstores.SecretStore
	PubSubs         map[string]pubsub.PubSub
	Workflows       map[string]wfs.Workflow
}

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
	GlobalConfig        string
	AllowedOrigins      string
	Standalone          config.StandaloneConfig
	Kubernetes          config.KubernetesConfig
	MaxConcurrency      int

	SentryServiceAddress         string
	CertChain                    *credentials.CertChain
	AppSSL                       bool
	MaxRequestBodySize           int
	UnixDomainSocket             string
	ReadBufferSize               int
	GracefulShutdownDuration     time.Duration
	EnableAPILogging             bool
	DisableBuiltinK8sSecretStore bool
	AppHealthCheck               *apphealth.Config
	AppHealthCheckHTTPPath       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 (*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]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 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.

func (*InitError) Error added in v1.9.0

func (e *InitError) Error() string

func (*InitError) Unwrap added in v1.10.0

func (e *InitError) Unwrap() 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

	AllowedOrigins               string
	GlobalConfig                 string
	ComponentsPath               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
	AppSSL                       bool
	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
	// contains filtered or unexported fields
}

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

func WithNameResolutions(registry *nrLoader.Registry) Option

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 Protocol

type Protocol string

Protocol is a communications protocol.

type TopicRouteElem added in v1.9.0

type TopicRouteElem struct {
	// contains filtered or unexported fields
}

type TopicRoutes added in v1.9.0

type TopicRoutes map[string]TopicRouteElem

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL