drpcmanager

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 13 Imported by: 2

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 in the case that the manager is and forwarding drpc protocol messages to the appropriate stream.

func New
func New(tr drpc.Transport) *Manager

New returns a new Manager for the transport.

func NewWithOptions
func NewWithOptions(tr drpc.Transport, opts Options) *Manager

NewWithOptions returns a new manager for the transport. It uses the provided options to manage details of how it uses it.

func (*Manager) Close
func (m *Manager) Close() error

Close 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) (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. It does this by waiting for the client to issue an invoke message and returning the details.

func (*Manager) String
func (m *Manager) String() string

String returns a string representation of the manager.

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

	// Stream are passed to any streams the manager creates.
	Stream drpcstream.Options

	// 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
}

Options controls configuration settings for a manager.

Documentation

Overview

Package drpcmanager reads packets from a transport to make streams.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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 closed in the case that the manager is and forwarding drpc protocol messages to the appropriate stream.

func New

func New(tr drpc.Transport) *Manager

New returns a new Manager for the transport.

func NewWithOptions added in v0.0.7

func NewWithOptions(tr drpc.Transport, opts Options) *Manager

NewWithOptions returns a new manager for the transport. It uses the provided options to manage details of how it uses it.

func (*Manager) Close

func (m *Manager) Close() error

Close closes the transport the manager is using.

func (*Manager) Closed added in v0.0.7

func (m *Manager) Closed() <-chan struct{}

Closed returns a channel that is closed once the manager is closed.

func (*Manager) NewClientStream added in v0.0.5

func (m *Manager) NewClientStream(ctx context.Context) (stream *drpcstream.Stream, err error)

NewClientStream starts a stream on the managed transport for use by a client.

func (*Manager) NewServerStream added in v0.0.5

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. It does this by waiting for the client to issue an invoke message and returning the details.

func (*Manager) String added in v0.0.24

func (m *Manager) String() string

String returns a string representation of the manager.

type Options added in v0.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.
	WriterBufferSize int

	// Stream are passed to any streams the manager creates.
	Stream drpcstream.Options

	// 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
}

Options controls configuration settings for a manager.

Jump to

Keyboard shortcuts

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