Class Emails


  • public class Emails
    extends Object
    Class to access accounts by email.
    • Method Detail

      • getAccountFor

        public com.google.common.collect.ImmutableSet<Account.Id> getAccountFor​(String email)
                                                                         throws IOException
        Returns the accounts with the given email.

        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).

        If there is no account that owns the email via an external ID all accounts that have the email set as a preferred email are returned. Having accounts with a preferred email that does not exist as external ID is an inconsistency, but existing functionality relies on getting those accounts, which is why they are returned as a fall-back by fetching them from the account index.

        Throws:
        IOException
        See Also:
        getAccountsFor(String...)
      • getAccountForExternal

        public com.google.common.collect.ImmutableSet<Account.Id> getAccountForExternal​(String email)
                                                                                 throws IOException
        Returns the accounts with the given email.

        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.

        Throws:
        IOException