options

package
v0.0.0-...-335d32b Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package options defines options that can be customized when creating a Peer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(v visitor, opts ...Option) error

Apply applies the default options, then a sequence of additional options to v.

Types

type Option

type Option func(v visitor) error

Option is a function that applies a configuration change.

func CommandWorkers

func CommandWorkers(n uint) Option

CommandWorkers returns an Option that specifies the number of incoming command REQUESTS that are accepted at any given time. A new goroutine is started to service each command request.

func DefaultTimeout

func DefaultTimeout(t time.Duration) Option

DefaultTimeout returns an Option that specifies the maximum amount of time to wait for a call to return. It is used if the context passed to Session.Call() does not already have a deadline.

func FromEnv

func FromEnv() ([]Option, error)

FromEnv returns peer options with values read from environment variables.

The environment variables are listed below.

- RINQ_DEFAULT_TIMEOUT (duration in milliseconds, non-zero) - RINQ_LOG_DEBUG (boolean 'true' or 'false') - RINQ_COMMAND_WORKERS (positive integer, non-zero) - RINQ_SESSION_WORKERS (positive integer, non-zero) - RINQ_PRUNE_INTERVAL (duration in milliseconds, non-zero) - RINQ_PRODUCT (string)

func Logger

func Logger(l twelf.Logger) Option

Logger returns an Option that specifies the target for all of the peer's logs.

func Product

func Product(p string) Option

Product returns an Option that specifies an application-defined string that identifies the application.

It is recommended that the product take the form "<product>/<version>" such as "my-app/1.3.0".

func PruneInterval

func PruneInterval(t time.Duration) Option

PruneInterval returns an Option that specifies how often the cache of remote session information is purged of unused data.

func SessionWorkers

func SessionWorkers(n uint) Option

SessionWorkers returns an Option that specifies the number of command RESPONSES or notifications that are buffered in memory at any given time.

func Tracer

func Tracer(t opentracing.Tracer) Option

Tracer returns an Option that specifies an OpenTracing tracer to use for tracking Rinq operations.

See http://opentracing.io for more information.

type Options

type Options struct {
	DefaultTimeout time.Duration
	Logger         twelf.Logger
	CommandWorkers uint
	SessionWorkers uint
	PruneInterval  time.Duration
	Product        string
	Tracer         opentracing.Tracer
}

Options is a structure representing a resolved set of options.

func NewOptions

func NewOptions(opts ...Option) (o Options, err error)

NewOptions returns a new Options object from the given options, with default values for any options that are not specified.

Jump to

Keyboard shortcuts

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