drpc

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 3 Imported by: 104

README

package drpc

import "storj.io/drpc"

drpc is a light replacement for gprc.

Usage

var (
	Error         = errs.Class("drpc")
	InternalError = errs.Class("internal error")
	ProtocolError = errs.Class("protocol error")
)
type Conn
type Conn interface {
	Close() error
	Transport() Transport

	Invoke(ctx context.Context, rpc string, in, out Message) error
	NewStream(ctx context.Context, rpc string) (Stream, error)
}
type Description
type Description interface {
	NumMethods() int
	Method(n int) (rpc string, handler Handler, method interface{}, ok bool)
}
type Handler
type Handler = func(srv interface{}, ctx context.Context, in1, in2 interface{}) (out Message, err error)
type Message
type Message interface {
	Reset()
	String() string
	ProtoMessage()
}
type Server
type Server interface {
	Register(srv interface{}, desc Description)
}
type Stream
type Stream interface {
	Context() context.Context

	MsgSend(msg Message) error
	MsgRecv(msg Message) error

	CloseSend() error
	Close() error
}
type Transport
type Transport interface {
	io.Reader
	io.Writer
	io.Closer
}

Documentation

Overview

drpc is a light replacement for gprc.

Index

Constants

This section is empty.

Variables

View Source
var (
	Error         = errs.Class("drpc")
	InternalError = errs.Class("internal error")
	ProtocolError = errs.Class("protocol error")
)

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Close() error
	Transport() Transport

	Invoke(ctx context.Context, rpc string, in, out Message) error
	NewStream(ctx context.Context, rpc string) (Stream, error)
}

type Description

type Description interface {
	NumMethods() int
	Method(n int) (rpc string, handler Handler, method interface{}, ok bool)
}

type Handler

type Handler = func(srv interface{}, ctx context.Context, in1, in2 interface{}) (out Message, err error)

type Message

type Message interface {
	Reset()
	String() string
	ProtoMessage()
}

type Server added in v0.0.3

type Server interface {
	Register(srv interface{}, desc Description)
}

type Stream

type Stream interface {
	Context() context.Context

	MsgSend(msg Message) error
	MsgRecv(msg Message) error

	CloseSend() error
	Close() error
}

type Transport

type Transport interface {
	io.Reader
	io.Writer
	io.Closer
}

Directories

Path Synopsis
cmd
package drpcconn creates a drpc client connection from a transport.
package drpcconn creates a drpc client connection from a transport.
package drpcctx has helpers to interact with context.Context.
package drpcctx has helpers to interact with context.Context.
package drpcdebug provides helpers for debugging.
package drpcdebug provides helpers for debugging.
package drpcerr lets one associate error codes with errors.
package drpcerr lets one associate error codes with errors.
package drpcmanager reads packets from a transport to make streams.
package drpcmanager reads packets from a transport to make streams.
package drpcserver allows one to execute registered rpcs.
package drpcserver allows one to execute registered rpcs.
package drpcsignal holds a helper type to signal errors.
package drpcsignal holds a helper type to signal errors.
package drpcstream sends protobufs using the dprc wire protocol.
package drpcstream sends protobufs using the dprc wire protocol.
package drpcwire provides low level helpers for the drpc wire protocol.
package drpcwire provides low level helpers for the drpc wire protocol.
examples
drpc Module
drpc_and_http Module
grpc Module
grpc_and_drpc Module
opentelemetry Module
internal
integration
package integration holds integration tests for drpc.
package integration holds integration tests for drpc.
backcompat Module
grpccompat Module
twirpcompat Module

Jump to

Keyboard shortcuts

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