pub struct KeyPage { /* private fields */ }Expand description
One bounded page, validated against the request that produced it. Records
and revision describe the same committed source read. next_after exists
only when lookahead found another active record; an exactly full final page
is terminal. Revisions advance on every mutation that can change the feed.
Implementations§
Source§impl KeyPage
impl KeyPage
Sourcepub fn try_new(
revision: u64,
as_of: Timestamp,
after: Option<KeyId>,
limit: NonZeroUsize,
keys: Vec<CredentialRecord>,
next_after: Option<KeyId>,
) -> Result<Self, StoreError>
pub fn try_new( revision: u64, as_of: Timestamp, after: Option<KeyId>, limit: NonZeroUsize, keys: Vec<CredentialRecord>, next_after: Option<KeyId>, ) -> Result<Self, StoreError>
Validate one page against the request (after, limit) that produced it.
as_of is the instant the source selected active records at.
§Errors
A StoreError when limit exceeds MAX_KEY_PAGE_LIMIT; revision
exceeds MAX_KEY_REVISION; there are more than limit records; key ids do
not strictly increase from after; a record’s not_after is at or before
as_of; next_after is present on a page that is not full or does not name
its last record; or the records fail CredentialSet::try_new.
Sourcepub fn validate_request(
&self,
after: Option<KeyId>,
limit: NonZeroUsize,
) -> Result<(), StoreError>
pub fn validate_request( &self, after: Option<KeyId>, limit: NonZeroUsize, ) -> Result<(), StoreError>
Check that this page answers the request (after, limit).
§Errors
A StoreError when either differs from the request the page was built for.
Sourcepub fn records(&self) -> &[CredentialRecord]
pub fn records(&self) -> &[CredentialRecord]
The page’s records, in strictly increasing key-id order.
Sourcepub fn next_after(&self) -> Option<KeyId>
pub fn next_after(&self) -> Option<KeyId>
The cursor for the next page, which is this page’s last key id, or None
when the page is terminal.
Sourcepub fn into_records(self) -> Vec<CredentialRecord>
pub fn into_records(self) -> Vec<CredentialRecord>
Consume the page, returning its records.