Add grpc call options to matchfunction query functions
@@ -20,12 +20,13 @@ import (
"fmt"
"io"
+ "google.golang.org/grpc"
"open-match.dev/open-match/pkg/pb"
)
// QueryPool queries queryService and returns the tickets that belong to the specified pool.
-func QueryPool(ctx context.Context, queryClient pb.QueryServiceClient, pool *pb.Pool) ([]*pb.Ticket, error) {
- query, err := queryClient.QueryTickets(ctx, &pb.QueryTicketsRequest{Pool: pool})
+func QueryPool(ctx context.Context, queryClient pb.QueryServiceClient, pool *pb.Pool, opts ...grpc.CallOption) ([]*pb.Ticket, error) {
+ query, err := queryClient.QueryTickets(ctx, &pb.QueryTicketsRequest{Pool: pool}, opts...)
if err != nil {
return nil, fmt.Errorf("error calling queryService.QueryTickets: %w", err)
}
@@ -46,7 +47,7 @@ func QueryPool(ctx context.Context, queryClient pb.QueryServiceClient, pool *pb.
}
// QueryPools queries queryService and returns the a map of pool names to the tickets belonging to those pools.
-func QueryPools(ctx context.Context, queryClient pb.QueryServiceClient, pools []*pb.Pool) (map[string][]*pb.Ticket, error) {
+func QueryPools(ctx context.Context, queryClient pb.QueryServiceClient, pools []*pb.Pool, opts ...grpc.CallOption) (map[string][]*pb.Ticket, error) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
type result struct {
@@ -61,7 +62,7 @@ func QueryPools(ctx context.Context, queryClient pb.QueryServiceClient, pools []
r := result{
name: pool.Name,
}
- r.tickets, r.err = QueryPool(ctx, queryClient, pool)
+ r.tickets, r.err = QueryPool(ctx, queryClient, pool, opts...)
select {
case results <- r:
case <-ctx.Done():
