-
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
re-implement shared-state from scratch in modern C++ #1067
Conversation
1598b10
to
484f7bb
Compare
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #1067 +/- ##
==========================================
- Coverage 79.69% 79.55% -0.14%
==========================================
Files 53 53
Lines 4550 4549 -1
==========================================
- Hits 3626 3619 -7
- Misses 924 930 +6 ☔ View full report in Codecov by Sentry. |
-- local utils = require('lime.utils') | ||
-- local test_utils = require('tests.utils') | ||
-- local shared_state = require('shared-state') | ||
-- | ||
-- it('test get_bathost #bathost', function() | ||
-- shared_state.DATA_DIR = test_utils.setup_test_dir() | ||
-- local sharedState = shared_state.SharedState:new('bat-hosts') | ||
-- sharedState:insert({ | ||
-- ["02:95:39:ab:cd:00"] = "LiMe_abcd00_wlan1_mesh", | ||
-- ["52:00:00:ab:cd:a0"] = "LiMe_abcd01_wlan2_mesh_17", | ||
-- ["d6:67:58:8e:cd:92"] = "LiMe_abcd02_wlan0_adhoc_29", | ||
-- ["12:00:00:00:00:00"] = "LiMe_abcd03_wlan1_adhoc" | ||
-- }) | ||
-- local ifaces = {'wlan1-mesh', 'wlan2-mesh', 'wlan2-mesh_17', 'wlan0-adhoc_29', 'wlan1-adhoc'} | ||
-- stub(utils, "get_ifnames", function () return ifaces end) | ||
-- assert.is.same({hostname='LiMe-abcd00', iface='wlan1-mesh'}, bat_hosts.get_bathost('02:95:39:ab:cd:00')) | ||
-- assert.is.same({hostname='LiMe-abcd01', iface='wlan2-mesh_17'}, bat_hosts.get_bathost('52:00:00:ab:cd:a0')) | ||
-- assert.is.same({hostname='LiMe-abcd02', iface='wlan0-adhoc_29'}, bat_hosts.get_bathost('d6:67:58:8e:cd:92')) | ||
-- assert.is.same({hostname='LiMe-abcd03', iface='wlan1-adhoc'}, bat_hosts.get_bathost('12:00:00:00:00:00')) | ||
-- local ipv6ll = utils.mac2ipv6linklocal('52:00:00:ab:cd:00') .. '%wlan1-mesh' | ||
-- local dataTypeOfSync = nil | ||
-- local urlsOfSync = nil | ||
-- local function syncMock (self, urls) | ||
-- dataTypeOfSync = self.dataType | ||
-- urlsOfSync = urls | ||
-- self:insert({['52:00:00:ab:cd:00'] = "Lime_abcd04_wlan1_mesh"}) | ||
-- end | ||
-- stub(shared_state.SharedState, "sync", syncMock) | ||
-- local bathost = bat_hosts.get_bathost('52:00:00:ab:cd:00', 'wlan1-mesh') | ||
-- assert.is.same(urlsOfSync, { ipv6ll }) | ||
-- assert.is.equal(dataTypeOfSync, 'bat-hosts') | ||
-- assert.is.same({hostname='Lime-abcd04', iface='wlan1-mesh'}, bathost) | ||
-- assert.is_nil(bat_hosts.get_bathost('00:aa:bb:cc:dd:00', 'wlan1')) | ||
-- assert.is_nil(bat_hosts.get_bathost('00:aa:bb:cc:dd:00')) | ||
-- end) |
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.
Commented code. Should this tests work?
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.
nope, because it relies on Lua 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.
Excellent, this is the first step, with the example provided porting of other modules should be trivial.
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.
...
Add a new packages repository at: - http://github.com/libremesh/lime-feed/tree/gh-pages/master/packages/$ARCH_PACKAGES - http://feed.libremesh.org/master/packages/$ARCH_PACKAGES That includes packages precompiled by openwrt-sdk for each specific architecture This is currently required only for the package 'shared-state-async' After this merge libremesh#1067 imagebuilder builds fail, using the default set of packages, unless you are building for x86_64 update the imagebuilder build guide on README.md update lime-system/files/etc/uci-defaults/92_add-lime-repos to use also the new repo
Add a new packages repository at: - http://github.com/libremesh/lime-feed/tree/gh-pages/master/packages/$ARCH_PACKAGES - http://feed.libremesh.org/master/packages/$ARCH_PACKAGES That includes packages precompiled by openwrt-sdk for each specific architecture This is currently required only for the package 'shared-state-async' After this merge libremesh#1067 imagebuilder builds fail, using the default set of packages, unless you are building for x86_64 update the imagebuilder build guide on README.md update lime-system/files/etc/uci-defaults/92_add-lime-repos to use also the new repo
Add shared-state-async package with almost complete shared-state modern C++ re-implementation, peer discovery is the only things that haven't been implemented yet in C++ and rely still on the shell script copied directly at compile time from the Lua shared-state package.
To show how to port the shared-state plugins to the new implementation also bat-hosts have been ported to the new implementation.