Skip to content

Latest commit

 

History

History

drpcserver

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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

	// Log is called when errors happen that can not be returned up, like
	// temporary network errors when accepting connections, or errors
	// handling individual clients. It is not called if nil.
	Log func(error)

	// CollectStats controls whether the server should collect stats on the
	// rpcs it serves.
	CollectStats bool
}

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(handler drpc.Handler) *Server

New constructs a new Server.

func NewWithOptions

func NewWithOptions(handler drpc.Handler, opts Options) *Server

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

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.

func (*Server) Stats

func (s *Server) Stats() map[string]drpcstats.Stats

Stats returns the collected stats grouped by rpc.