Commit graph

10 commits

Author SHA1 Message Date
thiemowmde
bebd255f1e rdbms: Use more narrow IReadableDatabase in SelectQueryBuilder
Turned out to be much easier to do than expected.

It's literally a reader, isn't it? This change will make it possible
to use the more narrow IReadableDatabase interface in many more
places in our codebases. Some additional changes had to be made in
this patch already (most notably in ActorStore) to make Phan happy.

Bug: T326274
Change-Id: I5a886ad741f3abeadf0242039bfcce266e9c086b
2023-06-05 17:58:46 +01:00
Amir Sarabadani
1f74dff1fb rdbms: Switch LBFactory::getReplicaDatabase to narrow IReadableDatabase
When it's only reading, it should only rely on read methods.

Update a few callers in ChangeTags and ActorStore-related code while
at it.

Bug: T326274
Change-Id: I78dd5cbef2d480d23ba2955555421224770d474b
2023-02-28 16:06:35 +00:00
Majavah
7e3df796b0 Revert "Remove last User dependencies from File"
This reverts commit 73a25838b4.

Reason for revert: T296508

Bug: T296508
Change-Id: I8af37665eeb284b85157a72459d43261ec4829ed
2021-11-26 17:06:36 +00:00
Petr Pchelko
73a25838b4 Remove last User dependencies from File
Change-Id: I953fcc66b5cde1ef481178b08e16c50b8a118702
2021-11-26 05:42:00 +00:00
Petr Pchelko
2600a0de39 ActorNormalization::acquireActorId - require IDatabase
Bug: T276986
Change-Id: I8713a975681355cf3061d35ef5d7944c1d918d21
2021-05-25 07:49:13 -07:00
daniel
806792281f ActorNormalization should require a DB connection.
ActorNormalization should only be used in contexts where a DB connection
is already being used, or at least easily available.

Bug: T276986
Change-Id: Ie8aadaffa4a30e63fcad0502d45b8ec364fc79ef
2021-03-10 21:43:49 +01:00
daniel
0ebf43b26d ActorStore: introduce findActorIdByName
The findActorIdByName method is intended to be used when we need to
select by actor ID, but all we have is a user name. We can't use
findActorId(), since it requires a UserIdentity, which would needlessly
force us to look up a user ID, resulting in two queries.

Bug: T274179
Change-Id: I0e65d3258fd3d23ebff793ae04d59e027eb51fba
2021-03-01 22:12:05 +01:00
Petr Pchelko
4d8dc6b992 Use ActorStore in RevisionStore
Bug: T273290
Change-Id: Iff9b67455d337ea03cb728dd570c4ce760c39e49
2021-02-10 14:37:54 -06:00
Petr Pchelko
1398a72999 Reorder arguments in ActorStore::newActorFromRowFields
The order $userId, $name, $actorId is more consistent
with existing order of arguments in UIV constructor,
User::newFromAnyId etc. Even though it's not as logical
as placing the primary key argument first, it's more practical.

Change-Id: Ic36c0ee451cf6825976e374f0c2f721085c0a507
2021-02-09 08:46:24 -06:00
Petr Pchelko
8d2c674ab0 Introduce ActorStore, ActorLookup and ActorFactory.
The ActorNormalization factory methods create
UserIdentityValue from the database rows, either via
fields of a joined table, or via a row from actor table.
They assume that the actor_id exist and throw othervise.

ActorNormalization is a storage-layer service providing
access to finding and acquiring actor_id.

The UserIdentityLookup methods do not instantiate new actor
on demand, they just find an appropriate row in the actor
table and return the result.

Bug: T272689
Depends-On: I74d81f3f0233efb17fc8df5178e4c477cc669c6f
Change-Id: Icfa1daca960c696a8cef8adab5eab53985802858
2021-02-08 10:06:46 -06:00