rpc

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The default address for internal messaging to this DVID server
	DefaultAddress = "localhost:8002"
)

Variables

View Source
var (
	ErrNoServerRunning     = errors.New("no servers are running")
	ErrServerNotFound      = errors.New("server not found")
	ErrClientUninitialized = errors.New("client not initialized")
	ErrBadSession          = errors.New("bad session id; not found on server")
)

Functions

func Dispatcher

func Dispatcher() *gorpc.Dispatcher

func RegisterSessionMaker

func RegisterSessionMaker(id MessageID, f NewSessionHandlerFunc)

RegisterSessionMaker allows any package to register a function to create a new session handler given a designated message type.

func Shutdown

func Shutdown()

Shutdown halts all RPC servers.

func StartServer

func StartServer(address string) error

StartServer starts an RPC server.

func StopServer

func StopServer(address string) error

StopServer halts the given server.

Types

type Caller

type Caller func(string, interface{}) (interface{}, error)

Caller is a function that meets the rpc Call signature.

type MessageHandler

type MessageHandler func(interface{}) (interface{}, error)

type MessageID

type MessageID string

MessageID should be a unique string across the DVID code base. By convention, the package name should be prefixed to the type of session being performed, e.g., "datastore.Push"

type NewSessionHandlerFunc

type NewSessionHandlerFunc func(MessageID) (SessionHandler, error)

NewSessionHandlerFunc is a function that creates new session handlers

type Session

type Session struct {
	sync.WaitGroup
	// contains filtered or unexported fields
}

Session provides ability to send data to remote DVID using multiple RPCs.

func NewSession

func NewSession(addr string, mid MessageID) (Session, error)

NewSession returns a new session to the remote address where the type of session is reflected by the MessageID.

func (*Session) Call

func (s *Session) Call() Caller

func (*Session) Close

func (s *Session) Close() error

func (*Session) ID

func (s *Session) ID() SessionID

func (*Session) StartJob

func (s *Session) StartJob()

StartJob marks the start of a sequence of calls that may be handled concurrently. A session will wait for StopJob() before allowing proceeding with any closing of the session.

func (*Session) StopJob

func (s *Session) StopJob()

type SessionHandler

type SessionHandler interface {
	ID() SessionID
	Open(SessionID) error
	Close() error
}

SessionHandler has a state, processes incoming messages via a finite state machine, and knows how to terminate itself upon receiving a termination message, calling the rpc package EndSession.

func GetSessionHandler

func GetSessionHandler(sid SessionID) (SessionHandler, error)

type SessionID

type SessionID uint64

SessionID uniquely identifies a rpc session.

type Transmit

type Transmit uint8

Transmit describes how data is being transferred from DVID-to-DVID.

const (
	TransmitUnknown Transmit = iota
	TransmitAll              // send all versions to maintain the full DAG
	TransmitBranch           // send versions in ancestor path that are not in local DAG
	TransmitFlatten          // send just the version required and do required copy from earlier versions
)

Jump to

Keyboard shortcuts

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