package timeout

// Code generated by gowrap. DO NOT EDIT.
// template: ../../templates/timeout.tmpl
// gowrap: http://github.com/hexdigest/gowrap

import (
	"context"
	"time"

	"go.uber.org/yarpc"

	"github.com/uber/cadence/client/sharddistributor"
	"github.com/uber/cadence/common/types"
)

var _ sharddistributor.Client = (*sharddistributorClient)(nil)

// sharddistributorClient implements the sharddistributor.Client interface instrumented with timeouts
type sharddistributorClient struct {
	client  sharddistributor.Client
	timeout time.Duration
}

// NewShardDistributorClient creates a new sharddistributorClient instance
func NewShardDistributorClient(
	client sharddistributor.Client,
	timeout time.Duration,
) sharddistributor.Client {
	return &sharddistributorClient{
		client:  client,
		timeout: timeout,
	}
}

func (c *sharddistributorClient) GetShardOwner(ctx context.Context, gp1 *types.GetShardOwnerRequest, p1 ...yarpc.CallOption) (gp2 *types.GetShardOwnerResponse, err error) {
	ctx, cancel := createContext(ctx, c.timeout)
	defer cancel()
	return c.client.GetShardOwner(ctx, gp1, p1...)
}
