Skip to content

Class: SequencerDO

Defined in: server/src/sequencer-do.ts:42

new SequencerDO(state): SequencerDO

Defined in: server/src/sequencer-do.ts:45

SequencerState

SequencerDO

readonly static KEY: "next" = "next"

Defined in: server/src/sequencer-do.ts:43

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.

number

Promise<ReserveResult>


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.

Request

Promise<Response>


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.

Promise<bigint>