Skip to content

Commit

Permalink
Slightly refactor public group storage interface (openmls#1649)
Browse files Browse the repository at this point in the history
* make function naming consistent in PublicStorage

* refactor and make PublicGroup::delete public
  • Loading branch information
kkohbrok authored Aug 29, 2024
1 parent 066eace commit 9f1d5cf
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion openmls/src/group/core_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ impl CoreGroup {
&self,
storage: &Storage,
) -> Result<(), Storage::Error> {
self.public_group.delete(storage)?;
PublicGroup::delete(self.group_id(), storage)?;
storage.delete_own_leaf_index(self.group_id())?;
storage.delete_group_epoch_secrets(self.group_id())?;
storage.delete_message_secrets(self.group_id())?;
Expand Down
14 changes: 7 additions & 7 deletions openmls/src/group/public_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,14 @@ impl PublicGroup {
}

/// Deletes the [`PublicGroup`] from storage.
pub(crate) fn delete<Storage: PublicStorageProvider>(
&self,
pub fn delete<Storage: PublicStorageProvider>(
group_id: &GroupId,
storage: &Storage,
) -> Result<(), Storage::PublicError> {
storage.delete_tree(self.group_id())?;
storage.delete_confirmation_tag(self.group_id())?;
storage.delete_context(self.group_id())?;
storage.delete_interim_transcript_hash(self.group_id())?;
storage.delete_tree(group_id)?;
storage.delete_confirmation_tag(group_id)?;
storage.delete_context(group_id)?;
storage.delete_interim_transcript_hash(group_id)?;

Ok(())
}
Expand All @@ -413,7 +413,7 @@ impl PublicGroup {
storage: &Storage,
group_id: &GroupId,
) -> Result<Option<Self>, Storage::PublicError> {
let treesync = storage.treesync(group_id)?;
let treesync = storage.tree(group_id)?;
let proposals: Vec<(ProposalRef, QueuedProposal)> = storage.queued_proposals(group_id)?;
let group_context = storage.group_context(group_id)?;
let interim_transcript_hash: Option<InterimTranscriptHash> =
Expand Down
4 changes: 2 additions & 2 deletions traits/src/public_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub trait PublicStorageProvider<const VERSION: u16> {
) -> Result<Vec<(ProposalRef, QueuedProposal)>, Self::PublicError>;

/// Returns the TreeSync tree for the group with group id `group_id`.
fn treesync<
fn tree<
GroupId: crate::storage::traits::GroupId<VERSION>,
TreeSync: crate::storage::traits::TreeSync<VERSION>,
>(
Expand Down Expand Up @@ -233,7 +233,7 @@ where
<Self as StorageProvider<VERSION>>::queued_proposals(self, group_id)
}

fn treesync<
fn tree<
GroupId: crate::storage::traits::GroupId<VERSION>,
TreeSync: crate::storage::traits::TreeSync<VERSION>,
>(
Expand Down

0 comments on commit 9f1d5cf

Please sign in to comment.