1mod budget;
4mod driver;
5mod header_cursor;
6mod link;
7mod local_async;
8mod numbered;
9mod offset;
10mod opaque;
11
12pub use budget::{
13 MAX_SNAPSHOT_ID_BYTES, PaginationBudget, PaginationLimits, PaginationProgress, SnapshotId,
14 SnapshotPolicy,
15};
16pub use driver::{PageStrategy, PagerControl, PagerDriver, PagerDriverError, PagerStep};
17pub use header_cursor::{
18 HeaderCursorContinuation, HeaderCursorExecutionError, HeaderCursorNext, HeaderCursorPage,
19 HeaderCursorPolicy, HeaderCursorSession,
20};
21pub use link::{ProviderLinkBinding, ProviderLinkExecutionError, ValidatedProviderLink};
22pub use numbered::{
23 NumberedPageBoundary, NumberedPageMetadata, NumberedPageObservation, NumberedPagination,
24 PageNumber,
25};
26pub use offset::{OffsetPageBoundary, OffsetPageMetadata, OffsetPageObservation, OffsetPagination};
27pub use opaque::{
28 CursorDigest, CursorHistory, MAX_OPAQUE_STATE_BYTES, PaginationCursor, PaginationMarker,
29};
30
31#[derive(Clone, Copy, Debug, Eq, PartialEq)]
33pub enum PaginationError {
34 ZeroLimit,
36 StateLimitTooLarge,
38 PageZero,
40 PageSizeZero,
42 InvalidPreviousPage,
44 InvalidNextPage,
46 InvalidLastPage,
48 UnexpectedPosition,
50 EmptyPageWithContinuation,
52 InvalidEntryCount,
54 PageSizeChanged,
56 TraversalChanged,
58 RequestBudgetExceeded,
60 ItemBudgetExceeded,
62 SnapshotRequired,
64 SnapshotIdEmpty,
66 SnapshotIdTooLong,
68 SnapshotForbidden,
70 SnapshotChanged,
72 Complete,
74 MissingState,
76 StateTooLong,
78 OutputTooSmall,
80 HistoryBudgetExceeded,
82 CursorCycle,
84 CursorDigestCollision,
86 CursorDigestChanged,
88 InvalidHeaderPolicy,
90 InvalidHeaderState,
92 InsecureHeaderState,
94 OperationMismatch,
96 RequestHeaderConflict,
98 ResponseHeaderNotAdmitted,
100 EndpointMismatch,
102 InvalidProviderLink,
104 ProviderLinkSchemeChanged,
106 ProviderLinkAuthorityChanged,
108 ProviderLinkUserinfo,
110 ProviderLinkFragment,
112 ProviderLinkPathChanged,
114 ProviderLinkMethodChanged,
116 ProviderLinkOperationChanged,
118}
119
120impl_static_error!(PaginationError,
121 Self::ZeroLimit => "pagination limits must be nonzero",
122 Self::StateLimitTooLarge => "opaque pagination state limit exceeds the hard limit",
123 Self::PageZero => "page number must be nonzero",
124 Self::PageSizeZero => "page size must be nonzero",
125 Self::InvalidPreviousPage => "previous-page metadata is invalid",
126 Self::InvalidNextPage => "next-page metadata is invalid",
127 Self::InvalidLastPage => "last-page metadata is invalid",
128 Self::UnexpectedPosition => "response position differs from the requested position",
129 Self::EmptyPageWithContinuation => "nonterminal response page is empty",
130 Self::InvalidEntryCount => "response entry count is invalid",
131 Self::PageSizeChanged => "response page size changed during traversal",
132 Self::TraversalChanged => "pagination metadata changed during traversal",
133 Self::RequestBudgetExceeded => "pagination request budget was exceeded",
134 Self::ItemBudgetExceeded => "pagination item budget was exceeded",
135 Self::SnapshotRequired => "provider snapshot identifier is required",
136 Self::SnapshotIdEmpty => "provider snapshot identifier is empty",
137 Self::SnapshotIdTooLong => "provider snapshot identifier exceeds the length limit",
138 Self::SnapshotForbidden => "provider snapshot identifier is forbidden",
139 Self::SnapshotChanged => "provider snapshot identifier changed during traversal",
140 Self::Complete => "pagination traversal is complete",
141 Self::MissingState => "opaque pagination state is missing",
142 Self::StateTooLong => "opaque pagination state exceeds the selected limit",
143 Self::OutputTooSmall => "pagination state output is too small",
144 Self::HistoryBudgetExceeded => "cursor history budget was exceeded",
145 Self::CursorCycle => "pagination cursor cycle was detected",
146 Self::CursorDigestCollision => "pagination cursor digest collision was detected",
147 Self::CursorDigestChanged => "pagination cursor digest changed for the same state",
148 Self::InvalidHeaderPolicy => "pagination cursor header policy is invalid",
149 Self::InvalidHeaderState => "pagination cursor header state is invalid",
150 Self::InsecureHeaderState => "pagination cursor header state is not sensitive",
151 Self::OperationMismatch => "pagination cursor operation does not match the prepared request",
152 Self::RequestHeaderConflict => "pagination headers conflict with the prepared request",
153 Self::ResponseHeaderNotAdmitted => "pagination cursor response header is not admitted",
154 Self::EndpointMismatch => "pagination continuation changed the bound endpoint",
155 Self::InvalidProviderLink => "provider pagination link is invalid",
156 Self::ProviderLinkSchemeChanged => "provider pagination link changed scheme",
157 Self::ProviderLinkAuthorityChanged => "provider pagination link changed authority",
158 Self::ProviderLinkUserinfo => "provider pagination link contains user information",
159 Self::ProviderLinkFragment => "provider pagination link contains a fragment",
160 Self::ProviderLinkPathChanged => "provider pagination link changed operation path",
161 Self::ProviderLinkMethodChanged => "provider pagination link changed HTTP method",
162 Self::ProviderLinkOperationChanged => "provider pagination link changed operation",
163);
164
165#[cfg(test)]
166mod tests;