-
Notifications
You must be signed in to change notification settings - Fork 96
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
Shared-state mesh information packages async implmentation and reference state #1112
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments.
Also please double check reference state data folder is persisted across firmware ugrades. The behaviour should be that it get lost if sysupgrade -n
is used while it should be kept if plain sysupgrade
is used. AFAIR file or folders that need to be kept accross upgrades need to be added in a list somewhere. Same goes for safe-upgrade
.
uci set shared-state.babel_links_info=dataType | ||
uci set shared-state.babel_links_info.name='babel_links_info' | ||
uci set shared-state.babel_links_info.scope='community' | ||
uci set shared-state.babel_links_info.ttl='2400' | ||
uci set shared-state.babel_links_info.update_interval='30' | ||
uci commit shared-state | ||
|
||
## Refference state data type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sobra una f ;-)
@@ -0,0 +1 @@ | |||
"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an empty JSON file by default? In that case is more traditional to use an empty object {}
instead of an empty string ;-) also we could use .json
extension to make things more explicit, if it doesn't make things much more complex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes ! that was the first attempt, but when jsonc parses the text and then transforms it back to text, it creates an empty array, not an empty json object. For me it can be a bug. ..
JSON = require("luci.jsonc")
print(JSON.stringify(JSON.parse("{}")))
[]
the documentation states that "Lua tables are converted into JSON arrays if they only contain integer keys, mixed tables are turned into JSON objects with any existing numeric keys converted into strings."
@@ -0,0 +1 @@ | |||
"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as packages/shared-state-babel_links_info/files/etc/shared-state/ref_state/babel_links_info_ref
uci set shared-state.bat_links_info=dataType | ||
uci set shared-state.bat_links_info.name='bat_links_info' | ||
uci set shared-state.bat_links_info.scope='community' | ||
uci set shared-state.bat_links_info.ttl='2400' | ||
uci set shared-state.bat_links_info.update_interval='30' | ||
uci commit shared-state | ||
|
||
## Refference state data type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sobra una f aqui tambien ;-)
@@ -0,0 +1 @@ | |||
"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as packages/shared-state-babel_links_info/files/etc/shared-state/ref_state/babel_links_info_ref
uci set shared-state.node_info_ref.name='node_info_ref' | ||
uci set shared-state.node_info_ref.scope='community' | ||
uci set shared-state.node_info_ref.ttl='2400' | ||
uci set shared-state.node_info_ref.update_interval='50' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a new line at the end of the file
uci set shared-state.node_info.update_interval='33' | ||
uci commit shared-state | ||
|
||
## Refference state data type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sobra una f ;-)
@@ -0,0 +1 @@ | |||
"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as packages/shared-state-babel_links_info/files/etc/shared-state/ref_state/babel_links_info_ref
uci set shared-state.wifi_links_info_ref.name='wifi_links_info_ref' | ||
uci set shared-state.wifi_links_info_ref.scope='community' | ||
uci set shared-state.wifi_links_info_ref.ttl='2400' | ||
uci set shared-state.wifi_links_info_ref.update_interval='50' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new line missing
yesss ! the reference state is not kept across upgrades. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments
@@ -4,10 +4,17 @@ unique_append() | |||
{ | |||
grep -qF "$1" "$2" || echo "$1" >> "$2" | |||
} | |||
|
|||
## information generator datatype | |||
uci set shared-state.bat_links_info=dataType | |||
uci set shared-state.bat_links_info.name='bat_links_info' | |||
uci set shared-state.bat_links_info.scope='community' | |||
uci set shared-state.bat_links_info.ttl='2400' | |||
uci set shared-state.bat_links_info.update_interval='30' | |||
uci commit shared-state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line needs to be moved after the last uci set
at line 20 otherwise reference state configurations are not guaranteed to be persisted across reboot
uci set shared-state.node_info_ref.name='node_info_ref' | ||
uci set shared-state.node_info_ref.scope='community' | ||
uci set shared-state.node_info_ref.ttl='2400' | ||
uci set shared-state.node_info_ref.update_interval='50' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uci commit shared-state
must be moved here
|
||
Reference state is designed to contain information about the node that will | ||
persist and that is not changed to often. This is because it is stored in the | ||
device memory and to many consequent write operations may damage the memory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sed 's/memory/persistent memory/g'
persist and that is not changed to often. This is because it is stored in the | ||
device memory and to many consequent write operations may damage the memory. | ||
|
||
One thing that is important to note is that no node stores the hole status of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hole/whole
#!/usr/bin/lua | ||
|
||
--! LibreMesh | ||
--! Will publish all refference data_type at once |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refference/reference
packages/shared-state-wifi_links_info/files/etc/uci-defaults/shared-state_wifi_links_info
Show resolved
Hide resolved
fc5370e
to
b19b1ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See inline comments
@@ -1,9 +1,21 @@ | |||
#!/bin/sh | |||
|
|||
unique_append() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used anymore should be removed, also the script should be renamed ;)
@@ -4,11 +4,17 @@ unique_append() | |||
grep -qF "$1" "$2" || echo "$1" >> "$2" | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used anymore should be removed ;)
@@ -4,10 +4,18 @@ unique_append() | |||
{ | |||
grep -qF "$1" "$2" || echo "$1" >> "$2" | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used anymore should be removed, also the script should be renamed ;)
uci set lime-defaults.system.keep_on_upgrade="$(uci get lime-defaults.system.keep_on_upgrade) shared-state-ref-state" | ||
uci commit lime-defaults | ||
touch /tmp/done | ||
exit 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing line at the end of the file
@@ -1,9 +1,21 @@ | |||
#!/bin/sh | |||
|
|||
unique_append() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is not used anymore should be removed ;)
No description provided.