Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

duebook_demo state

Back to all declarations

MinDelayBlocks

int64

Value

1

MaxDelayBlocks

int64

Value

2500000

MaxTTLBlocks

int64

Value

2500000

MaxOpen

untyped bigint

Value

(200 <untyped> bigint)

MaxTextLen

untyped bigint

Value

(280 <untyped> bigint)

MaxPublishedKept

untyped bigint

Value

(50 <untyped> bigint)

MaxListed

untyped bigint

Value

(50 <untyped> bigint)

book

*duebook.Book

book holds the scheduled announcements. It is unexported and never returned: handing a \*Book across a realm boundary would hand out the right to schedule, cancel and claim (duebook consumer contract 3).

Open
OID
0b82c8…10e4:4
book details

Inspect pointer

publication

type

publication is one published announcement, kept for rendering.

Value

duebook_demo.publication

published

*v0.Tree

// padded seq -> \*publication

Open
OID
0b82c8…10e4:9
published details

Inspect pointer

publishedTotal

int64

// every publication ever, including evicted

Value

2

nextSeq

int64

Value

3

rejectStraySend

func()

rejectStraySend aborts if an EOA attached coins to an entrypoint that has no use for them. This realm never holds value; without this guard a mistyped send would be silently absorbed by the realm bank.

Open
OID
0b82c8…10e4:13
rejectStraySend details

Inspect func

Schedule

func(text string, delayBlocks int64, ttlBlocks int64) string

Schedule registers an announcement to be published no earlier than delayBlocks from the current height, and returns its deferral ID. ttlBlocks is how long after the due height the announcement stays publishable; 0 means it never expires. The caller becomes the owner and is the only account that may Cancel it.

Open
OID
0b82c8…10e4:15
Schedule details

Inspect func

Publish

func(id int64) string

Publish publishes a scheduled announcement once it is due. It is deliberately permissionless: duebook's exactly-once Claim is the only thing preventing a second publication, which is precisely what this realm exists to demonstrate. Aborts if the announcement does not exist, is not due yet, has expired, or has already been consumed by a publication or a cancellation.

Open
OID
0b82c8…10e4:16
Publish details

Inspect func

Cancel

func(id int64) string

Cancel withdraws a scheduled announcement before it is published. Only the account that scheduled it may cancel, and only while it is still open — a cancellation that arrives after publication aborts.

Open
OID
0b82c8…10e4:17
Cancel details

Inspect func

Expire

func(id int64) string

Expire clears an announcement whose time-to-live has elapsed, freeing its slot against MaxOpen. It is permissionless because an expired announcement can never be published, so there is nothing left to protect and everything to gain from letting anyone tidy up.

Open
OID
0b82c8…10e4:18
Expire details

Inspect func

Height

func() int64

Height returns the chain height this realm is reading as "now".

Open
OID
0b82c8…10e4:19
Height details

Inspect func

OpenCount

func() int

OpenCount returns how many announcements are currently scheduled.

Open
OID
0b82c8…10e4:20
OpenCount details

Inspect func

PublishedTotal

func() int64

PublishedTotal returns how many announcements have ever been published, including ones since evicted from the rendered window.

Open
OID
0b82c8…10e4:21
PublishedTotal details

Inspect func

NextID

func() string

NextID returns the deferral ID the next Schedule will allocate. It only ever increases; that is what makes a consumed ID permanently unusable.

Open
OID
0b82c8…10e4:22
NextID details

Inspect func

Status

func(id int64) string

Status describes a scheduled announcement: its window, and whether it is publishable right now. Returns "unknown" when the ID was never issued or has already been consumed — duebook keeps no tombstone, so those two cases are indistinguishable by design.

Open
OID
0b82c8…10e4:23
Status details

Inspect func

DueNow

func() string

DueNow returns the IDs of announcements publishable at the current height, oldest first, capped at MaxListed.

Open
OID
0b82c8…10e4:24
DueNow details

Inspect func

ExpirableNow

func() string

ExpirableNow returns the IDs that Expire would accept at the current height, oldest first, capped at MaxListed.

Open
OID
0b82c8…10e4:25
ExpirableNow details

Inspect func

realmPath

untyped string

realmPath is this realm's gnoweb prefix, used to build view links.

Value

"/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/duebook_demo"

Render

func(path string) string

Render serves three views, selected by path. Anyone may Schedule, so the default view must not be something a stranger can inflate: it shows only what is publishable right now, capped at MaxListed. The full scheduled table lives behind :open and is capped too, so no view is unbounded and none of them is the landing page by default. (empty) summary + publishable now + recent publications open every scheduled announcement, up to MaxListed rows about what this realm is and why it exists

Open
OID
0b82c8…10e4:26
Render details

Inspect func

renderDue

func() string

renderDue lists only what can be published at this height. book.Due applies the cap itself, so the slice is at most MaxListed long.

Open
OID
0b82c8…10e4:28
renderDue details

Inspect func

renderOpen

func() string

renderOpen lists the whole book, stopping at MaxListed rows so this view has a fixed ceiling independent of MaxOpen.

Open
OID
0b82c8…10e4:29
renderOpen details

Inspect func

renderRows

func(ds []duebook.Deferral, now int64) string
Open
OID
0b82c8…10e4:30
renderRows details

Inspect func

renderPublished

func() string

renderPublished shows the retained window, which evictOldest already holds at MaxPublishedKept entries.

Open
OID
0b82c8…10e4:31
renderPublished details

Inspect func

normalizePath

func(path string) string

normalizePath reduces a gnoweb render path to a bare view name, so "", "/", "open" and "/open/" all select the same view.

Open
OID
0b82c8…10e4:33
normalizePath details

Inspect func

mustID

func(id int64) uint64

mustID converts an exported int64 ID to duebook's uint64 form. IDs start at 1, so anything below that was never issued.

Open
OID
0b82c8…10e4:34
mustID details

Inspect func

evictOldest

func()

evictOldest trims the rendered window to MaxPublishedKept, dropping the lowest sequence numbers first. Evicted publications remain in the emitted events.

Open
OID
0b82c8…10e4:35
evictOldest details

Inspect func

seqKey

func(seq int64) string

seqKey encodes a sequence number so avl's lexical order matches numeric order. Sequences are positive int64, at most 19 digits.

Open
OID
0b82c8…10e4:36
seqKey details

Inspect func
MinDelayBlocks : int64 =1
MaxDelayBlocks : int64 =2500000
MaxTTLBlocks : int64 =2500000
MaxOpen : untyped bigint =(200 <untyped> bigint)
MaxTextLen : untyped bigint =(280 <untyped> bigint)
MaxPublishedKept : untyped bigint =(50 <untyped> bigint)
MaxListed : untyped bigint =(50 <untyped> bigint)
book : *duebook.Book Inspect
publication : type =duebook_demo.publication
published : *v0.Tree Inspect
publishedTotal : int64 =2
nextSeq : int64 =3
rejectStraySend : func() Inspect
Schedule : func(text string, delayBlocks int64, ttlBlocks int64) string Inspect
Publish : func(id int64) string Inspect
Cancel : func(id int64) string Inspect
Expire : func(id int64) string Inspect
Height : func() int64 Inspect
OpenCount : func() int Inspect
PublishedTotal : func() int64 Inspect
NextID : func() string Inspect
Status : func(id int64) string Inspect
DueNow : func() string Inspect
ExpirableNow : func() string Inspect
realmPath : untyped string ="/r/g1ut6uspuh73e02yauxpmyt8g3wwddaq8utagvm3/duebook_demo"
Render : func(path string) string Inspect
renderHeader : func() string Inspect
renderDue : func() string Inspect
renderOpen : func() string Inspect
renderRows : func(ds []duebook.Deferral, now int64) string Inspect
renderPublished : func() string Inspect
renderAbout : func() string Inspect
normalizePath : func(path string) string Inspect
mustID : func(id int64) uint64 Inspect
evictOldest : func() Inspect
seqKey : func(seq int64) string Inspect
itoa : func(n int64) string Inspect
utoa : func(n uint64) string Inspect