2019-07-08 23:32:18 +01:00
|
|
|
// Copyright (C) 2018 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package metainfo
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/skyrings/skyring-common/tools/uuid"
|
|
|
|
|
2019-07-12 13:57:02 +01:00
|
|
|
"storj.io/storj/pkg/macaroon"
|
2019-07-08 23:32:18 +01:00
|
|
|
"storj.io/storj/pkg/storj"
|
|
|
|
)
|
|
|
|
|
|
|
|
// BucketsDB is the interface for the database to interact with buckets
|
2019-09-10 14:24:16 +01:00
|
|
|
//
|
|
|
|
// architecture: Database
|
2019-07-08 23:32:18 +01:00
|
|
|
type BucketsDB interface {
|
|
|
|
// Create creates a new bucket
|
|
|
|
CreateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error)
|
|
|
|
// Get returns an existing bucket
|
|
|
|
GetBucket(ctx context.Context, bucketName []byte, projectID uuid.UUID) (bucket storj.Bucket, err error)
|
2019-07-19 16:17:34 +01:00
|
|
|
// UpdateBucket updates an existing bucket
|
|
|
|
UpdateBucket(ctx context.Context, bucket storj.Bucket) (_ storj.Bucket, err error)
|
2019-07-08 23:32:18 +01:00
|
|
|
// Delete deletes a bucket
|
|
|
|
DeleteBucket(ctx context.Context, bucketName []byte, projectID uuid.UUID) (err error)
|
|
|
|
// List returns all buckets for a project
|
2019-07-12 13:57:02 +01:00
|
|
|
ListBuckets(ctx context.Context, projectID uuid.UUID, listOpts storj.BucketListOptions, allowedBuckets macaroon.AllowedBuckets) (bucketList storj.BucketList, err error)
|
2019-07-08 23:32:18 +01:00
|
|
|
}
|