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

Add experimental KV type wrapper #1216

Merged
merged 39 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d8c2675
Structure for experimental kv replacement, tested
eddyashton May 20, 2020
b0def14
Correct test, get as far as a failure
eddyashton May 20, 2020
dd59eae
Baby steps
eddyashton May 20, 2020
18d9262
Separate ChangeSet container from TxView functionality
eddyashton May 20, 2020
8f33cf3
Exploratory hacking
eddyashton May 20, 2020
3c706e0
Unpick some bugs
eddyashton May 20, 2020
8e837d4
Update TODOs
eddyashton May 20, 2020
34a473e
Typesawhoopsy
eddyashton May 21, 2020
33fbc70
Re-enable tests of experimental API
eddyashton May 21, 2020
a13a29e
Make the serialiser pluggable, test passes!?!!
eddyashton May 21, 2020
d8b41c2
Expand foreach tests
eddyashton May 21, 2020
3b238bc
Replicate existing behaviour with a MsgPack serialiser
eddyashton May 21, 2020
e651941
Use key and value over k and v
eddyashton May 21, 2020
48c565c
Template more tests
eddyashton May 21, 2020
61205d5
Ah, inheritance doesn't work! Implement via composition
eddyashton May 21, 2020
e8f5f77
Template remaining test cases
eddyashton May 21, 2020
89177d7
Fix swap
eddyashton May 21, 2020
76a5c10
Prefer size_t
eddyashton May 21, 2020
09f2a83
First pass templating of serialisation tests
eddyashton May 21, 2020
367e509
Add comparison test, just for the sake of argument
eddyashton May 21, 2020
e53563c
Remove an unnecessary friend
eddyashton May 22, 2020
b0748f7
More templated tests, test removals in hooks
eddyashton May 22, 2020
c8f93e6
Separate k and v serialisers, add test of custom serialisers
eddyashton May 22, 2020
8e30489
More templates, fix cloning
eddyashton May 22, 2020
aca3dbd
Add exceptional serdes test on new scheme
eddyashton May 22, 2020
71a2e90
Remove some trivial TODOs
eddyashton May 22, 2020
a15a1ba
Merge branch 'master' into experimental_kv_type_wrapper
eddyashton May 22, 2020
bf349fd
Don't call get_raw_data if we have an invalid encryptor!
eddyashton May 22, 2020
7422d40
Restore early out
eddyashton May 22, 2020
ecaffcc
Remove unused states to confirm they're unused
eddyashton May 22, 2020
3199f97
Document and correct invariants on TxView types
eddyashton May 26, 2020
67716a2
Use experimental map for Scripts, as demo
eddyashton May 26, 2020
c4a8886
Remove comparison test
eddyashton May 26, 2020
02768f7
Remove State from CommitHook, construct configuration manually
eddyashton May 26, 2020
b6669bc
Remove awkward hash requirement TODOs
eddyashton May 26, 2020
ed18bdf
TODO--
eddyashton May 26, 2020
70f2c29
Minor whitespace change
eddyashton May 26, 2020
152c9f8
Merge branch 'master' into experimental_kv_type_wrapper
eddyashton May 26, 2020
1598ea7
Merge branch 'master' into experimental_kv_type_wrapper
eddyashton May 27, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/apps/logging/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,17 +283,16 @@ namespace loggingapp
.set_require_client_identity(false);
install(Procs::LOG_RECORD_RAW_TEXT, log_record_text, Write);

nwt.signatures.set_global_hook([this, &notifier](
kv::Version version,
const ccf::Signatures::State& s,
const ccf::Signatures::Write& w) {
if (w.size() > 0)
{
nlohmann::json notify_j;
notify_j["commit"] = version;
notifier.notify(jsonrpc::pack(notify_j, jsonrpc::Pack::Text));
}
});
nwt.signatures.set_global_hook(
[this,
&notifier](kv::Version version, const ccf::Signatures::Write& w) {
if (w.size() > 0)
{
nlohmann::json notify_j;
notify_j["commit"] = version;
notifier.notify(jsonrpc::pack(notify_j, jsonrpc::Pack::Text));
}
});
}
};

Expand Down
7 changes: 6 additions & 1 deletion src/consensus/pbft/pbft.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ namespace pbft

void add_configuration(
SeqNo seqno,
std::unordered_set<kv::NodeId> config,
const std::unordered_set<kv::NodeId>& config,
const NodeConf& node_conf) override
{
if (node_conf.node_id == local_id)
Expand All @@ -594,6 +594,11 @@ namespace pbft
nodes[node_conf.node_id] = 0;
}

std::unordered_set<NodeId> get_latest_configuration() const override
{
throw std::logic_error("Unimplemented");
}

void periodic(std::chrono::milliseconds elapsed) override
{
client_proxy->periodic(elapsed);
Expand Down
12 changes: 11 additions & 1 deletion src/consensus/raft/raft.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,23 @@ namespace raft
return get_term_internal(idx);
}

void add_configuration(Index idx, std::unordered_set<NodeId> conf)
void add_configuration(Index idx, const std::unordered_set<NodeId>& conf)
{
// This should only be called when the spin lock is held.
configurations.push_back({idx, move(conf)});
create_and_remove_node_state();
}

std::unordered_set<NodeId> get_latest_configuration() const
{
if (configurations.empty())
{
return {};
}

return configurations.back().nodes;
}

template <typename T>
size_t write_to_ledger(const T& data)
{
Expand Down
7 changes: 6 additions & 1 deletion src/consensus/raft/raft_consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@ namespace raft

void add_configuration(
SeqNo seqno,
std::unordered_set<NodeId> conf,
const std::unordered_set<NodeId>& conf,
const NodeConf& node_conf = {}) override
{
raft->add_configuration(seqno, conf);
}

std::unordered_set<NodeId> get_latest_configuration() const override
{
return raft->get_latest_configuration();
}

void periodic(std::chrono::milliseconds elapsed) override
{
raft->periodic(elapsed);
Expand Down
Loading