s.stop().get();
}
+class peering_counter : public peering_sharded_service<peering_counter> {
+public:
+ future<int> count() const {
+ return container().map_reduce(adder<int>(), [] (auto& pc) { return 1; });
+ }
+
+ future<int> count_from(int base) const {
+ return container().map_reduce0([] (auto& pc) { return 1; }, base, std::plus<int>());
+ }
+};
+
+SEASTAR_THREAD_TEST_CASE(test_const_map_reduces) {
+ sharded<peering_counter> c;
+ c.start().get();
+
+ BOOST_REQUIRE_EQUAL(c.local().count().get0(), smp::count);
+ BOOST_REQUIRE_EQUAL(c.local().count_from(1).get0(), smp::count + 1);
+
+ c.stop().get();
+}
+
class mydata {
public:
int x = 1;