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

Shrared state ubus #1040

Merged
merged 5 commits into from
Aug 17, 2023
Merged

Shrared state ubus #1040

merged 5 commits into from
Aug 17, 2023

Conversation

javierbrk
Copy link
Collaborator

@javierbrk javierbrk commented Aug 10, 2023

This pull request provides access to shared-state infrastructure for the UI.
It is intended to be used to retrieve actual state and record global network state into shared state infrastructure.

The upgrade provides three methods witch can be used to get information from existing shared state modules like "wifi_links_info".

get the list of available methods using

ubus -v list shared-state

then use them like in the example below

ubus -S call shared-state getFromSharedState '{"data_type": "wifi_links_info" }'

It can also be used to record and retrieve information across the whole network

ubus -S call shared-state insertIntoSharedStateMultiWriter '{"data_type": "ref_state_wifi_links", "json": {"primero":{"bleachTTL":27}}}'
ubus -S call shared-state getFromSharedStateMultiWriter '{"data_type": "ref_state_wifi_links"}'

to get the info in another node the others need to sync on the same topic

shared-state-multiwriter sync ref_state_wifi_links
ubus -S call shared-state getFromSharedStateMultiWriter '{"data_type": "ref_state_wifi_links" }'

in conclusion the ui cant create new data types. We need to add them first as a module in every node.

@javierbrk javierbrk added this to the mesh-wide milestone Aug 10, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #1040 (255d004) into master (bf158a1) will increase coverage by 0.45%.
Report is 33 commits behind head on master.
The diff coverage is 100.00%.

❗ Current head 255d004 differs from pull request most recent head 9cc5abf. Consider uploading reports for the commit 9cc5abf to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #1040      +/-   ##
==========================================
+ Coverage   79.27%   79.72%   +0.45%     
==========================================
  Files          53       53              
  Lines        4444     4523      +79     
==========================================
+ Hits         3523     3606      +83     
+ Misses        921      917       -4     
Files Changed Coverage Δ
...ges/lime-system/files/usr/lib/lua/lime/network.lua 78.39% <100.00%> (+0.20%) ⬆️
tests/fakes/iwinfo.lua 98.13% <100.00%> (+1.02%) ⬆️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@javierajorge
Copy link
Contributor

Output data should not include shared state info, I'll remove extra information

Copy link
Member

@G10h4ck G10h4ck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comments

utils.printJson(resultTable)
end

local function get_from_sharedState_muti_writer(msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sed -i s/muti_writer/multi_writer/g ;-)
also better not mixing up underscore (python like) and camel case, either keep _ o camel case but not both ;)

@G10h4ck G10h4ck merged commit 24ae02f into libremesh:master Aug 17, 2023
1 check passed
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.

None yet

4 participants