// writeBucket will truncate the file and write out the items to the file f.
960409
func writeBucket(f *os.File, items map[string]bucketItem) error {
	// Marshal items to disk format.
	bytes, err := json.Marshal(items)
	if err != nil {
		return trace.Wrap(err)
	}

	// Truncate the file.
	if _, err := f.Seek(0, 0); err != nil {
		return trace.ConvertSystemError(err)
	}
	if err := f.Truncate(0); err != nil {
		return trace.ConvertSystemError(err)
	}

	// Write out the contents to disk.
	n, err := f.Write(bytes)
	if err == nil && n < len(bytes) {
		return trace.Wrap(io.ErrShortWrite)
	}

	return nil
}
721599
func (s *GetObjectAclInput) SetBucket(v string) *GetObjectAclInput {
	s.Bucket = &v
	return s
}
1129140
func (s *PutBucketVersioningInput) SetBucket(v string) *PutBucketVersioningInput {
	s.Bucket = &v
	return s
}
266117
func (s *PutBucketPolicyInput) SetBucket(v string) *PutBucketPolicyInput {
	s.Bucket = &v
	return s
}
703883
func (s *GetBucketLifecycleConfigurationInput) SetBucket(v string) *GetBucketLifecycleConfigurationInput {
	s.Bucket = &v
	return s
}
1031912
func (s *GetBucketAnalyticsConfigurationInput) SetBucket(v string) *GetBucketAnalyticsConfigurationInput {
	s.Bucket = &v
	return s
}
1135860
func (s *CopyObjectInput) SetBucket(v string) *CopyObjectInput {
	s.Bucket = &v
	return s
}
290120
func (tx *Tx) DeleteBucket(name []byte) error {
	return tx.root.DeleteBucket(name)
}
1343236
func (s *BucketService) DeleteBucket(ctx context.Context, id platform.ID) error {
	return s.DeleteBucketFn(ctx, id)
}
773621
func (s *GetBucketPolicyStatusInput) SetBucket(v string) *GetBucketPolicyStatusInput {
	s.Bucket = &v
	return s
}
924689
func (s *RestoreObjectInput) SetBucket(v string) *RestoreObjectInput {
	s.Bucket = &v
	return s
}
968118
func (s *UploadPartCopyInput) SetBucket(v string) *UploadPartCopyInput {
	s.Bucket = &v
	return s
}
1243505
func (s *DeleteBucketAnalyticsConfigurationInput) SetBucket(v string) *DeleteBucketAnalyticsConfigurationInput {
	s.Bucket = &v
	return s
}
692624
func (s *ListPartsOutput) SetBucket(v string) *ListPartsOutput {
	s.Bucket = &v
	return s
}
744376
func (s *HeadObjectInput) SetBucket(v string) *HeadObjectInput {
	s.Bucket = &v
	return s
}
247196
func (s *SelectObjectContentInput) SetBucket(v string) *SelectObjectContentInput {
	s.Bucket = &v
	return s
}
1088344
func (s *S3Object) SetBucket(v string) *S3Object {
	s.Bucket = &v
	return s
}