client: add req/rsp metadata to CallOptions
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
20770b6e30
commit
49978b75c0
@ -98,6 +98,10 @@ type CallOptions struct {
|
||||
StreamTimeout time.Duration
|
||||
// RequestTimeout request timeout
|
||||
RequestTimeout time.Duration
|
||||
// RequestMetadata holds additional metadata for call
|
||||
RequestMetadata metadata.Metadata
|
||||
// ResponseMetadata holds additional metadata from call
|
||||
ResponseMetadata metadata.Metadata
|
||||
// DialTimeout dial timeout
|
||||
DialTimeout time.Duration
|
||||
// Retries specifies retries num
|
||||
@ -477,6 +481,20 @@ func WithRetries(i int) CallOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithResponseMetadata is a CallOption which adds metadata.Metadata to Options.CallOptions
|
||||
func WithResponseMetadata(md metadata.Metadata) CallOption {
|
||||
return func(o *CallOptions) {
|
||||
o.ResponseMetadata = md
|
||||
}
|
||||
}
|
||||
|
||||
// WithRequestMetadata is a CallOption which adds metadata.Metadata to Options.CallOptions
|
||||
func WithRequestMetadata(md metadata.Metadata) CallOption {
|
||||
return func(o *CallOptions) {
|
||||
o.RequestMetadata = md
|
||||
}
|
||||
}
|
||||
|
||||
// WithRequestTimeout is a CallOption which overrides that which
|
||||
// set in Options.CallOptions
|
||||
func WithRequestTimeout(d time.Duration) CallOption {
|
||||
|
Loading…
Reference in New Issue
Block a user