Documentation ¶
Index ¶
- func GetDialAddressPrefix(mode modes.DaprMode) string
- type API
- type APIOpts
- type AppChannelConfig
- type ConnCreatorFn
- type ConnectionPool
- func (p *ConnectionPool) Destroy(conn grpc.ClientConnInterface)
- func (p *ConnectionPool) DestroyAll()
- func (p *ConnectionPool) Get(createFn func() (grpc.ClientConnInterface, error)) (conn grpc.ClientConnInterface, err error)
- func (p *ConnectionPool) Purge()
- func (p *ConnectionPool) Register(conn grpc.ClientConnInterface)
- func (p *ConnectionPool) Release(conn grpc.ClientConnInterface)
- func (p *ConnectionPool) Share() grpc.ClientConnInterface
- type Manager
- func (g *Manager) CloseAppClient()
- func (g *Manager) GetAppChannel() (channel.AppChannel, error)
- func (g *Manager) GetAppClient() (grpc.ClientConnInterface, error)
- func (g *Manager) GetGRPCConnection(parentCtx context.Context, address string, id string, namespace string, ...) (conn *grpc.ClientConn, teardown func(destroy bool), err error)
- func (g *Manager) ReleaseAppClient(conn grpc.ClientConnInterface)
- func (g *Manager) SetAuthenticator(auth security.Authenticator)
- func (g *Manager) SetLocalConnCreateFn(fn ConnCreatorFn)
- func (g *Manager) StartCollector()
- type RemoteConnectionPool
- func (p *RemoteConnectionPool) Destroy(address string, conn grpc.ClientConnInterface)
- func (p *RemoteConnectionPool) Get(address string, createFn func() (grpc.ClientConnInterface, error)) (conn grpc.ClientConnInterface, err error)
- func (p *RemoteConnectionPool) Purge()
- func (p *RemoteConnectionPool) Register(address string, conn grpc.ClientConnInterface)
- func (p *RemoteConnectionPool) Release(address string, conn grpc.ClientConnInterface)
- func (p *RemoteConnectionPool) Share(address string) grpc.ClientConnInterface
- type Server
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDialAddressPrefix ¶ added in v0.7.0
GetDialAddressPrefix returns a dial prefix for a gRPC client connections for a given DaprMode. This is used on non-Windows hosts.
Types ¶
type API ¶
type API interface { // DaprInternal Service methods internalv1pb.ServiceInvocationServer // Dapr Service methods runtimev1pb.DaprServer // Methods internal to the object SetAppChannel(appChannel channel.AppChannel) SetDirectMessaging(directMessaging messaging.DirectMessaging) SetActorRuntime(actor actors.Actors) }
API is the gRPC interface for the Dapr gRPC API. It implements both the internal and external proto definitions.
type APIOpts ¶ added in v1.10.0
type APIOpts struct { AppID string AppChannel channel.AppChannel Resiliency resiliency.Provider CompStore *compstore.ComponentStore PubsubAdapter runtimePubsub.Adapter DirectMessaging messaging.DirectMessaging Actor actors.Actors SendToOutputBindingFn func(name string, req *bindings.InvokeRequest) (*bindings.InvokeResponse, error) TracingSpec config.TracingSpec AccessControlList *config.AccessControlList AppProtocolIsHTTP bool Shutdown func() GetComponentsCapabilitiesFn func() map[string][]string }
APIOpts contains options for NewAPI.
type AppChannelConfig ¶ added in v1.10.0
type AppChannelConfig struct { Port int MaxConcurrency int TracingSpec config.TracingSpec EnableTLS bool MaxRequestBodySizeMB int ReadBufferSizeKB int AllowInsecureTLS bool BaseAddress string }
AppChannelConfig contains the configuration for the app channel.
type ConnCreatorFn ¶ added in v1.10.0
type ConnCreatorFn = func() (grpc.ClientConnInterface, error)
ConnCreatorFn is a function that returns a gRPC connection
type ConnectionPool ¶ added in v1.10.0
type ConnectionPool struct {
// contains filtered or unexported fields
}
ConnectionPool holds a pool of connections to the same address.
func NewConnectionPool ¶ added in v1.10.0
func NewConnectionPool(maxConnIdle time.Duration, minActiveConns int) *ConnectionPool
NewConnectionPool creates a new ConnectionPool object.
func (*ConnectionPool) Destroy ¶ added in v1.10.0
func (p *ConnectionPool) Destroy(conn grpc.ClientConnInterface)
Destroy a connection, forcibly removing it from the pool
func (*ConnectionPool) DestroyAll ¶ added in v1.10.0
func (p *ConnectionPool) DestroyAll()
DestroyAll closes all connections in the poll.
func (*ConnectionPool) Get ¶ added in v1.10.0
func (p *ConnectionPool) Get(createFn func() (grpc.ClientConnInterface, error)) (conn grpc.ClientConnInterface, err error)
Get takes a connection from the pool or, if no connection exists, creates a new one using createFn, then stores it and returns it.
func (*ConnectionPool) Purge ¶ added in v1.10.0
func (p *ConnectionPool) Purge()
Purge connections that have been idle for longer than maxConnIdle. Note that this method should not be called by multiple goroutines at the same time.
func (*ConnectionPool) Register ¶ added in v1.10.0
func (p *ConnectionPool) Register(conn grpc.ClientConnInterface)
Register a new connection.
func (*ConnectionPool) Release ¶ added in v1.10.0
func (p *ConnectionPool) Release(conn grpc.ClientConnInterface)
Release is called when the method has finished using the connection. This decrements the reference counter for the connection.
func (*ConnectionPool) Share ¶ added in v1.10.0
func (p *ConnectionPool) Share() grpc.ClientConnInterface
Share takes a connection from the pool and increments its reference count. The result can be nil if no available connection can be found.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a wrapper around gRPC connection pooling.
func NewGRPCManager ¶
func NewGRPCManager(mode modes.DaprMode, channelConfig *AppChannelConfig) *Manager
NewGRPCManager returns a new grpc manager.
func (*Manager) CloseAppClient ¶ added in v1.10.0
func (g *Manager) CloseAppClient()
CloseAppClient closes the active app client connections.
func (*Manager) GetAppChannel ¶ added in v1.10.0
func (g *Manager) GetAppChannel() (channel.AppChannel, error)
GetAppChannel returns a connection to the local channel. If there's no active connection to the app, it creates one.
func (*Manager) GetAppClient ¶ added in v1.10.0
func (g *Manager) GetAppClient() (grpc.ClientConnInterface, error)
GetAppClient returns the gRPC connection to the local app. If there's no active connection to the app, it creates one.
func (*Manager) GetGRPCConnection ¶
func (g *Manager) GetGRPCConnection( parentCtx context.Context, address string, id string, namespace string, customOpts ...grpc.DialOption, ) (conn *grpc.ClientConn, teardown func(destroy bool), err error)
GetGRPCConnection returns a new grpc connection for a given address and inits one if doesn't exist.
func (*Manager) ReleaseAppClient ¶ added in v1.11.0
func (g *Manager) ReleaseAppClient(conn grpc.ClientConnInterface)
ReleaseAppClient decreases the reference counter of a gRPC connection in the connection pool.
func (*Manager) SetAuthenticator ¶ added in v0.4.0
func (g *Manager) SetAuthenticator(auth security.Authenticator)
SetAuthenticator sets the gRPC manager a tls authenticator context.
func (*Manager) SetLocalConnCreateFn ¶ added in v1.10.0
func (g *Manager) SetLocalConnCreateFn(fn ConnCreatorFn)
SetLocalConnCreateFn sets the function used to create local connections. It also destroys all existing local channel connections. Set fn to nil to reset to the built-in function.
func (*Manager) StartCollector ¶ added in v1.10.0
func (g *Manager) StartCollector()
StartCollector starts a background goroutine that periodically watches for expired connections and purges them.
type RemoteConnectionPool ¶ added in v1.10.0
type RemoteConnectionPool struct {
// contains filtered or unexported fields
}
RemoteConnectionPool is used to hold connections to remote addresses.
func NewRemoteConnectionPool ¶ added in v1.10.0
func NewRemoteConnectionPool() *RemoteConnectionPool
NewRemoteConnectionPool creates a new RemoteConnectionPool object.
func (*RemoteConnectionPool) Destroy ¶ added in v1.10.0
func (p *RemoteConnectionPool) Destroy(address string, conn grpc.ClientConnInterface)
Destroy a connection, forcibly removing ti from the pool
func (*RemoteConnectionPool) Get ¶ added in v1.10.0
func (p *RemoteConnectionPool) Get(address string, createFn func() (grpc.ClientConnInterface, error)) (conn grpc.ClientConnInterface, err error)
Get takes a connection from the pool or, if no connection exists, creates a new one using createFn, then stores it and returns it.
func (*RemoteConnectionPool) Purge ¶ added in v1.10.0
func (p *RemoteConnectionPool) Purge()
Purge connections that have been idle for longer than maxConnIdle. Note that this method should not be called by multiple goroutines at the same time.
func (*RemoteConnectionPool) Register ¶ added in v1.10.0
func (p *RemoteConnectionPool) Register(address string, conn grpc.ClientConnInterface)
Register a new connection.
func (*RemoteConnectionPool) Release ¶ added in v1.10.0
func (p *RemoteConnectionPool) Release(address string, conn grpc.ClientConnInterface)
Release is called when the method has finished using the connection. This decrements the reference counter for the connection.
func (*RemoteConnectionPool) Share ¶ added in v1.10.0
func (p *RemoteConnectionPool) Share(address string) grpc.ClientConnInterface
Share takes a connection from the pool and increments its reference count. The result can be nil if no available connection can be found.
type Server ¶
Server is an interface for the dapr gRPC server.
func NewAPIServer ¶ added in v0.6.0
func NewAPIServer(api API, config ServerConfig, tracingSpec config.TracingSpec, metricSpec config.MetricSpec, apiSpec config.APISpec, proxy messaging.Proxy, workflowEngine *wfengine.WorkflowEngine) Server
NewAPIServer returns a new user facing gRPC API server.
func NewInternalServer ¶ added in v0.6.0
func NewInternalServer(api API, config ServerConfig, tracingSpec config.TracingSpec, metricSpec config.MetricSpec, authenticator auth.Authenticator, proxy messaging.Proxy) Server
NewInternalServer returns a new gRPC server for Dapr to Dapr communications.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package universalapi contains the implementation of APIs that are shared between gRPC and HTTP servers.
|
Package universalapi contains the implementation of APIs that are shared between gRPC and HTTP servers. |