add SendWaitObj Fn
This commit is contained in:
parent
555bc3653e
commit
3964cd05b0
@ -469,6 +469,14 @@ func (c *ClientCommon) SendWait(key string, value MsgVal, timeout time.Duration)
|
|||||||
}, timeout)
|
}, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *ClientCommon) SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error) {
|
||||||
|
data, err := c.sequenceEn(value)
|
||||||
|
if err != nil {
|
||||||
|
return Message{}, err
|
||||||
|
}
|
||||||
|
return c.SendWait(key, data, timeout)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *ClientCommon) Reply(m Message, value MsgVal) error {
|
func (c *ClientCommon) Reply(m Message, value MsgVal) error {
|
||||||
return m.Reply(value)
|
return m.Reply(value)
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ type Client interface {
|
|||||||
sendWait(msg TransferMsg, timeout time.Duration) (Message, error)
|
sendWait(msg TransferMsg, timeout time.Duration) (Message, error)
|
||||||
Send(key string, value MsgVal) error
|
Send(key string, value MsgVal) error
|
||||||
SendWait(key string, value MsgVal, timeout time.Duration) (Message, error)
|
SendWait(key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||||
|
SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error)
|
||||||
SendCtx(ctx context.Context, key string, value MsgVal) (Message, error)
|
SendCtx(ctx context.Context, key string, value MsgVal) (Message, error)
|
||||||
Reply(m Message, value MsgVal) error
|
Reply(m Message, value MsgVal) error
|
||||||
ExchangeKey(newKey []byte) error
|
ExchangeKey(newKey []byte) error
|
||||||
|
@ -449,6 +449,14 @@ func (s *ServerCommon) SendWait(c *ClientConn, key string, value MsgVal, timeout
|
|||||||
}, timeout)
|
}, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ServerCommon) SendWaitObj(c *ClientConn, key string, value interface{}, timeout time.Duration) (Message, error) {
|
||||||
|
data, err := s.sequenceEn(value)
|
||||||
|
if err != nil {
|
||||||
|
return Message{}, err
|
||||||
|
}
|
||||||
|
return s.SendWait(c, key, data, timeout)
|
||||||
|
}
|
||||||
|
|
||||||
func (s *ServerCommon) SendObjCtx(ctx context.Context, c *ClientConn, key string, val interface{}) (Message, error) {
|
func (s *ServerCommon) SendObjCtx(ctx context.Context, c *ClientConn, key string, val interface{}) (Message, error) {
|
||||||
data, err := s.sequenceEn(val)
|
data, err := s.sequenceEn(val)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -17,6 +17,7 @@ type Server interface {
|
|||||||
SendObj(c *ClientConn, key string, val interface{}) error
|
SendObj(c *ClientConn, key string, val interface{}) error
|
||||||
Send(c *ClientConn, key string, value MsgVal) error
|
Send(c *ClientConn, key string, value MsgVal) error
|
||||||
SendWait(c *ClientConn, key string, value MsgVal, timeout time.Duration) (Message, error)
|
SendWait(c *ClientConn, key string, value MsgVal, timeout time.Duration) (Message, error)
|
||||||
|
SendWaitObj(c *ClientConn, key string, value interface{}, timeout time.Duration) (Message, error)
|
||||||
SendCtx(ctx context.Context, c *ClientConn, key string, value MsgVal) (Message, error)
|
SendCtx(ctx context.Context, c *ClientConn, key string, value MsgVal) (Message, error)
|
||||||
Reply(m Message, value MsgVal) error
|
Reply(m Message, value MsgVal) error
|
||||||
pushMessage([]byte, string)
|
pushMessage([]byte, string)
|
||||||
@ -42,5 +43,4 @@ type Server interface {
|
|||||||
|
|
||||||
HeartbeatTimeoutSec() int64
|
HeartbeatTimeoutSec() int64
|
||||||
SetHeartbeatTimeoutSec(int64)
|
SetHeartbeatTimeoutSec(int64)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user