2021-03-12 12:33:32 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2021-11-16 17:30:55 +00:00
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
|
2021-03-12 12:33:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// CallOption is a messaging session option within Protobuf RPC.
|
|
|
|
type CallOption func(*callParameters)
|
|
|
|
|
|
|
|
type callParameters struct {
|
|
|
|
callOpts []grpc.CallOption
|
|
|
|
}
|
|
|
|
|
|
|
|
func defaultCallParameters() *callParameters {
|
|
|
|
return &callParameters{
|
|
|
|
callOpts: make([]grpc.CallOption, 0, 1),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithContext return options to specify call context.
|
|
|
|
func WithContext(ctx context.Context) CallOption {
|
|
|
|
return func(prm *callParameters) {
|
|
|
|
prm.callOpts = append(prm.callOpts, grpc.WithContext(ctx))
|
|
|
|
}
|
|
|
|
}
|