github.com/Cloud-Foundations/Dominator@v0.3.4/lib/srpc/retryclient/api.go (about) 1 package retryclient 2 3 import ( 4 "crypto/tls" 5 "time" 6 7 "github.com/Cloud-Foundations/Dominator/lib/retry" 8 "github.com/Cloud-Foundations/Dominator/lib/srpc" 9 ) 10 11 var ( 12 // Interface check. 13 _ srpc.ClientI = (*RetryClient)(nil) 14 ) 15 16 type Params struct { 17 retry.Params 18 Address string 19 Dialer srpc.Dialer 20 KeepAlive bool 21 KeepAlivePeriod time.Duration 22 Network string 23 TlsConfig *tls.Config 24 } 25 26 type RetryClient struct { 27 params Params 28 client *srpc.Client 29 lastGoodTime time.Time 30 } 31 32 func DialHTTP(params Params) (*RetryClient, error) { 33 return dialHTTP(params) 34 } 35 36 func (client *RetryClient) Call(serviceMethod string) (*srpc.Conn, error) { 37 return client.call(serviceMethod) 38 } 39 40 func (client *RetryClient) Close() error { 41 return client.close() 42 } 43 44 func (client *RetryClient) Ping() error { 45 return client.ping() 46 } 47 48 func (client *RetryClient) RequestReply(serviceMethod string, 49 request interface{}, reply interface{}) error { 50 return client.requestReply(serviceMethod, request, reply) 51 } 52 53 func (client *RetryClient) SetKeepAlive(keepAlive bool) error { 54 return client.setKeepAlive(keepAlive) 55 } 56 57 func (client *RetryClient) SetKeepAlivePeriod(d time.Duration) error { 58 return client.setKeepAlivePeriod(d) 59 }