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 🔒
- Owned
Change 🔒 - Owned
Lookup 🔒
Enums§
- Kind 🔒
- Owned 🔒
- A
Subjectcopied out of the borrows it arrived in. Both directions name every field, so a field added toSubjectdoes not compile here until it is copied and compared too. - Owned
Found 🔒
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
sweepdrops.
Functions§
- judged_
at 🔒 - The instant
subjectis being judged at. - operation 🔒
- A
record.write’s operation, from the write’s action. - prepared 🔒
- The request
subjectasks, prepared againstshapes. - 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
KEEPbeforenow, and forgets the slots of threads that have ended. - weigh 🔒
- Roughly how many bytes of text
valueholds. - with_
request 🔒 - The request
subjectasks, handed tof. A write’svalueandexistingare the records themselves, exactly as the store holds them.