Documentation ¶
Index ¶
- Constants
- func NewHTTPClientHelper(s *HTTPService) *httpClientHelper
- type Barrier
- type ClientHelper
- type Config
- type Controller
- func (c *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
- func (c *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
- func (c *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
- func (c *Controller) Shutdown() error
- func (c *Controller) Start() error
- func (c *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- func (c *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
- type Dialer
- type FixedSizeBarrier
- func (b *FixedSizeBarrier) Acquire()
- func (b *FixedSizeBarrier) BusyCount() int
- func (b *FixedSizeBarrier) Capacity() int
- func (b *FixedSizeBarrier) CapacityInfo() string
- func (FixedSizeBarrier) Exhausted()
- func (FixedSizeBarrier) HasDynamicCapacity() (res bool)
- func (b *FixedSizeBarrier) Release()
- func (FixedSizeBarrier) Start()
- func (FixedSizeBarrier) Stop()
- type HTTPService
- func (s *HTTPService) Command(ctx context.Context, r *pb.CommandMessage) (*pb.CommandResponse, error)
- func (s *HTTPService) Connect(ctx context.Context, r *pb.ConnectionRequest) (*pb.ConnectionResponse, error)
- func (s *HTTPService) Disconnect(ctx context.Context, r *pb.DisconnectRequest) (*pb.DisconnectResponse, error)
Constants ¶
const ( // ProtoVersions contains a comma-seprated list of compatible RPC protos versions // (we pass it as request meta to notify clients) ProtoVersions = "v1" )
Variables ¶
This section is empty.
Functions ¶
func NewHTTPClientHelper ¶ added in v1.4.0
func NewHTTPClientHelper(s *HTTPService) *httpClientHelper
Types ¶
type ClientHelper ¶ added in v1.2.0
ClientHelper provides additional methods to operate gRPC client
type Config ¶ added in v1.0.1
type Config struct { // RPC instance host Host string `toml:"host"` // ProxyHeaders to add to RPC request env ProxyHeaders []string `toml:"proxy_headers"` // ProxyCookies to add to RPC request env ProxyCookies []string `toml:"proxy_cookies"` // The max number of simultaneous requests. // Should be slightly less than the RPC server concurrency to avoid // ResourceExhausted errors Concurrency int `toml:"concurrency"` // Enable client-side TLS on RPC connections? EnableTLS bool `toml:"enable_tls"` // Whether to verify the RPC server's certificate chain and host name TLSVerify bool `toml:"tls_verify"` // CA root TLS certificate path TLSRootCA string `toml:"tls_root_ca_path"` // Max receive msg size (bytes) MaxRecvSize int `toml:"max_recv_size"` // Max send msg size (bytes) MaxSendSize int `toml:"max_send_size"` // Underlying implementation (grpc, http, or none) Implementation string `toml:"implementation"` // Alternative dialer implementation DialFun Dialer // Secret for HTTP RPC authentication Secret string `toml:"secret"` // Timeout for HTTP RPC requests (in ms) RequestTimeout int `toml:"http_request_timeout"` // SecretBase is a secret used to generate authentication token SecretBase string }
Config contains RPC controller configuration
func (*Config) Impl ¶ added in v1.4.6
Return chosen implementation either from the user provided value or from the host scheme
func (*Config) TLSEnabled ¶ added in v1.4.1
Whether secure connection to RPC server is enabled either explicitly or implicitly
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller implements node.Controller interface for gRPC
func NewController ¶
func NewController(metrics metrics.Instrumenter, config *Config, l *slog.Logger) (*Controller, error)
NewController builds new Controller
func (*Controller) Authenticate ¶
func (c *Controller) Authenticate(sid string, env *common.SessionEnv) (*common.ConnectResult, error)
Authenticate performs Connect RPC call
func (*Controller) Disconnect ¶
func (c *Controller) Disconnect(sid string, env *common.SessionEnv, id string, subscriptions []string) error
Disconnect performs disconnect RPC call
func (*Controller) Perform ¶
func (c *Controller) Perform(sid string, env *common.SessionEnv, id string, channel string, data string) (*common.CommandResult, error)
Perform performs Command RPC call with "perform" command
func (*Controller) Subscribe ¶
func (c *Controller) Subscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Subscribe performs Command RPC call with "subscribe" command
func (*Controller) Unsubscribe ¶
func (c *Controller) Unsubscribe(sid string, env *common.SessionEnv, id string, channel string) (*common.CommandResult, error)
Unsubscribe performs Command RPC call with "unsubscribe" command
type Dialer ¶ added in v1.2.0
Dialer is factory function to build a new client with its helper
func NewHTTPDialer ¶ added in v1.4.0
func NewInprocessServiceDialer ¶ added in v1.4.0
func NewInprocessServiceDialer(service pb.RPCServer, stateHandler ClientHelper) Dialer
type FixedSizeBarrier ¶ added in v1.2.3
type FixedSizeBarrier struct {
// contains filtered or unexported fields
}
func NewFixedSizeBarrier ¶ added in v1.2.3
func NewFixedSizeBarrier(capacity int) (*FixedSizeBarrier, error)
func (*FixedSizeBarrier) Acquire ¶ added in v1.2.3
func (b *FixedSizeBarrier) Acquire()
func (*FixedSizeBarrier) BusyCount ¶ added in v1.2.3
func (b *FixedSizeBarrier) BusyCount() int
func (*FixedSizeBarrier) Capacity ¶ added in v1.2.3
func (b *FixedSizeBarrier) Capacity() int
func (*FixedSizeBarrier) CapacityInfo ¶ added in v1.2.3
func (b *FixedSizeBarrier) CapacityInfo() string
func (FixedSizeBarrier) Exhausted ¶ added in v1.2.3
func (FixedSizeBarrier) Exhausted()
func (FixedSizeBarrier) HasDynamicCapacity ¶ added in v1.3.0
func (FixedSizeBarrier) HasDynamicCapacity() (res bool)
func (*FixedSizeBarrier) Release ¶ added in v1.2.3
func (b *FixedSizeBarrier) Release()
func (FixedSizeBarrier) Start ¶ added in v1.3.0
func (FixedSizeBarrier) Start()
func (FixedSizeBarrier) Stop ¶ added in v1.3.0
func (FixedSizeBarrier) Stop()
type HTTPService ¶ added in v1.4.0
type HTTPService struct {
// contains filtered or unexported fields
}
func NewHTTPService ¶ added in v1.4.0
func NewHTTPService(c *Config) (*HTTPService, error)
func (*HTTPService) Command ¶ added in v1.4.0
func (s *HTTPService) Command(ctx context.Context, r *pb.CommandMessage) (*pb.CommandResponse, error)
func (*HTTPService) Connect ¶ added in v1.4.0
func (s *HTTPService) Connect(ctx context.Context, r *pb.ConnectionRequest) (*pb.ConnectionResponse, error)
func (*HTTPService) Disconnect ¶ added in v1.4.0
func (s *HTTPService) Disconnect(ctx context.Context, r *pb.DisconnectRequest) (*pb.DisconnectResponse, error)