1mod budget;
4mod link;
5mod local_async;
6mod numbered;
7mod offset;
8mod opaque;
9
10pub use budget::{
11 MAX_SNAPSHOT_ID_BYTES, PaginationBudget, PaginationLimits, PaginationProgress, SnapshotId,
12 SnapshotPolicy,
13};
14pub use link::{ProviderLinkBinding, ProviderLinkExecutionError, ValidatedProviderLink};
15pub use numbered::{NumberedPageBoundary, NumberedPageMetadata, NumberedPagination, PageNumber};
16pub use offset::{OffsetPageBoundary, OffsetPageMetadata, OffsetPagination};
17pub use opaque::{
18 CursorDigest, CursorHistory, MAX_OPAQUE_STATE_BYTES, PaginationCursor, PaginationMarker,
19};
20
21#[derive(Clone, Copy, Debug, Eq, PartialEq)]
23pub enum PaginationError {
24 ZeroLimit,
26 StateLimitTooLarge,
28 PageZero,
30 PageSizeZero,
32 InvalidPreviousPage,
34 InvalidNextPage,
36 InvalidLastPage,
38 UnexpectedPosition,
40 EmptyPageWithContinuation,
42 InvalidEntryCount,
44 PageSizeChanged,
46 TraversalChanged,
48 RequestBudgetExceeded,
50 ItemBudgetExceeded,
52 SnapshotRequired,
54 SnapshotIdEmpty,
56 SnapshotIdTooLong,
58 SnapshotForbidden,
60 SnapshotChanged,
62 Complete,
64 MissingState,
66 StateTooLong,
68 OutputTooSmall,
70 HistoryBudgetExceeded,
72 CursorCycle,
74 CursorDigestCollision,
76 CursorDigestChanged,
78 InvalidProviderLink,
80 ProviderLinkSchemeChanged,
82 ProviderLinkAuthorityChanged,
84 ProviderLinkUserinfo,
86 ProviderLinkFragment,
88 ProviderLinkPathChanged,
90 ProviderLinkMethodChanged,
92 ProviderLinkOperationChanged,
94}
95
96impl_static_error!(PaginationError,
97 Self::ZeroLimit => "pagination limits must be nonzero",
98 Self::StateLimitTooLarge => "opaque pagination state limit exceeds the hard limit",
99 Self::PageZero => "page number must be nonzero",
100 Self::PageSizeZero => "page size must be nonzero",
101 Self::InvalidPreviousPage => "previous-page metadata is invalid",
102 Self::InvalidNextPage => "next-page metadata is invalid",
103 Self::InvalidLastPage => "last-page metadata is invalid",
104 Self::UnexpectedPosition => "response position differs from the requested position",
105 Self::EmptyPageWithContinuation => "nonterminal response page is empty",
106 Self::InvalidEntryCount => "response entry count is invalid",
107 Self::PageSizeChanged => "response page size changed during traversal",
108 Self::TraversalChanged => "pagination metadata changed during traversal",
109 Self::RequestBudgetExceeded => "pagination request budget was exceeded",
110 Self::ItemBudgetExceeded => "pagination item budget was exceeded",
111 Self::SnapshotRequired => "provider snapshot identifier is required",
112 Self::SnapshotIdEmpty => "provider snapshot identifier is empty",
113 Self::SnapshotIdTooLong => "provider snapshot identifier exceeds the length limit",
114 Self::SnapshotForbidden => "provider snapshot identifier is forbidden",
115 Self::SnapshotChanged => "provider snapshot identifier changed during traversal",
116 Self::Complete => "pagination traversal is complete",
117 Self::MissingState => "opaque pagination state is missing",
118 Self::StateTooLong => "opaque pagination state exceeds the selected limit",
119 Self::OutputTooSmall => "pagination state output is too small",
120 Self::HistoryBudgetExceeded => "cursor history budget was exceeded",
121 Self::CursorCycle => "pagination cursor cycle was detected",
122 Self::CursorDigestCollision => "pagination cursor digest collision was detected",
123 Self::CursorDigestChanged => "pagination cursor digest changed for the same state",
124 Self::InvalidProviderLink => "provider pagination link is invalid",
125 Self::ProviderLinkSchemeChanged => "provider pagination link changed scheme",
126 Self::ProviderLinkAuthorityChanged => "provider pagination link changed authority",
127 Self::ProviderLinkUserinfo => "provider pagination link contains user information",
128 Self::ProviderLinkFragment => "provider pagination link contains a fragment",
129 Self::ProviderLinkPathChanged => "provider pagination link changed operation path",
130 Self::ProviderLinkMethodChanged => "provider pagination link changed HTTP method",
131 Self::ProviderLinkOperationChanged => "provider pagination link changed operation",
132);
133
134#[cfg(test)]
135mod tests;