dvid: github.com/janelia-flyem/dvid/rpc Index | Files

package rpc

import "github.com/janelia-flyem/dvid/rpc"

Index

Package Files

client.go server.go

Constants

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

Variables

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")
)

func Dispatcher Uses

func Dispatcher() *gorpc.Dispatcher

func RegisterSessionMaker Uses

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 Uses

func Shutdown()

Shutdown halts all RPC servers.

func StartServer Uses

func StartServer(address string) error

StartServer starts an RPC server.

func StopServer Uses

func StopServer(address string) error

StopServer halts the given server.

type Caller Uses

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

Caller is a function that meets the rpc Call signature.

type MessageHandler Uses

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

type MessageID Uses

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 Uses

type NewSessionHandlerFunc func(MessageID) (SessionHandler, error)

NewSessionHandlerFunc is a function that creates new session handlers

type Session Uses

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

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

func NewSession Uses

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 Uses

func (s *Session) Call() Caller

func (*Session) Close Uses

func (s *Session) Close() error

func (*Session) ID Uses

func (s *Session) ID() SessionID

func (*Session) StartJob Uses

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 Uses

func (s *Session) StopJob()

type SessionHandler Uses

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 Uses

func GetSessionHandler(sid SessionID) (SessionHandler, error)

type SessionID Uses

type SessionID uint64

SessionID uniquely identifies a rpc session.

type Transmit Uses

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
)

Package rpc imports 6 packages (graph) and is imported by 4 packages. Updated 2018-10-26. Refresh now. Tools for package owners.