Skip to main content

Module shared

Module shared 

Source
Expand description

One request per subject, shared by every statement asked about it.

The server registers each statement of a Cedar document with an evaluator of its own, and a write asks every one of them about the same subject in turn. Most of what judging costs is building Cedar’s context and entities from the record, and that depends only on the subject and the shapes. So each thread keeps the request it prepared last, beside a copy of the subject it came from, and hands it to the next statement asked about an equal subject under the same shapes.

An entry answers only a subject equal to its own in every field, so it only ever hands out the request that subject would have been built into anyway. Each thread has its own entry, so a write judged on one thread never reads another thread’s. An entry is replaced whole, and only once the new request is built, so a panic partway leaves the previous entry, which still answers only its own subject.

An entry holds the record the write carried, so it is kept for as long as the reuse it exists for can happen and no longer. KEEP is that long, and the next miss on any thread drops every entry past it — which is why each thread’s entry is reachable from SLOTS rather than only from the thread itself. A subject bigger than KEEP_BELOW is judged from a request built the same way and then not kept at all, so what one thread holds between writes is bounded by that rather than by the largest record the process has ever judged.

Structs§

Attributes 🔒
Entry 🔒
Facts 🔒
OwnedChange 🔒
OwnedLookup 🔒

Enums§

Kind 🔒
Owned 🔒
A Subject copied out of the borrows it arrived in. Both directions name every field, so a field added to Subject does not compile here until it is copied and compared too.
OwnedFound 🔒

Constants§

KEEP 🔒
How long an entry is kept after the subject that filled it.
KEEP_BELOW 🔒
The largest subject an entry is kept for, measured over the strings and record bodies it owns.
LAST 🔒

Statics§

SLOTS 🔒
Every live thread’s slot. Weak, so a thread that has ended takes its entry with it and leaves a link sweep drops.

Functions§

judged_at 🔒
The instant subject is being judged at.
operation 🔒
A record.write’s operation, from the write’s action.
prepared 🔒
The request subject asks, prepared against shapes.
principal 🔒
The account as Cedar’s principal, with what the subject says about it.
registered 🔒
A slot of this thread’s own, listed in SLOTS.
sweep 🔒
Drops every entry filled more than KEEP before now, and forgets the slots of threads that have ended.
weigh 🔒
Roughly how many bytes of text value holds.
with_request 🔒
The request subject asks, handed to f. A write’s value and existing are the records themselves, exactly as the store holds them.

Type Aliases§

Slot 🔒
One thread’s entry, reachable from that thread and from SLOTS.