Copyright © 2016 - 2026 SigScale Global Inc.
Behaviours: gen_server.
abstract datatype: continuation()
state() = #state{etag = string(), max_page_size = pos_integer(), timeout = pos_integer(), log = term(), module = atom(), function = atom(), args = list(), cont = continuation(), buffer = [tuple()], offset = non_neg_integer(), length = non_neg_integer(), request = undefined | {StartRange::non_neg_integer(), EndRange::non_neg_integer(), From::gen_server:from()}}
| start_link/1 | Start a handler for a sequence of REST range requests. |
| init/1 | Initialize the ocs_rest_pagination_server server. |
| handle_call/3 | Handle a request sent using gen_server:call/2,3 or gen_server:multi_call/2,3,4. |
| handle_cast/2 | Handle a request sent using gen_server:cast/2 or gen_server:abcast/2,3. |
| handle_info/2 | Handle a received message. |
| terminate/2 | Cleanup and exit. |
| code_change/3 | Update internal state data during a release upgrade/downgrade. |
| range_request/2* | Handle a range request. |
start_link(Args) -> Result
Start a handler for a sequence of REST range requests.
Args is a list of [Log, Module, Function, Arguments].
Each request will result in a call to the callback
with apply(Module, Function, [Cont | Arguments]). The result
should be {Cont, Items} or {error, Reason}. Cont will
be start on the first call and the returned value may be
eof or an opaque continuation value which will be used in
the next call to the callback.
init(Args) -> Result
Initialize the ocs_rest_pagination_server server.
See also: //stdlib/gen_server:init/1.
handle_call(Request, From, State) -> Result
Handle a request sent using gen_server:call/2,3 or gen_server:multi_call/2,3,4.
See also: //stdlib/gen_server:handle_call/3.
handle_cast(Request, State) -> Result
Handle a request sent using gen_server:cast/2 or gen_server:abcast/2,3.
See also: //stdlib/gen_server:handle_cast/2.
handle_info(Info, State) -> Result
Handle a received message.
See also: //stdlib/gen_server:handle_info/2.
terminate(Reason, State) -> any()
Cleanup and exit.
See also: //stdlib/gen_server:terminate/3.
code_change(OldVsn, State, Extra) -> Result
Update internal state data during a release upgrade/downgrade.
See also: //stdlib/gen_server:code_change/3.
range_request(Range, State) -> Result
Handle a range request. Manages a buffer of items read with the callback.
Reply {Items, ContentRange} on success where Items is
a list of collection members and ContentRange is to be
used in a Content-Range header. The total items will be
included if known at the time (e.g. "items 1-100/*" or
"items 50-100/100").
{error, Status} if the request fails. Status
is an HTTP status code to be returned to the client.
Generated by EDoc