Class: SequencerDO
Class: SequencerDO
Section titled “Class: SequencerDO”Defined in: server/src/sequencer-do.ts:42
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SequencerDO(
state):SequencerDO
Defined in: server/src/sequencer-do.ts:45
Parameters
Section titled “Parameters”Returns
Section titled “Returns”SequencerDO
Properties
Section titled “Properties”
readonlystaticKEY:"next"="next"
Defined in: server/src/sequencer-do.ts:43
Methods
Section titled “Methods”reserve()
Section titled “reserve()”reserve(
count):Promise<ReserveResult>
Defined in: server/src/sequencer-do.ts:53
Reserve N consecutive version ids. Uses storage.transaction so
a burst of concurrent pushes each get a distinct contiguous
range. Returns bigint values as strings so the DO->caller
boundary (typically JSON) doesn’t drop precision.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”Promise<ReserveResult>
fetch()
Section titled “fetch()”fetch(
req):Promise<Response>
Defined in: server/src/sequencer-do.ts:74
Public HTTP surface mirrors the workerd conventions — a caller
fetch()s the DO with ?count=N and gets a JSON body.
Non-fetch entry points (e.g. an RPC method exposed via
env.SEQUENCER.get(id).reserve(n)) can bypass this and call
reserve() directly.
Parameters
Section titled “Parameters”Request
Returns
Section titled “Returns”Promise<Response>
peek()
Section titled “peek()”peek():
Promise<bigint>
Defined in: server/src/sequencer-do.ts:97
Read the current counter without touching it. Useful for tests and diagnostic endpoints; not part of the normal push flow.
Returns
Section titled “Returns”Promise<bigint>