public class Emails
extends java.lang.Object
Constructor and Description |
---|
Emails(ExternalIds externalIds,
com.google.inject.Provider<InternalAccountQuery> queryProvider,
RetryHelper retryHelper) |
Modifier and Type | Method and Description |
---|---|
com.google.common.collect.ImmutableSet<Account.Id> |
getAccountFor(java.lang.String email)
Returns the accounts with the given email.
|
com.google.common.collect.ImmutableSet<Account.Id> |
getAccountForExternal(java.lang.String email)
Returns the accounts with the given email.
|
com.google.common.collect.ImmutableSetMultimap<java.lang.String,Account.Id> |
getAccountsFor(java.lang.String... emails)
Returns the accounts for the given emails.
|
@Inject public Emails(ExternalIds externalIds, com.google.inject.Provider<InternalAccountQuery> queryProvider, RetryHelper retryHelper)
public com.google.common.collect.ImmutableSet<Account.Id> getAccountFor(java.lang.String email) throws java.io.IOException
Each email should belong to a single account only. This means if more than one account is returned there is an inconsistency in the external IDs.
The accounts are retrieved via the external ID cache. Each access to the external ID cache
requires reading the SHA1 of the refs/meta/external-ids branch. If accounts for multiple emails
are needed it is more efficient to use getAccountsFor(String...)
as this method reads
the SHA1 of the refs/meta/external-ids branch only once (and not once per email).
In addition accounts are included that have the given email as preferred email even if they have no external ID for the preferred email. Having accounts with a preferred email that does not exist as external ID is an inconsistency, but existing functionality relies on still getting those accounts, which is why they are included. Accounts by preferred email are fetched from the account index.
java.io.IOException
getAccountsFor(String...)
public com.google.common.collect.ImmutableSetMultimap<java.lang.String,Account.Id> getAccountsFor(java.lang.String... emails) throws java.io.IOException
java.io.IOException
getAccountFor(String)
public com.google.common.collect.ImmutableSet<Account.Id> getAccountForExternal(java.lang.String email) throws java.io.IOException
This method behaves just like getAccountFor(String)
, except that accounts are not
looked up by their preferred email. Thus, this method does not rely on the accounts index.
java.io.IOException