Satisfy the golint gods a little
This commit is contained in:
parent
5fb1051e0b
commit
2f50c74f41
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
The client package provides a method to make synchronous, asynchronous and
|
Package client provides a method to make synchronous, asynchronous and
|
||||||
streaming requests to services. By default json and protobuf codecs are
|
streaming requests to services. By default json and protobuf codecs are
|
||||||
supported.
|
supported.
|
||||||
|
|
||||||
@ -45,12 +45,14 @@ type Client interface {
|
|||||||
String() string
|
String() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Publication is the interface for a message published asynchronously
|
||||||
type Publication interface {
|
type Publication interface {
|
||||||
Topic() string
|
Topic() string
|
||||||
Message() interface{}
|
Message() interface{}
|
||||||
ContentType() string
|
ContentType() string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Request is the interface for a synchronous request used by Call or Stream
|
||||||
type Request interface {
|
type Request interface {
|
||||||
Service() string
|
Service() string
|
||||||
Method() string
|
Method() string
|
||||||
@ -60,6 +62,7 @@ type Request interface {
|
|||||||
Stream() bool
|
Stream() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Streamer is the inteface for a bidirectional synchronous stream
|
||||||
type Streamer interface {
|
type Streamer interface {
|
||||||
Context() context.Context
|
Context() context.Context
|
||||||
Request() Request
|
Request() Request
|
||||||
@ -69,16 +72,28 @@ type Streamer interface {
|
|||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Option used by the Client
|
||||||
type Option func(*Options)
|
type Option func(*Options)
|
||||||
|
|
||||||
|
// CallOption used by Call or Stream
|
||||||
type CallOption func(*CallOptions)
|
type CallOption func(*CallOptions)
|
||||||
|
|
||||||
|
// PublishOption used by Publish
|
||||||
type PublishOption func(*PublishOptions)
|
type PublishOption func(*PublishOptions)
|
||||||
|
|
||||||
|
// RequestOption used by NewRequest
|
||||||
type RequestOption func(*RequestOptions)
|
type RequestOption func(*RequestOptions)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
// DefaultClient is a default client to use out of the box
|
||||||
DefaultClient Client = newRpcClient()
|
DefaultClient Client = newRpcClient()
|
||||||
|
|
||||||
|
// DefaultBackoff is the default backoff function for retries
|
||||||
DefaultBackoff = exponentialBackoff
|
DefaultBackoff = exponentialBackoff
|
||||||
|
|
||||||
|
// DefaultRetries is the default number of times a request is tried
|
||||||
DefaultRetries = 1
|
DefaultRetries = 1
|
||||||
|
// DefaultRequestTimeout is the default request timeout
|
||||||
DefaultRequestTimeout = time.Second * 5
|
DefaultRequestTimeout = time.Second * 5
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user