Skip to content

Commit

Permalink
Merge store into store-trait-internal
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Aug 28, 2024
2 parents 6b896bb + b8a87ad commit 55b3b5d
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 70 deletions.
36 changes: 36 additions & 0 deletions data-model/src/lengthy_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ where
pub fn available(&self) -> u64 {
self.available
}

/// Turn this into a regular [`Entry`].
pub fn into_entry(self) -> Entry<MCL, MCC, MPL, N, S, PD> {
self.entry
}
}

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>
AsRef<Entry<MCL, MCC, MPL, N, S, PD>> for LengthyEntry<MCL, MCC, MPL, N, S, PD>
where
N: NamespaceId,
S: SubspaceId,
PD: PayloadDigest,
{
fn as_ref(&self) -> &Entry<MCL, MCC, MPL, N, S, PD> {
&self.entry
}
}

/// An [`AuthorisedEntry`] together with information about how much of its payload a given [`Store`] holds.
Expand Down Expand Up @@ -81,4 +98,23 @@ where
pub fn available(&self) -> u64 {
self.available
}

/// Turn this into a [`AuthorisedEntry`].
pub fn into_authorised_entry(self) -> AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
self.entry
}
}

impl<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD, AT>
AsRef<AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>>
for LengthyAuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT>
where
N: NamespaceId,
S: SubspaceId,
PD: PayloadDigest,
AT: AuthorisationToken<MCL, MCC, MPL, N, S, PD>,
{
fn as_ref(&self) -> &AuthorisedEntry<MCL, MCC, MPL, N, S, PD, AT> {
&self.entry
}
}
Loading

0 comments on commit 55b3b5d

Please sign in to comment.