Package com.github.ambry.account.mysql
Class MySqlAccountStore
- java.lang.Object
-
- com.github.ambry.account.mysql.MySqlAccountStore
-
public class MySqlAccountStore extends java.lang.Object
Wrapper class to handle MySql store operations on Account and Container tables
-
-
Constructor Summary
Constructors Constructor Description MySqlAccountStore(MySqlUtils.DbEndpoint dbEndpoint)
-
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 newAccount
s to Account table in MySql DBvoid
addContainers(java.util.Collection<com.github.ambry.account.Container> containers)
Adds newContainer
s to Container table in MySql DBjava.util.Collection<com.github.ambry.account.Container>
getContainersByAccount(short accountId)
Gets allContainer
s of a given accountMySqlDataAccessor
getMySqlDataAccessor()
java.util.Collection<com.github.ambry.account.Account>
getNewAccounts(long updatedSince)
Gets allAccount
s that have been created or modified since the specified time.java.util.Collection<com.github.ambry.account.Container>
getNewContainers(long updatedSince)
Gets allContainer
s that have been created or modified since the specified time.void
updateAccounts(java.util.Collection<com.github.ambry.account.Account> accounts)
Updates existingAccount
s in Account table in MySql DBvoid
updateContainers(java.util.Collection<com.github.ambry.account.Container> containers)
Updates existingContainer
s in Container table in MySql DB
-
-
-
Constructor Detail
-
MySqlAccountStore
public MySqlAccountStore(MySqlUtils.DbEndpoint dbEndpoint) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
-
Method Detail
-
getMySqlDataAccessor
public MySqlDataAccessor getMySqlDataAccessor()
-
addAccounts
public void addAccounts(java.util.Collection<com.github.ambry.account.Account> accounts) throws java.sql.SQLException
Adds newAccount
s to Account table in MySql DB- Parameters:
accounts
- collection ofAccount
s 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 newContainer
s to Container table in MySql DB- Parameters:
containers
- collection ofContainer
s 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 existingAccount
s in Account table in MySql DB- Parameters:
accounts
- collection ofAccount
s 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 existingContainer
s in Container table in MySql DB- Parameters:
containers
- collection ofAccount
s 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 allAccount
s that have been created or modified since the specified time.- Parameters:
updatedSince
- the last modified time used to filter.- Returns:
- a collection of
Account
s - Throws:
java.sql.SQLException
-
getNewContainers
public java.util.Collection<com.github.ambry.account.Container> getNewContainers(long updatedSince) throws java.sql.SQLException
Gets allContainer
s that have been created or modified since the specified time.- Parameters:
updatedSince
- the last modified time used to filter.- Returns:
- a collection of
Container
s - Throws:
java.sql.SQLException
-
getContainersByAccount
public java.util.Collection<com.github.ambry.account.Container> getContainersByAccount(short accountId) throws java.sql.SQLException
Gets allContainer
s of a given account- Parameters:
accountId
- ID of the account- Returns:
- a collection of
Container
s - Throws:
java.sql.SQLException
-
-