connection

package
v0.0.0-...-cd31975 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package connection provides functionality to establish the connection between the client and the server. It is an internal package to be used only by the Doorman system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Stub pb.CapacityClient

	Opts *Options
	// contains filtered or unexported fields
}

Connection contains information about connection between the server and the client.

func New

func New(addr string, options ...Option) (*Connection, error)

New creates a new Connection with the given server address.

func (*Connection) Close

func (connection *Connection) Close()

Close closes the connection of the client to the server.

func (*Connection) ExecuteRPC

func (connection *Connection) ExecuteRPC(callback func() (HasMastership, error)) (interface{}, error)

ExecuteRPC executes an RPC against the current master.

func (*Connection) String

func (connection *Connection) String() string

type HasMastership

type HasMastership interface {
	GetMastership() *pb.Mastership
}

HasMastership is an interface that is implemented by RPC responses that may contain changing mastership information.

type Option

type Option func(*Options)

Option configures the connection parameters.

func DialOpts

func DialOpts(dialOpts ...rpc.DialOption) Option

DialOpts sets dial options for the connection.

func MinimumRefreshInterval

func MinimumRefreshInterval(t time.Duration) Option

MinimumRefreshInterval sets the minimum refresh interval for the connection's establishing.

type Options

type Options struct {
	DialOpts               []rpc.DialOption
	MinimumRefreshInterval time.Duration
}

Options keeps information about connection configuration.

Jump to

Keyboard shortcuts

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