// NewOffsetManagerFromClient creates a new OffsetManager from the given client.
// It is still necessary to call Close() on the underlying client when finished with the partition manager.
335290
func NewOffsetManagerFromClient(group string, client Client) (OffsetManager, error) {
	return newOffsetManagerFromClient(group, "", GroupGenerationUndefined, client)
}
681804
func NewConsumerFromClient(client Client) (Consumer, error) {
	// For clients passed in by the client, ensure we don't
	// call Close() on it.
	cli := &nopCloserClient{client}
	return newConsumer(cli)
}
556780
func NewClient(config *triton.ClientConfig) (*StorageClient, error) {
	// TODO: Utilize config interface within the function itself
	client, err := client.New(
		config.TritonURL,
		config.MantaURL,
		config.AccountName,
		config.Signers...,
	)
	if err != nil {
		return nil, err
	}
	return newStorageClient(client), nil
}
720976
func (c *Conn) hideOffset() (offset int64, whence int) {
	c.mutex.Lock()
	offset = c.offset
	c.mutex.Unlock()
	switch offset {
	case -1:
		offset = 0
		whence = 2
	case -2:
		offset = 0
		whence = 0
	default:
		whence = 1
	}
	return
}
94919
func NewClient(context *cli.Context, opts ...containerd.ClientOpt) (*containerd.Client, gocontext.Context, gocontext.CancelFunc, error) {
	client, err := containerd.New(context.GlobalString("address"), opts...)
	if err != nil {
		return nil, nil, nil, err
	}
	ctx, cancel := AppContext(context)
	return client, ctx, cancel, nil
}
375152
func NewManager(client clientset.Interface) *Manager {
	const resyncPeriod = 0

	factory := informers.NewSharedInformerFactory(client, resyncPeriod)
	lister := factory.Node().V1beta1().RuntimeClasses().Lister()

	return &Manager{
		informerFactory: factory,
		lister:          lister,
	}
}
310987
func (b *Broker) FetchOffset(request *OffsetFetchRequest) (*OffsetFetchResponse, error) {
	response := new(OffsetFetchResponse)

	err := b.sendAndReceive(request, response)
	if err != nil {
		return nil, err
	}

	return response, nil
}
950826
func getNewJoinKeysByOffsets(oldJoinKeys []*expression.Column, offsets []int) []*expression.Column {
	newKeys := make([]*expression.Column, 0, len(oldJoinKeys))
	for _, offset := range offsets {
		newKeys = append(newKeys, oldJoinKeys[offset])
	}
	for pos, key := range oldJoinKeys {
		isExist := false
		for _, p := range offsets {
			if p == pos {
				isExist = true
				break
			}
		}
		if !isExist {
			newKeys = append(newKeys, key)
		}
	}
	return newKeys
}
704171
func ResultOffset(offset uint32) func(Call) error {
	return func(hc Call) error {
		if c, ok := hc.(hasQueryOptions); ok {
			if offset > math.MaxInt32 {
				return errors.New("'ResultOffset' exceeds supported offset value")
			}
			c.setResultOffset(offset)
			return nil
		}
		return errors.New("'ResultOffset' option can only be used with Get or Scan request")
	}
}
956475
func (d *Dashboard) NextByOffset() (*Dashboard, error) {
	if d.bySince {
		return nil, MixedPaginationMethodsError
	}
	if len(d.Posts) < 1 {
		return nil, NoNextPageError
	}
	params := copyParams(d.params)
	offset, err := strconv.Atoi(params.Get("offset"))
	if err != nil {
		offset = 0
	}
	offset += len(d.Posts)
	params.Set("offset", strconv.Itoa(offset))
	return GetDashboard(d.client, params)
}
218613
func NewFromClient(c *http.Client, token, apiURL string) Mixpanel {
	if apiURL == "" {
		apiURL = "https://api.mixpanel.com"
	}

	return &mixpanel{
		Client: c,
		Token:  token,
		ApiURL: apiURL,
	}
}
1168288
func (dc *DefaultConnector) CommitOffset(group string, topic string, partition int32, offset int64) error {
	for i := 0; i <= dc.config.CommitOffsetRetries; i++ {
		err := dc.tryCommitOffset(group, topic, partition, offset)
		if err == nil {
			return nil
		}

		Debugf(dc, "Failed to commit offset %d for group %s, topic %s, partition %d after %d try: %s", offset, group, topic, partition, i, err)
		time.Sleep(dc.config.CommitOffsetBackoff)
	}

	return fmt.Errorf("Could not get commit offset %d for group %s, topic %s, partition %d after %d retries", offset, group, topic, partition, dc.config.CommitOffsetRetries)
}
1096974
func NewClient(caller base.APICaller) *Client {
	facadeCaller := base.NewFacadeCaller(caller, instanceMutaterFacade)
	return NewClientFromFacade(facadeCaller)
}
1003392
func (c *ModelCommandBase) NewModelManagerAPIClient() (*modelmanager.Client, error) {
	root, err := c.NewControllerAPIRoot()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return modelmanager.NewClient(root), nil
}
220445
func NewClient(caller base.APICaller) (*Client, error) {
	modelTag, isModel := caller.ModelTag()
	if !isModel {
		return nil, errors.New("expected model specific API connection")
	}
	facadeCaller := base.NewFacadeCaller(caller, firewallerFacade)
	return &Client{
		facade:       facadeCaller,
		ModelWatcher: common.NewModelWatcher(facadeCaller),
		CloudSpecAPI: cloudspec.NewCloudSpecAPI(facadeCaller, modelTag),
	}, nil
}
424737
func NewClientBackedDryRunGetter(config *rest.Config) (*ClientBackedDryRunGetter, error) {
	client, err := clientset.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	dynamicClient, err := dynamic.NewForConfig(config)
	if err != nil {
		return nil, err
	}

	return &ClientBackedDryRunGetter{
		client:        client,
		dynamicClient: dynamicClient,
	}, nil
}
525359
func (fb *FileBlock) OffsetExceedsData(startOff, off Offset) bool {
	if fb.IsInd {
		panic("OffsetExceedsData called on an indirect file block")
	}

	if len(fb.Contents) == 0 {
		return false
	}

	offI, ok := off.(Int64Offset)
	if !ok {
		panic(fmt.Sprintf("Bad offset of type %T passed to FileBlock", off))
	}
	startOffI, ok := startOff.(Int64Offset)
	if !ok {
		panic(fmt.Sprintf("Bad offset of type %T passed to FileBlock",
			startOff))
	}
	return int64(offI) >= int64(startOffI)+int64(len(fb.Contents))
}