stream_drpc_server

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_github_com_aperturerobotics_bifrost_stream_drpc_server_server_proto protoreflect.FileDescriptor

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"`
	// contains filtered or unexported fields
}

Config configures the server for the drpc service.

func (*Config) CloneGenericVT added in v0.8.3

func (m *Config) CloneGenericVT() proto.Message

func (*Config) CloneVT added in v0.8.3

func (m *Config) CloneVT() *Config

func (*Config) Descriptor deprecated

func (*Config) Descriptor() ([]byte, []int)

Deprecated: Use Config.ProtoReflect.Descriptor instead.

func (*Config) EqualVT added in v0.3.0

func (this *Config) EqualVT(that *Config) bool

func (*Config) GetDrpcOpts

func (x *Config) GetDrpcOpts() *drpc.DrpcOpts

func (*Config) GetPeerIds

func (x *Config) GetPeerIds() []string

func (*Config) MarshalToSizedBufferVT added in v0.2.0

func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Config) MarshalToVT added in v0.2.0

func (m *Config) MarshalToVT(dAtA []byte) (int, error)

func (*Config) MarshalVT added in v0.2.0

func (m *Config) MarshalVT() (dAtA []byte, err error)

func (*Config) ParsePeerIDs

func (c *Config) ParsePeerIDs() ([]peer.ID, error)

ParsePeerIDs parses the peer ids field.

func (*Config) ProtoMessage

func (*Config) ProtoMessage()

func (*Config) ProtoReflect added in v0.2.0

func (x *Config) ProtoReflect() protoreflect.Message

func (*Config) Reset

func (x *Config) Reset()

func (*Config) SizeVT added in v0.2.0

func (m *Config) SizeVT() (n int)

func (*Config) String

func (x *Config) String() string

func (*Config) UnmarshalVT added in v0.2.0

func (m *Config) UnmarshalVT(dAtA []byte) error

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the config.

type RegisterFn

type RegisterFn func(mux drpc.Mux) error

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

func (s *Server) Close() error

Close releases any resources used by the controller. Error indicates any issue encountered releasing.

func (*Server) Execute

func (s *Server) Execute(ctx context.Context) error

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

func (s *Server) HandleMountedStream(ctx context.Context, ms link.MountedStream) error

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.

func (*Server) ResolveHandleMountedStream

func (s *Server) ResolveHandleMountedStream(
	ctx context.Context,
	di directive.Instance,
	dir link.HandleMountedStream,
) ([]directive.Resolver, error)

ResolveHandleMountedStream resolves a HandleMountedStream directive.

Jump to

Keyboard shortcuts

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