client

package
Version: v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIBuilder

type APIBuilder struct {
	// contains filtered or unexported fields
}

APIBuilder api builder

func (*APIBuilder) AddBlacklist

func (ab *APIBuilder) AddBlacklist(ips ...string) *APIBuilder

AddBlacklist add ip black list

func (*APIBuilder) AddDefaultValueCookie

func (ab *APIBuilder) AddDefaultValueCookie(name, value string) *APIBuilder

AddDefaultValueCookie add default value cookie

func (*APIBuilder) AddDefaultValueHeader

func (ab *APIBuilder) AddDefaultValueHeader(name, value string) *APIBuilder

AddDefaultValueHeader add default value header

func (*APIBuilder) AddDispatchNode

func (ab *APIBuilder) AddDispatchNode(cluster uint64) *APIBuilder

AddDispatchNode add a dispatch node if the cluster not added

func (*APIBuilder) AddDispatchNodeCachingCondition

func (ab *APIBuilder) AddDispatchNodeCachingCondition(cluster uint64, param metapb.Parameter, op metapb.CMP, expect string) *APIBuilder

AddDispatchNodeCachingCondition add condition for caching

func (*APIBuilder) AddDispatchNodeCachingConditionWithIndex

func (ab *APIBuilder) AddDispatchNodeCachingConditionWithIndex(cluster uint64, index int, param metapb.Parameter, op metapb.CMP, expect string) *APIBuilder

AddDispatchNodeCachingConditionWithIndex add condition for caching

func (*APIBuilder) AddDispatchNodeCachingKey

func (ab *APIBuilder) AddDispatchNodeCachingKey(cluster uint64, keys ...metapb.Parameter) *APIBuilder

AddDispatchNodeCachingKey add key for caching

func (*APIBuilder) AddDispatchNodeCachingKeyWithIndex

func (ab *APIBuilder) AddDispatchNodeCachingKeyWithIndex(cluster uint64, index int, keys ...metapb.Parameter) *APIBuilder

AddDispatchNodeCachingKeyWithIndex add key for caching

func (*APIBuilder) AddDispatchNodeDefaultValue

func (ab *APIBuilder) AddDispatchNodeDefaultValue(cluster uint64, value []byte) *APIBuilder

AddDispatchNodeDefaultValue add default value for dispatch

func (*APIBuilder) AddDispatchNodeDefaultValueCookie

func (ab *APIBuilder) AddDispatchNodeDefaultValueCookie(cluster uint64, name, value string) *APIBuilder

AddDispatchNodeDefaultValueCookie add default value cookie

func (*APIBuilder) AddDispatchNodeDefaultValueCookieWithIndex

func (ab *APIBuilder) AddDispatchNodeDefaultValueCookieWithIndex(cluster uint64, idx int, name, value string) *APIBuilder

AddDispatchNodeDefaultValueCookieWithIndex add default value cookie

func (*APIBuilder) AddDispatchNodeDefaultValueHeader

func (ab *APIBuilder) AddDispatchNodeDefaultValueHeader(cluster uint64, name, value string) *APIBuilder

AddDispatchNodeDefaultValueHeader add default value header

func (*APIBuilder) AddDispatchNodeDefaultValueHeaderWithIndex

func (ab *APIBuilder) AddDispatchNodeDefaultValueHeaderWithIndex(cluster uint64, idx int, name, value string) *APIBuilder

AddDispatchNodeDefaultValueHeaderWithIndex add default value header

func (*APIBuilder) AddDispatchNodeDefaultValueWithIndex

func (ab *APIBuilder) AddDispatchNodeDefaultValueWithIndex(cluster uint64, idx int, value []byte) *APIBuilder

AddDispatchNodeDefaultValueWithIndex add default value for dispatch

func (*APIBuilder) AddDispatchNodeValidation

func (ab *APIBuilder) AddDispatchNodeValidation(cluster uint64, param metapb.Parameter, rule string, required bool) *APIBuilder

AddDispatchNodeValidation add dispatch node validation

func (*APIBuilder) AddDispatchNodeValidationWithIndex

func (ab *APIBuilder) AddDispatchNodeValidationWithIndex(cluster uint64, index int, param metapb.Parameter, rule string, required bool) *APIBuilder

AddDispatchNodeValidationWithIndex add dispatch node validation

func (*APIBuilder) AddFlatRenderObject

func (ab *APIBuilder) AddFlatRenderObject(namesAndExtractExps ...string) *APIBuilder

AddFlatRenderObject add the render object to the top level object

func (*APIBuilder) AddPerm

func (ab *APIBuilder) AddPerm(perm string) *APIBuilder

AddPerm add a perm

func (*APIBuilder) AddRenderObject

func (ab *APIBuilder) AddRenderObject(nameInTemplate string, namesAndExtractExps ...string) *APIBuilder

AddRenderObject add the render object to the top level object

func (*APIBuilder) AddTag

func (ab *APIBuilder) AddTag(key, value string) *APIBuilder

AddTag add tag for api

func (*APIBuilder) AddWhitelist

func (ab *APIBuilder) AddWhitelist(ips ...string) *APIBuilder

AddWhitelist add ip white list

func (*APIBuilder) AppendDispatchNode

func (ab *APIBuilder) AppendDispatchNode(cluster uint64) *APIBuilder

AppendDispatchNode append a dispatch node even if the cluster added

func (*APIBuilder) AuthPlugin

func (ab *APIBuilder) AuthPlugin(name string) *APIBuilder

AuthPlugin set a auth filter plugin

func (*APIBuilder) Build

func (ab *APIBuilder) Build() (*rpcpb.PutAPIReq, error)

Build build

func (*APIBuilder) Commit

func (ab *APIBuilder) Commit() (uint64, error)

Commit commit

func (*APIBuilder) DefaultValue

func (ab *APIBuilder) DefaultValue(value []byte) *APIBuilder

DefaultValue set default value

func (*APIBuilder) DispatchNodeBatchIndex

func (ab *APIBuilder) DispatchNodeBatchIndex(cluster uint64, batchIndex int) *APIBuilder

DispatchNodeBatchIndex add a dispatch node batch index

func (*APIBuilder) DispatchNodeBatchIndexWithIndex

func (ab *APIBuilder) DispatchNodeBatchIndexWithIndex(cluster uint64, idx int, batchIndex int) *APIBuilder

DispatchNodeBatchIndexWithIndex add a dispatch node batch index

func (*APIBuilder) DispatchNodeRetryStrategy

func (ab *APIBuilder) DispatchNodeRetryStrategy(cluster uint64, strategy *metapb.RetryStrategy) *APIBuilder

DispatchNodeRetryStrategy add a retryStrategy

func (*APIBuilder) DispatchNodeRetryStrategyWithIndex

func (ab *APIBuilder) DispatchNodeRetryStrategyWithIndex(cluster uint64, idx int, strategy *metapb.RetryStrategy) *APIBuilder

DispatchNodeRetryStrategyWithIndex add a retryStrategy

func (*APIBuilder) DispatchNodeTimeouts

func (ab *APIBuilder) DispatchNodeTimeouts(cluster uint64, readTimeout, writeTimeout int64) *APIBuilder

DispatchNodeTimeouts add timeouts options

func (*APIBuilder) DispatchNodeTimeoutsWithIndex

func (ab *APIBuilder) DispatchNodeTimeoutsWithIndex(cluster uint64, idx int, readTimeout, writeTimeout int64) *APIBuilder

DispatchNodeTimeoutsWithIndex add timeouts options

func (*APIBuilder) DispatchNodeURLRewrite

func (ab *APIBuilder) DispatchNodeURLRewrite(cluster uint64, urlRewrite string) *APIBuilder

DispatchNodeURLRewrite set dispatch node url rewrite

func (*APIBuilder) DispatchNodeURLRewriteWithIndex

func (ab *APIBuilder) DispatchNodeURLRewriteWithIndex(cluster uint64, index int, urlRewrite string) *APIBuilder

DispatchNodeURLRewriteWithIndex set dispatch node url rewrite

func (*APIBuilder) DispatchNodeUseCaching

func (ab *APIBuilder) DispatchNodeUseCaching(cluster uint64, deadline time.Duration) *APIBuilder

DispatchNodeUseCaching set dispatch node caching

func (*APIBuilder) DispatchNodeUseCachingWithIndex

func (ab *APIBuilder) DispatchNodeUseCachingWithIndex(cluster uint64, index int, deadline time.Duration) *APIBuilder

DispatchNodeUseCachingWithIndex set dispatch node caching

func (*APIBuilder) DispatchNodeValueAttrName

func (ab *APIBuilder) DispatchNodeValueAttrName(cluster uint64, attrName string) *APIBuilder

DispatchNodeValueAttrName set dispatch node attr name of value

func (*APIBuilder) DispatchNodeValueAttrNameWithIndex

func (ab *APIBuilder) DispatchNodeValueAttrNameWithIndex(cluster uint64, index int, attrName string) *APIBuilder

DispatchNodeValueAttrNameWithIndex set dispatch node attr name of value

func (*APIBuilder) Down

func (ab *APIBuilder) Down() *APIBuilder

Down down this api

func (*APIBuilder) MatchDomain

func (ab *APIBuilder) MatchDomain(domain string) *APIBuilder

MatchDomain set a match domain

func (*APIBuilder) MatchMethod

func (ab *APIBuilder) MatchMethod(method string) *APIBuilder

MatchMethod set a match method

func (*APIBuilder) MatchURLPattern

func (ab *APIBuilder) MatchURLPattern(urlPattern string) *APIBuilder

MatchURLPattern set a match path

func (*APIBuilder) Name

func (ab *APIBuilder) Name(name string) *APIBuilder

Name set a name

func (*APIBuilder) NoBlacklist

func (ab *APIBuilder) NoBlacklist() *APIBuilder

NoBlacklist set no blacklist

func (*APIBuilder) NoDefaultValue

func (ab *APIBuilder) NoDefaultValue() *APIBuilder

NoDefaultValue set no default value

func (*APIBuilder) NoRenderTemplate

func (ab *APIBuilder) NoRenderTemplate() *APIBuilder

NoRenderTemplate clear render template

func (*APIBuilder) NoWhitelist

func (ab *APIBuilder) NoWhitelist() *APIBuilder

NoWhitelist set no whiltelist

func (*APIBuilder) Position

func (ab *APIBuilder) Position(value uint32) *APIBuilder

Position reset the position for api

func (*APIBuilder) RemoveBlacklist

func (ab *APIBuilder) RemoveBlacklist(ips ...string) *APIBuilder

RemoveBlacklist remove ip white list

func (*APIBuilder) RemoveDispatchNodeURLRewrite

func (ab *APIBuilder) RemoveDispatchNodeURLRewrite(cluster uint64) *APIBuilder

RemoveDispatchNodeURLRewrite remove dispatch node

func (*APIBuilder) RemovePerm

func (ab *APIBuilder) RemovePerm(perm string) *APIBuilder

RemovePerm remove a perm

func (*APIBuilder) RemoveTag

func (ab *APIBuilder) RemoveTag(key string) *APIBuilder

RemoveTag remove tag for api

func (*APIBuilder) RemoveWhitelist

func (ab *APIBuilder) RemoveWhitelist(ips ...string) *APIBuilder

RemoveWhitelist remove ip white list

func (*APIBuilder) UP

func (ab *APIBuilder) UP() *APIBuilder

UP up this api

func (*APIBuilder) Use

func (ab *APIBuilder) Use(value metapb.API) *APIBuilder

Use use a cluster

func (*APIBuilder) UseDefaultValue

func (ab *APIBuilder) UseDefaultValue(force bool) *APIBuilder

UseDefaultValue use default value if force

func (*APIBuilder) UseDispatchNodeDefaultValue

func (ab *APIBuilder) UseDispatchNodeDefaultValue(cluster uint64, force bool) *APIBuilder

UseDispatchNodeDefaultValue use default value if force

func (*APIBuilder) UseDispatchNodeDefaultValueWithIndex

func (ab *APIBuilder) UseDispatchNodeDefaultValueWithIndex(cluster uint64, idx int, force bool) *APIBuilder

UseDispatchNodeDefaultValueWithIndex use default value if force

func (*APIBuilder) WebSocketOptions

func (ab *APIBuilder) WebSocketOptions(options *metapb.WebSocketOptions) *APIBuilder

WebSocketOptions set websocket options

type Client

type Client interface {
	NewClusterBuilder() *ClusterBuilder
	RemoveCluster(id uint64) error
	GetCluster(id uint64) (*metapb.Cluster, error)
	GetClusterList(fn func(*metapb.Cluster) bool) error

	NewServerBuilder() *ServerBuilder
	RemoveServer(id uint64) error
	GetServer(id uint64) (*metapb.Server, error)
	GetServerList(fn func(*metapb.Server) bool) error

	NewAPIBuilder() *APIBuilder
	RemoveAPI(id uint64) error
	GetAPI(id uint64) (*metapb.API, error)
	GetAPIList(fn func(*metapb.API) bool) error

	NewRoutingBuilder() *RoutingBuilder
	RemoveRouting(id uint64) error
	GetRouting(id uint64) (*metapb.Routing, error)
	GetRoutingList(fn func(*metapb.Routing) bool) error

	AddBind(cluster, server uint64) error
	RemoveBind(cluster, server uint64) error
	RemoveClusterBind(cluster uint64) error
	GetBindServers(cluster uint64) ([]uint64, error)

	Clean() error
	SetID(id uint64) error
	Batch(batch *rpcpb.BatchReq) (*rpcpb.BatchRsp, error)

	Close() error
}

Client gateway client

func NewClient

func NewClient(timeout time.Duration, addrs ...string) (Client, error)

NewClient returns a gateway client, using direct address

func NewClientWithEtcdDiscovery

func NewClientWithEtcdDiscovery(prefix string, timeout time.Duration, etcdAddrs ...string) (Client, error)

NewClientWithEtcdDiscovery returns a gateway client, using etcd service discovery

type ClusterBuilder

type ClusterBuilder struct {
	// contains filtered or unexported fields
}

ClusterBuilder cluster builder

func (*ClusterBuilder) Build

func (cb *ClusterBuilder) Build() (*rpcpb.PutClusterReq, error)

Build build

func (*ClusterBuilder) Commit

func (cb *ClusterBuilder) Commit() (uint64, error)

Commit commit

func (*ClusterBuilder) Loadbalance

func (cb *ClusterBuilder) Loadbalance(lb metapb.LoadBalance) *ClusterBuilder

Loadbalance set a loadbalance

func (*ClusterBuilder) Name

func (cb *ClusterBuilder) Name(name string) *ClusterBuilder

Name set a name

func (*ClusterBuilder) Use

func (cb *ClusterBuilder) Use(value metapb.Cluster) *ClusterBuilder

Use use a cluster

type RoutingBuilder

type RoutingBuilder struct {
	// contains filtered or unexported fields
}

RoutingBuilder routing builder

func (*RoutingBuilder) API

func (rb *RoutingBuilder) API(api uint64) *RoutingBuilder

API set routing API

func (*RoutingBuilder) AddCondition

func (rb *RoutingBuilder) AddCondition(param metapb.Parameter, op metapb.CMP, expect string) *RoutingBuilder

AddCondition add condition

func (*RoutingBuilder) Build

func (rb *RoutingBuilder) Build() (*rpcpb.PutRoutingReq, error)

Build build

func (*RoutingBuilder) Commit

func (rb *RoutingBuilder) Commit() (uint64, error)

Commit commit

func (*RoutingBuilder) Down

func (rb *RoutingBuilder) Down() *RoutingBuilder

Down down this routing

func (*RoutingBuilder) Name

func (rb *RoutingBuilder) Name(name string) *RoutingBuilder

Name routing name

func (*RoutingBuilder) Strategy

func (rb *RoutingBuilder) Strategy(strategy metapb.RoutingStrategy) *RoutingBuilder

Strategy set strategy for this routing

func (*RoutingBuilder) To

func (rb *RoutingBuilder) To(clusterID uint64) *RoutingBuilder

To routing to

func (*RoutingBuilder) TrafficRate

func (rb *RoutingBuilder) TrafficRate(rate int) *RoutingBuilder

TrafficRate set traffic rate for this routing

func (*RoutingBuilder) Up

func (rb *RoutingBuilder) Up() *RoutingBuilder

Up up this routing

func (*RoutingBuilder) Use

func (rb *RoutingBuilder) Use(value metapb.Routing) *RoutingBuilder

Use use a cluster

type ServerBuilder

type ServerBuilder struct {
	// contains filtered or unexported fields
}

ServerBuilder server builder

func (*ServerBuilder) Addr

func (sb *ServerBuilder) Addr(addr string) *ServerBuilder

Addr set addr

func (*ServerBuilder) Build

func (sb *ServerBuilder) Build() (*rpcpb.PutServerReq, error)

Build build

func (*ServerBuilder) CheckHTTPBody

func (sb *ServerBuilder) CheckHTTPBody(path, body string, interval time.Duration, timeout time.Duration) *ServerBuilder

CheckHTTPBody use a heath check

func (*ServerBuilder) CheckHTTPCode

func (sb *ServerBuilder) CheckHTTPCode(path string, interval time.Duration, timeout time.Duration) *ServerBuilder

CheckHTTPCode use a heath check

func (*ServerBuilder) CircuitBreakerCheckPeriod

func (sb *ServerBuilder) CircuitBreakerCheckPeriod(checkPeriod time.Duration) *ServerBuilder

CircuitBreakerCheckPeriod set circuit breaker period

func (*ServerBuilder) CircuitBreakerCloseToHalfTimeout

func (sb *ServerBuilder) CircuitBreakerCloseToHalfTimeout(timeout time.Duration) *ServerBuilder

CircuitBreakerCloseToHalfTimeout set circuit breaker timeout that close status convert to half

func (*ServerBuilder) CircuitBreakerHalfToCloseCondition

func (sb *ServerBuilder) CircuitBreakerHalfToCloseCondition(failureRate int) *ServerBuilder

CircuitBreakerHalfToCloseCondition set circuit breaker condition of half convert to close

func (*ServerBuilder) CircuitBreakerHalfToOpenCondition

func (sb *ServerBuilder) CircuitBreakerHalfToOpenCondition(succeedRate int) *ServerBuilder

CircuitBreakerHalfToOpenCondition set circuit breaker condition of half convert to open

func (*ServerBuilder) CircuitBreakerHalfTrafficRate

func (sb *ServerBuilder) CircuitBreakerHalfTrafficRate(rate int) *ServerBuilder

CircuitBreakerHalfTrafficRate set circuit breaker traffic in half status

func (*ServerBuilder) Commit

func (sb *ServerBuilder) Commit() (uint64, error)

Commit commit

func (*ServerBuilder) HTTPBackend

func (sb *ServerBuilder) HTTPBackend() *ServerBuilder

HTTPBackend set backend is http backend

func (*ServerBuilder) MaxQPS

func (sb *ServerBuilder) MaxQPS(max int64) *ServerBuilder

MaxQPS set max qps

func (*ServerBuilder) NoCircuitBreaker

func (sb *ServerBuilder) NoCircuitBreaker() *ServerBuilder

NoCircuitBreaker no circuit breaker

func (*ServerBuilder) NoHeathCheck

func (sb *ServerBuilder) NoHeathCheck() *ServerBuilder

NoHeathCheck no heath check

func (*ServerBuilder) Use

func (sb *ServerBuilder) Use(value metapb.Server) *ServerBuilder

Use use a server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to