generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Problem:
We want to remove the GroupStateStorage
trait in favor of application managing storage. This is a possible alternative to #211.
Solution:
A group member will use the following code to process a proposal_message
and a commit_message
that includes proposal_message
by reference.
// Receive proposal
let ProtocolMessage {
group_id: &'a [u8],
epoch_id: u64,
content_type: ContentType::Proposal,
} = proposal_message.description()
else {
// Do something else
};
let epoch = my_storage.load_epoch(group_id, epoch_id)?;
// Decrypt and verify auth of proposal
let proposal: Proposal = client.process_proposal(&epoch, proposal_message)?;
// Receive commit
let ProtocolMessage {
content_type: ContentType::Commit,
..
} = commit_message.description()
else {
// Do something else
};
// Currently `new_epoch_builder` would be `commit_processor`
let commit_effect = client
.new_epoch_builder(epoch, commit_message)?
.with_proposal(proposal)
.with_psk(my_storage.load_psk(builder.required_psks()[0])?)
.override_proposals(my_proposal_rules(builder.proposals())?)
.build()?;
// Delete epoch for that group. Store updated epoch and past epoch for late application messages
my_storage.store_epoch(commit_effect.new_epoch, commit_effect.past_epoch)?;
where
CommitEffect {
epoch: Option<GroupState>, // None if we're removed
past_epoch: PastEpoch,
// other info
}
Metadata
Metadata
Assignees
Labels
No labels