William Petit
8e574c299b
All checks were successful
arcad/edge/pipeline/pr-master This commit looks good
32 lines
510 B
Go
32 lines
510 B
Go
package blob
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
type CloseBucketArgs struct {
|
|
BucketID BucketID
|
|
}
|
|
|
|
type CloseBucketReply struct {
|
|
}
|
|
|
|
func (s *Service) CloseBucket(ctx context.Context, args *CloseBucketArgs, reply *CloseBucketReply) error {
|
|
bucket, err := s.getOpenedBucket(args.BucketID)
|
|
if err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
if err := bucket.Close(); err != nil {
|
|
return errors.WithStack(err)
|
|
}
|
|
|
|
s.buckets.Delete(args.BucketID)
|
|
|
|
*reply = CloseBucketReply{}
|
|
|
|
return nil
|
|
}
|