drpcserver

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 12 Imported by: 35

README

package drpcserver

import "storj.io/drpc/drpcserver"

Package drpcserver allows one to execute registered rpcs.

Usage

type Options
type Options struct {
	// Manager controls the options we pass to the managers this server creates.
	Manager drpcmanager.Options
}

Options controls configuration settings for a server.

type Server
type Server struct {
}

Server is an implementation of drpc.Server to serve drpc connections.

func New
func New() *Server

New constructs a new Server.

func NewWithOptions
func NewWithOptions(opts Options) *Server

NewWithOptions constructs a new Server using the provided options to tune how the drpc connections are handled.

func (*Server) HandleRPC
func (s *Server) HandleRPC(stream *drpcstream.Stream, rpc string) (err error)

HandleRPC handles the rpc that has been requested by the stream.

func (*Server) Register
func (s *Server) Register(srv interface{}, desc drpc.Description)

Register associates the rpcs described by the description in the server. It will panic if there are problems with the registration.

func (*Server) Serve
func (s *Server) Serve(ctx context.Context, lis net.Listener) (err error)

Serve listens for connections on the listener and serves the drpc request on new connections.

func (*Server) ServeOne
func (s *Server) ServeOne(ctx context.Context, tr drpc.Transport) (err error)

ServeOne serves a single set of rpcs on the provided transport.

Documentation

Overview

Package drpcserver allows one to execute registered rpcs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options added in v0.0.7

type Options struct {
	// Manager controls the options we pass to the managers this server creates.
	Manager drpcmanager.Options
}

Options controls configuration settings for a server.

type Server

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

Server is an implementation of drpc.Server to serve drpc connections.

func New

func New() *Server

New constructs a new Server.

func NewWithOptions added in v0.0.7

func NewWithOptions(opts Options) *Server

NewWithOptions constructs a new Server using the provided options to tune how the drpc connections are handled.

func (*Server) HandleRPC

func (s *Server) HandleRPC(stream *drpcstream.Stream, rpc string) (err error)

HandleRPC handles the rpc that has been requested by the stream.

func (*Server) Register

func (s *Server) Register(srv interface{}, desc drpc.Description)

Register associates the rpcs described by the description in the server. It will panic if there are problems with the registration.

func (*Server) Serve

func (s *Server) Serve(ctx context.Context, lis net.Listener) (err error)

Serve listens for connections on the listener and serves the drpc request on new connections.

func (*Server) ServeOne

func (s *Server) ServeOne(ctx context.Context, tr drpc.Transport) (err error)

ServeOne serves a single set of rpcs on the provided transport.

Jump to

Keyboard shortcuts

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