| commit | 44c9eb492ad706149fdae2e7b67f210da50938a0 | [log] [tgz] |
|---|---|---|
| author | Edwin Kempin <ekempin@google.com> | Thu May 06 14:02:13 2021 +0000 |
| committer | Edwin Kempin <ekempin@google.com> | Fri May 07 13:25:40 2021 +0000 |
| tree | 13e76cf3446521bef03e5a58feade831c1f4959c | |
| parent | c89c399d5cb4050e333291ece5bcd08e08952f32 [diff] |
Load accounts in parallel when resolving code owners After reading code owner emails from an OWNERS file they are resolved to accounts. Resolving an email to an account requires doing multiple checks and lookups. Doing the lookups for all emails at once is more efficient than iterating over the emails and doing the lookups once for each email: 1. Lookup external IDs for emails: The external IDs are retrieved from the external ID cache. Each access to the external ID cache requires reading the SHA1 of the refs/meta/external-ids branch. If external IDs for multiple emails are needed it is more efficient to use the ExternalIds.byEmails(String...) method instead of the ExternalIds.byEmail(String) method as the ExternalIds.byEmails(String…) method reads the SHA1 of the refs/meta/external-ids branch only once (and not once per email). 2. Lookup accounts: Accounts are retrieved from the account cache. Using the AccountCache.get(Set<Account.Id>) method loads accounts in parallel and hence it is more efficient than calling AccountCache.get(Account.Id) once for each account. Doing the lookups only once for all emails requires rewriting the CodeOwnerResolver class, as now all checks and transformations need to be performed on the collection of emails, rather than on a single email. Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Ie7dd6f54a0c24c2c4a9018d32ddb66b8f466d32a
This plugin provides support for defining code owners for files in a repository.
If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.
Also see resources/Documentation/about.md.
IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.