Package eu.antidotedb.client
Class Bucket
- java.lang.Object
-
- eu.antidotedb.client.Bucket
-
public class Bucket extends java.lang.Object
A bucket represents a section of the database. Use thebucket(String)
orbucket(ByteString)
method to get a Bucket reference.The bucket provides methods to execute reads and writes in the context of the bucket.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Bucket
bucket(com.google.protobuf.ByteString name)
Get the bucket with the given name.static Bucket
bucket(java.lang.String name)
Get the bucket with the given name.com.google.protobuf.ByteString
getName()
<T> BatchReadResult<T>
read(BatchRead tx, Key<T> key)
Reads one object from the database in a batch transaction.<T> T
read(TransactionWithReads tx, Key<T> key)
Reads one object from the database.<T> java.util.List<T>
readAll(TransactionWithReads tx, Key<? extends T>... keys)
Reads several objects from the database.<T> java.util.List<T>
readAll(TransactionWithReads tx, java.util.Collection<? extends Key<? extends T>> keys)
Reads several objects from the database.java.lang.String
toString()
void
update(AntidoteTransaction tx, UpdateOp update)
Performs an update on the database.void
updates(AntidoteTransaction tx, UpdateOp... updates)
Performs several updates on the database.void
updates(AntidoteTransaction tx, java.util.Collection<? extends UpdateOp> updates)
Performs several updates on the database.
-
-
-
Method Detail
-
bucket
public static Bucket bucket(java.lang.String name)
Get the bucket with the given name.
-
bucket
public static Bucket bucket(com.google.protobuf.ByteString name)
Get the bucket with the given name.
-
getName
public com.google.protobuf.ByteString getName()
- Returns:
- the name of the bucket
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
read
@CheckReturnValue public <T> T read(TransactionWithReads tx, Key<T> key)
Reads one object from the database.- Type Parameters:
T
- The type of the value being read- Parameters:
tx
- The transaction context in which the read will be executedkey
- The key of the object to read- Returns:
- the returned value
- Throws:
AntidoteException
- when there is a problem with the database
-
readAll
@SafeVarargs @CheckReturnValue public final <T> java.util.List<T> readAll(TransactionWithReads tx, Key<? extends T>... keys)
Reads several objects from the database.- Type Parameters:
T
- The type of the values being read- Parameters:
tx
- The transaction context in which the read will be executedkeys
- The keys of the objects to read- Returns:
- the returned values
- Throws:
AntidoteException
- when there is a problem with the database
-
readAll
@CheckReturnValue public <T> java.util.List<T> readAll(TransactionWithReads tx, java.util.Collection<? extends Key<? extends T>> keys)
Reads several objects from the database.- Type Parameters:
T
- The type of the values being read- Parameters:
tx
- The transaction context in which the read will be executedkeys
- The keys of the objects to read- Returns:
- the returned values
- Throws:
AntidoteException
- when there is a problem with the database
-
read
@CheckReturnValue public <T> BatchReadResult<T> read(BatchRead tx, Key<T> key)
Reads one object from the database in a batch transaction.- Type Parameters:
T
- The type of the value being read- Parameters:
tx
- The transaction context in which the read will be executedkey
- The key of the object to read- Returns:
- an object which will contain the read value after the batch transaction was committed.
- Throws:
AntidoteException
- when there is a problem with the database
-
update
public void update(AntidoteTransaction tx, UpdateOp update)
Performs an update on the database.- Parameters:
tx
- The transaction context in which the update will be executed.update
- The update operation to perform. Use theKey
class to create update operations on a key.- Throws:
AntidoteException
- when there is a problem with the database
-
updates
public void updates(AntidoteTransaction tx, UpdateOp... updates)
Performs several updates on the database.- Parameters:
tx
- The transaction context in which the update will be executed.updates
- The update operations to perform. Use theKey
class to create update operations on a key.- Throws:
AntidoteException
- when there is a problem with the database
-
updates
public void updates(AntidoteTransaction tx, java.util.Collection<? extends UpdateOp> updates)
Performs several updates on the database.- Parameters:
tx
- The transaction context in which the update will be executed.updates
- The update operations to perform. Use theKey
class to create update operations on a key.- Throws:
AntidoteException
- when there is a problem with the database
-
-