client

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client is an interface for any protocol's client

Index

Constants

View Source
const DefaultPoolSize = 50

DefaultPoolSize is 500

Variables

This section is empty.

Functions

func GetProtocolSpec

func GetProtocolSpec(p string) model.Protocol

GetProtocolSpec is to get protocol specifications

func InstallPlugin

func InstallPlugin(protocol string, f NewFunc)

InstallPlugin is plugin for the new function

Types

type NewFunc

type NewFunc func(Options) ProtocolClient

NewFunc is function for the client

func GetClientNewFunc

func GetClientNewFunc(name string) (NewFunc, error)

GetClientNewFunc is to get the client

type Options

type Options struct {
	PoolSize  int
	PoolTTL   time.Duration
	TLSConfig *tls.Config
	Failure   map[string]bool
}

Options is configs for client creation

type ProtocolClient

type ProtocolClient interface {
	Call(ctx context.Context, addr string, inv *invocation.Invocation, rsp interface{}) error
	String() string
}

ProtocolClient is the interface to communicate with one kind of ProtocolServer, it is used in transport handler rcp protocol client,http protocol client,or you can implement your own

func CreateClient

func CreateClient(protocol, service string) (ProtocolClient, error)

CreateClient is for to create client based on protocol and the service name

func GetClient

func GetClient(protocol, service string) (ProtocolClient, error)

GetClient is to get the client based on protocol and service name

Jump to

Keyboard shortcuts

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