A request to delete the bucket.
A request to list the objects inside this bucket.
Creates the bucket, if the bucket already exists operation will succeed unless parameter failsIfExists is true.
Creates the bucket, if the bucket already exists operation will succeed unless parameter failsIfExists is true.
if true, the future will be failed if the bucket already exists.
On some module configuring failsIfExists to true may slow down this operation.
import scala.concurrent.{ ExecutionContext, Future } import com.zengularity.benji.{ BucketRef, ObjectStorage } def setupBucket( store: ObjectStorage, name: String)( implicit ec: ExecutionContext): Future[BucketRef] = { // Make sure a bucket is available (either a new or existing one) val bucket = store.bucket(name) bucket.create(failsIfExists = false).map(_ => bucket) }
Prepares a request to delete the referenced bucket.
Prepares a request to delete the referenced bucket.
import akka.stream.Materializer import com.zengularity.benji.BucketRef def foo(myBucket: BucketRef)(implicit m: Materializer) = myBucket.delete() // .delete.apply() def bar(myBucket: BucketRef)(implicit m: Materializer) = myBucket.delete.ignoreIfNotExists() // delete.ignoreIfNotExists.apply()
Determines whether or not the bucket exists.
Determines whether or not the bucket exists.
false
might be returned also in cases where you don't have permission
to view a certain bucket.
import scala.concurrent.{ ExecutionContext, Future } import com.zengularity.benji.ObjectStorage def check(store: ObjectStorage, name: String)( implicit ec: ExecutionContext): Future[Boolean] = store.bucket(name).exists
The name of the bucket.
Returns a reference to an child object, specified by the given name.
Returns a reference to an child object, specified by the given name.
the name of child object
import scala.concurrent.ExecutionContext import com.zengularity.benji.BucketRef def foo(myBucket: BucketRef)(implicit ec: ExecutionContext) = myBucket.obj("objInMyBucket").exists
Prepares a request to list the bucket objects.
Prepares a request to list the bucket objects.
import akka.stream.Materializer import com.zengularity.benji.BucketRef def enumObjects(b: BucketRef)(implicit m: Materializer) = b.objects() def objectList(b: BucketRef)(implicit m: Materializer) = b.objects.collect[List]()
Try to get a reference of this bucket that would allow to perform versioning related operations.
Try to get a reference of this bucket that would allow to perform versioning related operations.
Some if the module of the bucket supports versioning related operations, otherwise None.
def foo(myBucket: com.zengularity.benji.BucketRef) =
myBucket.versioning.isDefined
A live reference to a storage bucket. The operations are scoped on the specified bucket.
Such reference must only be used with the storage which resolved it first.