graph_channels read from memory instead of from DB#879
graph_channels read from memory instead of from DB#879jjyr wants to merge 4 commits intonervosnetwork:developfrom
Conversation
| .map(|node| JsonBytes::from_vec(node.cursor().to_bytes().into())) | ||
| .unwrap_or_default(); | ||
| let channels = network_graph.get_channels_with_params(limit, after); | ||
| let last_cursor = JsonBytes::from_vec( |
There was a problem hiding this comment.
prefer to use page and per_page as parameters.
There was a problem hiding this comment.
The param is still exposed as last_cursor for the external RPC, so even we change to network_graph.get_channels_with_params(per_page, page * per_page); the extern user feels no difference, and some unneccesary complexity is introduced: need to encode two (page, per_page) instead of one param (after) into last_cursor.
|
and to resolve #534, |
|
please do similar refactoring for |
The tricky part is we need to track private_channels_count or public_channels_count, since graph_channels interface only return public channels, updated in the commits |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #879 +/- ##
=======================================
Coverage 0.00% 0.00%
=======================================
Files 61 61
Lines 38148 38144 -4
=======================================
+ Misses 38148 38144 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
64f7d1d to
b44759c
Compare
Drawback:Since our paginate based on return count, the query result may contains duplicates or missing for multiple pages. It is acceptable since graph_channels is mainly used for statistics, one way to workaround this problems is to set limit large enough to return all channels in once.Also fixes #534
Updated the new commit use BTreeMap to store graph channels and nodes avoid the paginate drawback