// FindBucket returns the first bucket that matches filter.
427079
func (s *BucketService) FindBucket(ctx context.Context, filter platform.BucketFilter) (*platform.Bucket, error) {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	if s.inner == nil || s.engine == nil {
		return nil, errors.New("nil inner BucketService or Engine")
	}
	return s.inner.FindBucket(ctx, filter)
}
852070
func (builder *UpdateSetCommandBuilder) WithBucket(bucket string) *UpdateSetCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
1080596
func (s *GetObjectRetentionInput) SetBucket(v string) *GetObjectRetentionInput {
	s.Bucket = &v
	return s
}
299841
func decodeBucket(bucket string) ([]string, error) {
	decoded, err := url.QueryUnescape(bucket)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	return filepath.SplitList(decoded), nil
}
1257374
func (s *Destination) SetBucket(v string) *Destination {
	s.Bucket = &v
	return s
}
1369794
func (c *Client) GetBucket(bucket string) (*RpbGetBucketResp, error) {
	return c.getBucket(nil, bucket)
}
342816
func (ht *HashTable) nextBucket(bucket int) int {
	if bucket >= ht.numBuckets {
		return 0
	}
	bucketAddr := bucket * ht.BucketSize
	nextUint, err := binary.Varint(ht.Buf[bucketAddr : bucketAddr+10])
	next := int(nextUint)
	if next == 0 {
		return 0
	} else if err < 0 || next <= bucket || next >= ht.numBuckets || next < ht.InitialBuckets {
		tdlog.CritNoRepeat("Bad hash table - repair ASAP %s", ht.Path)
		return 0
	} else {
		return next
	}
}
1198259
func (s *Service) FindBucketByID(ctx context.Context, id influxdb.ID) (*influxdb.Bucket, error) {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	var b *influxdb.Bucket
	var err error

	err = s.kv.View(ctx, func(tx Tx) error {
		bkt, pe := s.findBucketByID(ctx, tx, id)
		if pe != nil {
			err = pe
			return err
		}
		b = bkt
		return nil
	})

	if err != nil {
		return nil, err
	}

	return b, nil
}
225140
func (builder *FetchValueCommandBuilder) WithBucket(bucket string) *FetchValueCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
500374
func (s *GetObjectLockConfigurationInput) SetBucket(v string) *GetObjectLockConfigurationInput {
	s.Bucket = &v
	return s
}
1243629
func (s *BucketService) FindBuckets(ctx context.Context, filter platform.BucketFilter, opt ...platform.FindOptions) ([]*platform.Bucket, int, error) {
	u, err := newURL(s.Addr, bucketPath)
	if err != nil {
		return nil, 0, err
	}

	query := u.Query()
	if filter.OrganizationID != nil {
		query.Add("orgID", filter.OrganizationID.String())
	}
	if filter.Organization != nil {
		query.Add("org", *filter.Organization)
	}
	if filter.ID != nil {
		query.Add("id", filter.ID.String())
	}
	if filter.Name != nil {
		query.Add("name", *filter.Name)
	}

	req, err := http.NewRequest("GET", u.String(), nil)
	if err != nil {
		return nil, 0, err
	}

	req.URL.RawQuery = query.Encode()
	SetToken(s.Token, req)

	hc := newClient(u.Scheme, s.InsecureSkipVerify)
	resp, err := hc.Do(req)
	if err != nil {
		return nil, 0, err
	}

	if err := CheckError(resp, true); err != nil {
		return nil, 0, err
	}

	var bs bucketsResponse
	if err := json.NewDecoder(resp.Body).Decode(&bs); err != nil {
		return nil, 0, err
	}
	defer resp.Body.Close()

	buckets := make([]*platform.Bucket, 0, len(bs.Buckets))
	for _, b := range bs.Buckets {
		pb, err := b.bucket.toPlatform()
		if err != nil {
			return nil, 0, err
		}

		buckets = append(buckets, pb)
	}

	return buckets, len(buckets), nil
}
666143
func (s *PutPublicAccessBlockInput) SetBucket(v string) *PutPublicAccessBlockInput {
	s.Bucket = &v
	return s
}
475647
func (builder *FetchHllCommandBuilder) WithBucket(bucket string) *FetchHllCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}
172806
func (s *PutBucketRequestPaymentInput) SetBucket(v string) *PutBucketRequestPaymentInput {
	s.Bucket = &v
	return s
}
1004487
func (s *ListBucketAnalyticsConfigurationsInput) SetBucket(v string) *ListBucketAnalyticsConfigurationsInput {
	s.Bucket = &v
	return s
}
318527
func (s *JobReport) SetBucket(v string) *JobReport {
	s.Bucket = &v
	return s
}
1014406
func (builder *UpdateHllCommandBuilder) WithBucket(bucket string) *UpdateHllCommandBuilder {
	builder.protobuf.Bucket = []byte(bucket)
	return builder
}