Page MenuHomePhabricator

[services] Tunnelbroker - Update on using of `init` in Rust notifications library
AbandonedPublic

Authored by max on Oct 10 2022, 7:15 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 25, 5:18 PM
Unknown Object (File)
Fri, Oct 25, 5:18 PM
Unknown Object (File)
Fri, Oct 25, 5:17 PM
Unknown Object (File)
Fri, Oct 25, 5:03 PM
Unknown Object (File)
Oct 6 2024, 4:40 AM
Unknown Object (File)
Oct 6 2024, 3:56 AM
Unknown Object (File)
Sep 26 2024, 9:28 PM
Unknown Object (File)
Sep 9 2024, 7:33 PM

Details

Summary

This diff introduces changes for using the init and a global configuration struct from D5329.
Instead of providing a certificate, fcm key for every function call we can initialize it once the service starts.

The function and struct are introduced in D5329.

Related Linear task: ENG-1737

Test Plan

Service is successfully built, and notifications are successfully sent.

Diff Detail

Repository
rCOMM Comm
Branch
notiflib-update-useof-init
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

max held this revision as a draft.
jon requested changes to this revision.Oct 10 2022, 1:24 PM
jon added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
80–91 ↗(On Diff #17450)

we only need to read it once, and we should avoid vanilla panics

This revision now requires changes to proceed.Oct 10 2022, 1:24 PM
max added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
80–91 ↗(On Diff #17450)

we only need to read it once, and we should avoid vanilla panics

Makes sense, fixed. Thanks, @jon !

LGTM, feel like @tomek should take a look

tomek requested changes to this revision.Oct 13 2022, 7:39 AM
tomek added inline comments.
services/tunnelbroker/rust-lib/src/lib.rs
79–93

Using global variables isn't a good idea. We should use more object-oriented approach, where we have a struct with config fields and methods that use these fields. Is it possible to have something like this?

This revision now requires changes to proceed.Oct 13 2022, 7:39 AM
max marked an inline comment as done.
max marked an inline comment as done.

This diff is abandoned in a favor of D5641 and D5642.

services/tunnelbroker/rust-lib/src/lib.rs
79–93

Using global variables isn't a good idea. We should use more object-oriented approach, where we have a struct with config fields and methods that use these fields. Is it possible to have something like this?

This diff is abandoned in a favor of D5641 and D5642. The comment in D5329 is related to this question. The approach was changed to use a lazy static in D5641.