// newBucket creates a new bucket
766545
func newBucket(cap int, period time.Duration) (b *Bucket) {
	b = &Bucket{
		cap:         cap,
		channelQuit: make(chan bool),
		count:       0,
		period:      period,
	}
	go b.tick()
	return
}
1151116
func (s *BucketService) CreateBucket(ctx context.Context, b *influxdb.Bucket) error {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	p, err := influxdb.NewPermission(influxdb.WriteAction, influxdb.BucketsResourceType, b.OrgID)
	if err != nil {
		return err
	}

	if err := IsAllowed(ctx, *p); err != nil {
		return err
	}

	return s.s.CreateBucket(ctx, b)
}
746939
func New(s s3iface.S3API, name string) *Bucket {
	return &Bucket{
		S3:   s,
		Name: aws.String(name),
	}
}
238208
func NewBucketer(width, growthFactor float64, numFiniteBuckets int) *Bucketer {
	b := &Bucketer{
		width:            width,
		growthFactor:     growthFactor,
		numFiniteBuckets: numFiniteBuckets,
	}
	b.init()
	return b
}
395914
func NewBucket() *Bucket {
	bkt := new(Bucket)

	bkt.Weight = 0
	bkt.pad = make([]byte, 4)
	bkt.Actions = make([]Action, 0)
	bkt.WatchPort = P_ANY
	bkt.WatchGroup = OFPG_ANY
	bkt.Length = bkt.Len()

	return bkt
}
838164
func (s *GetObjectTaggingInput) SetBucket(v string) *GetObjectTaggingInput {
	s.Bucket = &v
	return s
}
1231358
func (s *UploadPartInput) SetBucket(v string) *UploadPartInput {
	s.Bucket = &v
	return s
}
1358073
func (s *Service) CreateBucket(ctx context.Context, b *influxdb.Bucket) error {
	span, ctx := tracing.StartSpanFromContext(ctx)
	defer span.Finish()

	return s.kv.Update(ctx, func(tx Tx) error {
		return s.createBucket(ctx, tx, b)
	})
}
635027
func (s *Service) CreateBucket(ctx context.Context, b *platform.Bucket) error {
	if b.OrganizationID.Valid() {
		_, pe := s.FindOrganizationByID(ctx, b.OrganizationID)
		if pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  OpPrefix + platform.OpCreateBucket,
			}
		}
	} else {
		o, pe := s.findOrganizationByName(ctx, b.Organization)
		if pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  OpPrefix + platform.OpCreateBucket,
			}
		}
		b.OrganizationID = o.ID
	}
	filter := platform.BucketFilter{
		Name:           &b.Name,
		OrganizationID: &b.OrganizationID,
	}
	if _, err := s.FindBucket(ctx, filter); err == nil {
		return &platform.Error{
			Code: platform.EConflict,
			Op:   OpPrefix + platform.OpCreateBucket,
			Msg:  fmt.Sprintf("bucket with name %s already exists", b.Name),
		}
	}
	b.ID = s.IDGenerator.ID()
	return s.PutBucket(ctx, b)
}
1129140
func (s *PutBucketVersioningInput) SetBucket(v string) *PutBucketVersioningInput {
	s.Bucket = &v
	return s
}
1135228
func newKBucket(prefix *bitmap) *kbucket {
	bucket := &kbucket{
		nodes:       newKeyedDeque(),
		candidates:  newKeyedDeque(),
		lastChanged: time.Now(),
		prefix:      prefix,
	}
	return bucket
}
773621
func (s *GetBucketPolicyStatusInput) SetBucket(v string) *GetBucketPolicyStatusInput {
	s.Bucket = &v
	return s
}
721599
func (s *GetObjectAclInput) SetBucket(v string) *GetObjectAclInput {
	s.Bucket = &v
	return s
}
1172393
func (s *PipelineOutputConfig) SetBucket(v string) *PipelineOutputConfig {
	s.Bucket = &v
	return s
}
1028609
func (s *DeletePublicAccessBlockInput) SetBucket(v string) *DeletePublicAccessBlockInput {
	s.Bucket = &v
	return s
}
757139
func (c *Client) SetBucket(bucket string, nval *uint32, allowmult *bool) ([]byte, error) {
	return c.setBucket(nil, bucket, nval, allowmult)
}
765371
func (s *PutBucketMetricsConfigurationInput) SetBucket(v string) *PutBucketMetricsConfigurationInput {
	s.Bucket = &v
	return s
}