mod budget;
mod link;
mod numbered;
mod offset;
mod opaque;
pub use budget::{
MAX_SNAPSHOT_ID_BYTES, PaginationBudget, PaginationLimits, PaginationProgress, SnapshotId,
SnapshotPolicy,
};
pub use link::{ProviderLinkBinding, ProviderLinkExecutionError, ValidatedProviderLink};
pub use numbered::{NumberedPageBoundary, NumberedPageMetadata, NumberedPagination, PageNumber};
pub use offset::{OffsetPageBoundary, OffsetPageMetadata, OffsetPagination};
pub use opaque::{
CursorDigest, CursorHistory, MAX_OPAQUE_STATE_BYTES, PaginationCursor, PaginationMarker,
};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PaginationError {
ZeroLimit,
StateLimitTooLarge,
PageZero,
PageSizeZero,
InvalidPreviousPage,
InvalidNextPage,
InvalidLastPage,
UnexpectedPosition,
EmptyPageWithContinuation,
InvalidEntryCount,
PageSizeChanged,
TraversalChanged,
RequestBudgetExceeded,
ItemBudgetExceeded,
SnapshotRequired,
SnapshotIdEmpty,
SnapshotIdTooLong,
SnapshotForbidden,
SnapshotChanged,
Complete,
MissingState,
StateTooLong,
OutputTooSmall,
HistoryBudgetExceeded,
CursorCycle,
CursorDigestCollision,
CursorDigestChanged,
InvalidProviderLink,
ProviderLinkSchemeChanged,
ProviderLinkAuthorityChanged,
ProviderLinkUserinfo,
ProviderLinkFragment,
ProviderLinkPathChanged,
ProviderLinkMethodChanged,
ProviderLinkOperationChanged,
}
impl_static_error!(PaginationError,
Self::ZeroLimit => "pagination limits must be nonzero",
Self::StateLimitTooLarge => "opaque pagination state limit exceeds the hard limit",
Self::PageZero => "page number must be nonzero",
Self::PageSizeZero => "page size must be nonzero",
Self::InvalidPreviousPage => "previous-page metadata is invalid",
Self::InvalidNextPage => "next-page metadata is invalid",
Self::InvalidLastPage => "last-page metadata is invalid",
Self::UnexpectedPosition => "response position differs from the requested position",
Self::EmptyPageWithContinuation => "nonterminal response page is empty",
Self::InvalidEntryCount => "response entry count is invalid",
Self::PageSizeChanged => "response page size changed during traversal",
Self::TraversalChanged => "pagination metadata changed during traversal",
Self::RequestBudgetExceeded => "pagination request budget was exceeded",
Self::ItemBudgetExceeded => "pagination item budget was exceeded",
Self::SnapshotRequired => "provider snapshot identifier is required",
Self::SnapshotIdEmpty => "provider snapshot identifier is empty",
Self::SnapshotIdTooLong => "provider snapshot identifier exceeds the length limit",
Self::SnapshotForbidden => "provider snapshot identifier is forbidden",
Self::SnapshotChanged => "provider snapshot identifier changed during traversal",
Self::Complete => "pagination traversal is complete",
Self::MissingState => "opaque pagination state is missing",
Self::StateTooLong => "opaque pagination state exceeds the selected limit",
Self::OutputTooSmall => "pagination state output is too small",
Self::HistoryBudgetExceeded => "cursor history budget was exceeded",
Self::CursorCycle => "pagination cursor cycle was detected",
Self::CursorDigestCollision => "pagination cursor digest collision was detected",
Self::CursorDigestChanged => "pagination cursor digest changed for the same state",
Self::InvalidProviderLink => "provider pagination link is invalid",
Self::ProviderLinkSchemeChanged => "provider pagination link changed scheme",
Self::ProviderLinkAuthorityChanged => "provider pagination link changed authority",
Self::ProviderLinkUserinfo => "provider pagination link contains user information",
Self::ProviderLinkFragment => "provider pagination link contains a fragment",
Self::ProviderLinkPathChanged => "provider pagination link changed operation path",
Self::ProviderLinkMethodChanged => "provider pagination link changed HTTP method",
Self::ProviderLinkOperationChanged => "provider pagination link changed operation",
);
#[cfg(test)]
mod tests;