Documentation ¶
Index ¶
- type Config
- func (*Config) Descriptor() ([]byte, []int)
- func (m *Config) GetDrpcOpts() *drpc.DrpcOpts
- func (m *Config) GetPeerIds() []string
- func (c *Config) ParsePeerIDs() ([]peer.ID, error)
- func (*Config) ProtoMessage()
- func (m *Config) Reset()
- func (m *Config) String() string
- func (c *Config) Validate() error
- func (m *Config) XXX_DiscardUnknown()
- func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Config) XXX_Merge(src proto.Message)
- func (m *Config) XXX_Size() int
- func (m *Config) XXX_Unmarshal(b []byte) error
- type RegisterFn
- type Server
- func (s *Server) Close() error
- func (s *Server) Execute(ctx context.Context) error
- func (s *Server) GetControllerInfo() controller.Info
- func (s *Server) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
- func (s *Server) HandleMountedStream(ctx context.Context, ms link.MountedStream) error
- func (s *Server) ResolveHandleMountedStream(ctx context.Context, di directive.Instance, dir link.HandleMountedStream) (directive.Resolver, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // PeerIds are the list of peer IDs to listen on. // If empty, allows any incoming peer id w/ the protocol id. PeerIds []string `protobuf:"bytes,1,rep,name=peer_ids,json=peerIds,proto3" json:"peer_ids,omitempty"` // DrpcOpts are options passed to drpc. DrpcOpts *drpc.DrpcOpts `protobuf:"bytes,2,opt,name=drpc_opts,json=drpcOpts,proto3" json:"drpc_opts,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Config configures the server for the drpc service.
func (*Config) Descriptor ¶
func (*Config) GetDrpcOpts ¶
func (*Config) GetPeerIds ¶
func (*Config) ParsePeerIDs ¶
ParsePeerIDs parses the peer ids field.
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) XXX_DiscardUnknown ¶
func (m *Config) XXX_DiscardUnknown()
func (*Config) XXX_Marshal ¶
func (*Config) XXX_Unmarshal ¶
type RegisterFn ¶
RegisterFn is a callback to register apis to a mux.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles incoming streams for a peer id.
func NewServer ¶
func NewServer( b bus.Bus, info controller.Info, opts *stream_drpc.DrpcOpts, protocolIDs []protocol.ID, peerIDs []string, registerFns []RegisterFn, ) (*Server, error)
NewServer constructs a common drpc controller. If peerIDs and/or domainIDs are empty, matches any.
func (*Server) Close ¶
Close releases any resources used by the controller. Error indicates any issue encountered releasing.
func (*Server) Execute ¶
Execute executes the given controller. Returning nil ends execution. Returning an error triggers a retry with backoff.
func (*Server) GetControllerInfo ¶
func (s *Server) GetControllerInfo() controller.Info
GetControllerInfo returns information about the controller.
func (*Server) HandleDirective ¶
func (s *Server) HandleDirective(ctx context.Context, di directive.Instance) (directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive. If it can, it returns a resolver. If not, returns nil.
func (*Server) HandleMountedStream ¶
HandleMountedStream handles an incoming mounted stream. Any returned error indicates the stream should be closed. This function should return as soon as possible, and start additional goroutines to manage the lifecycle of the stream. Typically EstablishLink is asserted in HandleMountedStream.