Page MenuHomePhabricator

[identity] Add function to add new device to the list
ClosedPublic

Authored by bartek on Dec 7 2023, 12:35 AM.
Tags
None
Referenced Files
F2147578: D10220.id34505.diff
Sun, Jun 30, 2:21 AM
Unknown Object (File)
Thu, Jun 27, 10:22 PM
Unknown Object (File)
Wed, Jun 26, 5:45 PM
Unknown Object (File)
Wed, Jun 26, 2:53 PM
Unknown Object (File)
Tue, Jun 25, 12:53 PM
Unknown Object (File)
Tue, Jun 25, 12:53 PM
Unknown Object (File)
Tue, Jun 25, 12:53 PM
Unknown Object (File)
Tue, Jun 25, 12:53 PM
Subscribers

Details

Summary

Added a function that transactionally adds a new device to the device list and generate a new devicelist version. Details in D10219 where I used simplified version of this diff as a test plan.

Depends on D10219

Test Plan

Actually this function is extended version of the function in D10219 test plan. Test plans overlap, I just tested one more scenario:

  • Called this function twice - first one succeeded, second one failed with error message "Device already exists"

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bartek held this revision as a draft.
bartek published this revision for review.Dec 7 2023, 1:07 AM
bartek added inline comments.
services/identity/src/database/device_list.rs
73–74 ↗(On Diff #34370)

Both DeviceTypes refer the same enum in proto, but one is in the grpc_clients crate (client-specific) while the other is in Identity directly. They're exactly the same but to the compiler they are different structs.
Decided to panic here because this happens only when the crate is badly compiled.

Move function into impl DatabaseClient.

This revision is now accepted and ready to land.Dec 13 2023, 6:07 PM