Class MySqlAccountStore


  • public class MySqlAccountStore
    extends java.lang.Object
    Wrapper class to handle MySql store operations on Account and Container tables
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts)
      Adds new Accounts to Account table in MySql DB
      void addContainers​(java.util.Collection<com.github.ambry.account.Container> containers)
      Adds new Containers to Container table in MySql DB
      java.util.Collection<com.github.ambry.account.Container> getContainersByAccount​(short accountId)
      Gets all Containers of a given account
      MySqlDataAccessor getMySqlDataAccessor()  
      java.util.Collection<com.github.ambry.account.Account> getNewAccounts​(long updatedSince)
      Gets all Accounts that have been created or modified since the specified time.
      java.util.Collection<com.github.ambry.account.Container> getNewContainers​(long updatedSince)
      Gets all Containers that have been created or modified since the specified time.
      void updateAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts)
      Updates existing Accounts in Account table in MySql DB
      void updateContainers​(java.util.Collection<com.github.ambry.account.Container> containers)
      Updates existing Containers in Container table in MySql DB
      • Methods inherited from class java.lang.Object

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

      • MySqlAccountStore

        public MySqlAccountStore​(MySqlUtils.DbEndpoint dbEndpoint)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • addAccounts

        public void addAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts)
                         throws java.sql.SQLException
        Adds new Accounts to Account table in MySql DB
        Parameters:
        accounts - collection of Accounts to be inserted
        Throws:
        java.sql.SQLException
      • addContainers

        public void addContainers​(java.util.Collection<com.github.ambry.account.Container> containers)
                           throws java.sql.SQLException
        Adds new Containers to Container table in MySql DB
        Parameters:
        containers - collection of Containers to be inserted
        Throws:
        java.sql.SQLException
      • updateAccounts

        public void updateAccounts​(java.util.Collection<com.github.ambry.account.Account> accounts)
                            throws java.sql.SQLException
        Updates existing Accounts in Account table in MySql DB
        Parameters:
        accounts - collection of Accounts to be updated
        Throws:
        java.sql.SQLException
      • updateContainers

        public void updateContainers​(java.util.Collection<com.github.ambry.account.Container> containers)
                              throws java.sql.SQLException
        Updates existing Containers in Container table in MySql DB
        Parameters:
        containers - collection of Accounts to be updated
        Throws:
        java.sql.SQLException
      • getNewAccounts

        public java.util.Collection<com.github.ambry.account.Account> getNewAccounts​(long updatedSince)
                                                                              throws java.sql.SQLException
        Gets all Accounts that have been created or modified since the specified time.
        Parameters:
        updatedSince - the last modified time used to filter.
        Returns:
        a collection of Accounts
        Throws:
        java.sql.SQLException
      • getNewContainers

        public java.util.Collection<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 collection of Containers
        Throws:
        java.sql.SQLException
      • getContainersByAccount

        public java.util.Collection<com.github.ambry.account.Container> getContainersByAccount​(short accountId)
                                                                                        throws java.sql.SQLException
        Gets all Containers of a given account
        Parameters:
        accountId - ID of the account
        Returns:
        a collection of Containers
        Throws:
        java.sql.SQLException