frostfs-api-go/rpc/client/call_options.go
Leonard Lyubich 25da5d2e13 Add v2 version to go module name
Replace all elements from `v2` to root directory.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-11-17 15:29:33 +03:00

27 lines
582 B
Go

package client
import (
"context"
"github.com/nspcc-dev/neofs-api-go/v2/rpc/grpc"
)
// 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))
}
}