connection

package
v0.0.0-...-0e8dd81 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AwaitConnect

func AwaitConnect(c Connection, retryInterval time.Duration, maxRetries int, onFailure func(error)) (err error)

AwaitConnect repeatedly tries to connect to the daemon until the connection suceeds retryInterval is the time to wait between each successive connection attempt. maxRetries is the maximal number of attempts to retry the connection; a value < 0 represents an infinite attempt of attempts onFailure is called whenever a connection attempt fails; might be nil to not be called

func Connect

func Connect(c Connection) error

Connect connects to the daemon represented by this connection

func MakeURL

func MakeURL(port int, hostname string, protocol string) string

MakeURL makes the url to a connection protocol defaults to "http" when empty

func Validate

func Validate(port int, hostname string) (e error)

Validate validates details to a connection

Types

type Connection

type Connection interface {
	io.Closer // to close connections
	// contains filtered or unexported methods
}

Connection represents the connection to a given daemon

type ElasticConfiguration

type ElasticConfiguration struct {
	HarvestIndex string
	HarvestType  string

	SegmentIndex string
	SegmentType  string

	Timeout time.Duration

	PoolSize    int
	MaxPageSize int64
}

ElasticConfiguration represents a TemaSearch Configuration

type ElasticConnection

type ElasticConnection struct {
	Client *elastic.Client       // underlying http client
	Config *ElasticConfiguration // tema configuration
	// contains filtered or unexported fields
}

ElasticConnection represents a connection to an ElasticSearch instance

func NewElasticConnection

func NewElasticConnection(port int, hostname string) (conn *ElasticConnection, err error)

NewElasticConnection initializes a new Tema connection

func (*ElasticConnection) Close

func (conn *ElasticConnection) Close() error

Close closes this connection

type MWSConfiguration

type MWSConfiguration struct {
	Timeout time.Duration

	PoolSize    int
	MaxPageSize int64
}

MWSConfiguration represents a MathWebSearch Configuration

type MWSConnection

type MWSConnection struct {
	Client *http.Client
	Config *MWSConfiguration
	// contains filtered or unexported fields
}

MWSConnection represents a connection to MathWebSearch

func NewMWSConnection

func NewMWSConnection(port int, hostname string) (conn *MWSConnection, err error)

NewMWSConnection initializes a new MathWebSearch connection

func (*MWSConnection) Close

func (conn *MWSConnection) Close() error

Close closes the connection to MathWebSearch

func (*MWSConnection) URL

func (conn *MWSConnection) URL() string

URL returns the URL to this connection

type TemaConnection

type TemaConnection struct {
	MWS     *MWSConnection     // connection to MathWebSearch
	Elastic *ElasticConnection // connection to ElasticSearch
}

TemaConnection represents a connection to a TemaSearch instance, that is a joined (MathWebSearch, ElasticSearch) instance

func NewTemaConnection

func NewTemaConnection(MWSPort int, MWSHost string, ElasticPort int, ElasticHost string) (conn *TemaConnection, err error)

NewTemaConnection makes a new connection to TemaSearch

func (*TemaConnection) Close

func (conn *TemaConnection) Close() error

Close closes this connection

Jump to

Keyboard shortcuts

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