Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile Config filter Boosted Hexes #801

Conversation

michaeldjeffrey
Copy link
Contributor

This PR builds on top of #798.

Expired Boosted Hexes are filtered when streaming from the DB so Clients don't have to know to ignore Boosted Hexes that should no longer apply.

Because mobile-config will no longer return expired boosted hexes, the BoostedHexes struct will also enforce that limitation in tests where it is used directly.

@michaeldjeffrey michaeldjeffrey force-pushed the mj/hip-109-boost-by-device-type branch 3 times, most recently from cd41f6c to cbf911e Compare May 6, 2024 18:22
@michaeldjeffrey michaeldjeffrey force-pushed the mj/mobile-config-filter-boosted-hexes branch from 703e94a to 90480d1 Compare May 6, 2024 18:39
@michaeldjeffrey michaeldjeffrey force-pushed the mj/hip-109-boost-by-device-type branch from cbf911e to af92443 Compare May 6, 2024 21:10
mobile_config/src/boosted_hex_info.rs Outdated Show resolved Hide resolved
mobile_config/src/boosted_hex_info.rs Outdated Show resolved Hide resolved
mobile_config/src/boosted_hex_info.rs Outdated Show resolved Hide resolved
@michaeldjeffrey michaeldjeffrey force-pushed the mj/mobile-config-filter-boosted-hexes branch from 90480d1 to 62c89f5 Compare May 7, 2024 18:11
Making the internal member hexes private will make it easier to change
the implementation when device type is introduced.
also makes it easier to add new tests
Thanks for the query help Brian!

By precomputing the end timestamp of a boosted hex, we can not have to
stream all the hexes out of the db just to throw them away.
- remove unused imports
- remove old refactor return types
If the expired check had been made a global check, the ability to use
BoostedHexes for modified hexes would have broken at runtime.

The attempt here is to make very explicit during testing how to meet the
same contract as the database queries for boosted hexes. I think there
are still some cracks, but we can narrow in on those as we find them.
For now, I think naming test constructor functions is a good start.
@michaeldjeffrey michaeldjeffrey force-pushed the mj/mobile-config-filter-boosted-hexes branch from 62c89f5 to 66b36d8 Compare May 7, 2024 21:03
@michaeldjeffrey michaeldjeffrey marked this pull request as ready for review May 8, 2024 17:20
@michaeldjeffrey michaeldjeffrey merged commit c9e98cb into mj/hip-109-boost-by-device-type May 8, 2024
@michaeldjeffrey michaeldjeffrey deleted the mj/mobile-config-filter-boosted-hexes branch May 8, 2024 17:21
michaeldjeffrey added a commit that referenced this pull request Sep 6, 2024
* Refactor to use BoostedHexes methods

Making the internal member hexes private will make it easier to change
the implementation when device type is introduced.

* Add device type to boosted hex info

* refactor metadata_db tests to make test clearer

also makes it easier to add new tests

* remove expired boosted hexes when streaming from db

* ensure no tests are written with expired boosted hexes

* optimize by computing end_ts in db query

Thanks for the query help Brian!

By precomputing the end timestamp of a boosted hex, we can not have to
stream all the hexes out of the db just to throw them away.

* fixup after rebase

- remove unused imports
- remove old refactor return types

* make boosted hex test function more explicit

If the expired check had been made a global check, the ability to use
BoostedHexes for modified hexes would have broken at runtime.

The attempt here is to make very explicit during testing how to meet the
same contract as the database queries for boosted hexes. I think there
are still some cracks, but we can narrow in on those as we find them.
For now, I think naming test constructor functions is a good start.
michaeldjeffrey added a commit that referenced this pull request Sep 6, 2024
* Refactor to use BoostedHexes methods

Making the internal member hexes private will make it easier to change
the implementation when device type is introduced.

* Add device type to boosted hex info

* refactor metadata_db tests to make test clearer

also makes it easier to add new tests

* remove expired boosted hexes when streaming from db

* ensure no tests are written with expired boosted hexes

* optimize by computing end_ts in db query

Thanks for the query help Brian!

By precomputing the end timestamp of a boosted hex, we can not have to
stream all the hexes out of the db just to throw them away.

* fixup after rebase

- remove unused imports
- remove old refactor return types

* make boosted hex test function more explicit

If the expired check had been made a global check, the ability to use
BoostedHexes for modified hexes would have broken at runtime.

The attempt here is to make very explicit during testing how to meet the
same contract as the database queries for boosted hexes. I think there
are still some cracks, but we can narrow in on those as we find them.
For now, I think naming test constructor functions is a good start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants