Class ContainerDao


  • public class ContainerDao
    extends java.lang.Object
    Container Data Access Object.
    • Constructor Summary

      Constructors 
      Constructor Description
      ContainerDao​(com.github.ambry.mysql.MySqlDataAccessor dataAccessor)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addContainer​(int accountId, com.github.ambry.account.Container container)
      Add a container to the database.
      void addContainers​(int accountId, java.util.Collection<com.github.ambry.account.Container> containers, int batchSize)
      Add containers from a given account to the database in batches.
      java.util.List<com.github.ambry.account.Container> getContainers​(int accountId)
      Gets the containers in a specified account.
      java.util.List<com.github.ambry.account.Container> getNewContainers​(long updatedSince)
      Gets all containers that have been created or modified since the specified time.
      void updateContainer​(int accountId, com.github.ambry.account.Container container)
      Updates container from a given account in the database.
      void updateContainers​(int accountId, java.util.Collection<com.github.ambry.account.Container> containers, int batchSize)
      Updates containers from a given account in the database in batches.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ContainerDao

        public ContainerDao​(com.github.ambry.mysql.MySqlDataAccessor dataAccessor)
    • Method Detail

      • addContainer

        public void addContainer​(int accountId,
                                 com.github.ambry.account.Container container)
                          throws java.sql.SQLException
        Add a container to the database.
        Parameters:
        accountId - the container's parent account id.
        container - the container to insert.
        Throws:
        java.sql.SQLException
      • addContainers

        public void addContainers​(int accountId,
                                  java.util.Collection<com.github.ambry.account.Container> containers,
                                  int batchSize)
                           throws java.sql.SQLException
        Add containers from a given account to the database in batches.
        Parameters:
        accountId - the containers' parent account id.
        containers - the containers to insert.
        batchSize - number of statements to be executed in one batch
        Throws:
        java.sql.SQLException
      • updateContainer

        public void updateContainer​(int accountId,
                                    com.github.ambry.account.Container container)
                             throws java.sql.SQLException
        Updates container from a given account in the database.
        Parameters:
        accountId - the container's parent account id.
        container - the container to update.
        Throws:
        java.sql.SQLException
      • updateContainers

        public void updateContainers​(int accountId,
                                     java.util.Collection<com.github.ambry.account.Container> containers,
                                     int batchSize)
                              throws java.sql.SQLException
        Updates containers from a given account in the database in batches.
        Parameters:
        accountId - the container's parent account id.
        containers - the container to update.
        batchSize - number of statements to be executed in one batch
        Throws:
        java.sql.SQLException
      • getContainers

        public java.util.List<com.github.ambry.account.Container> getContainers​(int accountId)
                                                                         throws java.sql.SQLException
        Gets the containers in a specified account.
        Parameters:
        accountId - the id for the parent account.
        Returns:
        a list of Containers.
        Throws:
        java.sql.SQLException
      • getNewContainers

        public java.util.List<com.github.ambry.account.Container> getNewContainers​(long updatedSince)
                                                                            throws java.sql.SQLException
        Gets all containers that have been created or modified since the specified time.
        Parameters:
        updatedSince - the last modified time used to filter.
        Returns:
        a list of Containers.
        Throws:
        java.sql.SQLException