drpcmanager
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
package drpcmanager
import "storj.io/drpc/drpcmanager"
Package drpcmanager reads packets from a transport to make streams.
Usage
type Manager
type Manager struct {}Manager handles the logic of managing a transport for a drpc client or server.It ensures that the connection is always being read from, that it is closed inthe case that the manager is and forwarding drpc protocol messages to theappropriate stream.
func New
func New(tr drpc.Transport) *ManagerNew returns a new Manager for the transport.
func NewWithOptions
func NewWithOptions(tr drpc.Transport, opts Options) *ManagerNewWithOptions returns a new manager for the transport. It uses the providedoptions to manage details of how it uses it.
func (*Manager) Close
func (m *Manager) Close() errorClose closes the transport the manager is using.
func (*Manager) Closed
func (m *Manager) Closed() <-chan struct{}Closed returns a channel that is closed once the manager is closed.
func (*Manager) NewClientStream
func (m *Manager) NewClientStream(ctx context.Context, rpc string) (stream *drpcstream.Stream, err error)NewClientStream starts a stream on the managed transport for use by a client.
func (*Manager) NewServerStream
func (m *Manager) NewServerStream(ctx context.Context) (stream *drpcstream.Stream, rpc string, err error)NewServerStream starts a stream on the managed transport for use by a server. Itdoes this by waiting for the client to issue an invoke message and returning thedetails.
func (*Manager) String
func (m *Manager) String() stringString returns a string representation of the manager.
func (*Manager) Unblocked
func (m *Manager) Unblocked() <-chan struct{}Unblocked returns a channel that is closed when the manager is no longer blockedfrom creating a new stream due to a previous stream's soft cancel. It should notbe called concurrently with NewClientStream or NewServerStream and the returnresult is only valid until the next call to NewClientStream or NewServerStream.
type Options
type Options struct {// WriterBufferSize controls the size of the buffer that we will fill before// flushing. Normal writes to streams typically issue a flush explicitly.WriterBufferSize int// Reader are passed to any readers the manager creates.Reader drpcwire.ReaderOptions// Stream are passed to any streams the manager creates.Stream drpcstream.Options// SoftCancel controls if a context cancel will cause the transport to be// closed or, if true, a soft cancel message will be attempted if possible.// A soft cancel can reduce the amount of closed and dialed connections at// the potential cost of higher latencies if there is latent data still being// flushed when the cancel happens.SoftCancel bool// InactivityTimeout is the amount of time the manager will wait when creating// a NewServerStream. It only includes the time it is reading packets from the// remote client. In other words, it only includes the time that the client// could delay before invoking an RPC. If zero or negative, no timeout is used.InactivityTimeout time.Duration// Internal contains options that are for internal use only.Internal drpcopts.Manager}Options controls configuration settings for a manager.
Documentation¶
Overview¶
Package drpcmanager reads packets from a transport to make streams.
Index¶
- type Manager
- func (m *Manager) Close() error
- func (m *Manager) Closed() <-chan struct{}
- func (m *Manager) NewClientStream(ctx context.Context, rpc string) (stream *drpcstream.Stream, err error)
- func (m *Manager) NewServerStream(ctx context.Context) (stream *drpcstream.Stream, rpc string, err error)
- func (m *Manager) String() string
- func (m *Manager) Unblocked() <-chan struct{}
- type Options
Constants¶
This section is empty.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeManager¶
type Manager struct {// contains filtered or unexported fields}Manager handles the logic of managing a transport for a drpc client or server.It ensures that the connection is always being read from, that it is closedin the case that the manager is and forwarding drpc protocol messages to theappropriate stream.
funcNewWithOptions¶added inv0.0.7
NewWithOptions returns a new manager for the transport. It uses the providedoptions to manage details of how it uses it.
func (*Manager)Closed¶added inv0.0.7
func (m *Manager) Closed() <-chan struct{}
Closed returns a channel that is closed once the manager is closed.
func (*Manager)NewClientStream¶added inv0.0.5
func (m *Manager) NewClientStream(ctxcontext.Context, rpcstring) (stream *drpcstream.Stream, errerror)
NewClientStream starts a stream on the managed transport for use by a client.
func (*Manager)NewServerStream¶added inv0.0.5
func (m *Manager) NewServerStream(ctxcontext.Context) (stream *drpcstream.Stream, rpcstring, errerror)
NewServerStream starts a stream on the managed transport for use by a server. It doesthis by waiting for the client to issue an invoke message and returning the details.
func (*Manager)Unblocked¶added inv0.0.33
func (m *Manager) Unblocked() <-chan struct{}
Unblocked returns a channel that is closed when the manager is no longer blockedfrom creating a new stream due to a previous stream's soft cancel. It should notbe called concurrently with NewClientStream or NewServerStream and the returnresult is only valid until the next call to NewClientStream or NewServerStream.
typeOptions¶added inv0.0.7
type Options struct {// WriterBufferSize controls the size of the buffer that we will fill before// flushing. Normal writes to streams typically issue a flush explicitly.WriterBufferSizeint// Reader are passed to any readers the manager creates.Readerdrpcwire.ReaderOptions// Stream are passed to any streams the manager creates.Streamdrpcstream.Options// SoftCancel controls if a context cancel will cause the transport to be// closed or, if true, a soft cancel message will be attempted if possible.// A soft cancel can reduce the amount of closed and dialed connections at// the potential cost of higher latencies if there is latent data still being// flushed when the cancel happens.SoftCancelbool// InactivityTimeout is the amount of time the manager will wait when creating// a NewServerStream. It only includes the time it is reading packets from the// remote client. In other words, it only includes the time that the client// could delay before invoking an RPC. If zero or negative, no timeout is used.InactivityTimeouttime.Duration// Internal contains options that are for internal use only.Internaldrpcopts.Manager}Options controls configuration settings for a manager.