Class Bucket


  • public class Bucket
    extends java.lang.Object
    A bucket represents a section of the database. Use the bucket(String) or bucket(ByteString) method to get a Bucket reference.

    The bucket provides methods to execute reads and writes in the context of the bucket.

    • 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 class java.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 executed
        key - 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 executed
        keys - 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 executed
        keys - 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 executed
        key - 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 the Key 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 the Key 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 the Key class to create update operations on a key.
        Throws:
        AntidoteException - when there is a problem with the database