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)
Wed, Jul 3, 7:13 PM
Unknown Object (File)
Wed, Jul 3, 7:04 PM
Unknown Object (File)
Wed, Jul 3, 1:44 PM
Unknown Object (File)
Wed, Jul 3, 8:58 AM
Unknown Object (File)
Tue, Jul 2, 10:53 AM
Unknown Object (File)
Thu, Jun 27, 1:01 AM
Unknown Object (File)
Sat, Jun 22, 4:12 AM
Unknown Object (File)
Sat, Jun 22, 4:12 AM

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.