client: add req/rsp metadata to CallOptions #153
@ -98,6 +98,10 @@ type CallOptions struct {
|
|||||||
StreamTimeout time.Duration
|
StreamTimeout time.Duration
|
||||||
// RequestTimeout request timeout
|
// RequestTimeout request timeout
|
||||||
RequestTimeout time.Duration
|
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 dial timeout
|
||||||
DialTimeout time.Duration
|
DialTimeout time.Duration
|
||||||
// Retries specifies retries num
|
// 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
|
// WithRequestTimeout is a CallOption which overrides that which
|
||||||
// set in Options.CallOptions
|
// set in Options.CallOptions
|
||||||
func WithRequestTimeout(d time.Duration) CallOption {
|
func WithRequestTimeout(d time.Duration) CallOption {
|
||||||
|
Loading…
Reference in New Issue
Block a user