Documentation ¶
Overview ¶
Package multiclient is a higher throughput client connection pool when transferring large messages (such as downloading files).
Copyright 2018 HenryLee. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type MultiClient
- func (c *MultiClient) Addr() string
- func (c *MultiClient) AsyncCall(uri string, arg interface{}, result interface{}, callCmdChan chan<- tp.CallCmd, ...) tp.CallCmd
- func (c *MultiClient) Call(uri string, arg interface{}, result interface{}, setting ...tp.MessageSetting) tp.CallCmd
- func (c *MultiClient) Close()
- func (c *MultiClient) Peer() tp.Peer
- func (c *MultiClient) Push(uri string, arg interface{}, setting ...tp.MessageSetting) *tp.Rerror
- func (c *MultiClient) Stats() pool.WorkshopStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MultiClient ¶
type MultiClient struct {
// contains filtered or unexported fields
}
MultiClient client session which is has connection pool
func New ¶
func New(peer tp.Peer, addr string, sessMaxQuota int, sessMaxIdleDuration time.Duration, protoFunc ...tp.ProtoFunc) *MultiClient
New creates a client session which is has connection pool.
func (*MultiClient) AsyncCall ¶
func (c *MultiClient) AsyncCall( uri string, arg interface{}, result interface{}, callCmdChan chan<- tp.CallCmd, setting ...tp.MessageSetting, ) tp.CallCmd
AsyncCall sends a message and receives reply asynchronously. If the arg is []byte or *[]byte type, it can automatically fill in the body codec name.
func (*MultiClient) Call ¶
func (c *MultiClient) Call(uri string, arg interface{}, result interface{}, setting ...tp.MessageSetting) tp.CallCmd
Call sends a message and receives reply. Note: If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
func (*MultiClient) Push ¶
func (c *MultiClient) Push(uri string, arg interface{}, setting ...tp.MessageSetting) *tp.Rerror
Push sends a message, but do not receives reply. Note: If the arg is []byte or *[]byte type, it can automatically fill in the body codec name; If the session is a client role and PeerConfig.RedialTimes>0, it is automatically re-called once after a failure.
func (*MultiClient) Stats ¶
func (c *MultiClient) Stats() pool.WorkshopStats
Stats returns the current session pool stats.