Repository navigation
Fewer Postgres round trips on deep hierarchies, and a FastAPI helper. No migration is needed
from 0.2.0: public APIs keep working and storage formats are unchanged. A custom ReadStore
keeps compiling, because the new trait methods are provided.
Changed
- Postgres reads make fewer round trips. A request opens its snapshot in one message, and a
check fetches what each level of a hierarchy may read in one statement. Answers, errors,
limits and traces are unchanged (docs/T10.1-READ-AHEAD.md). A check 30 folders deep goes
from 99 round trips to 33 and from 13.3 ms to 6.7 ms (p50), andlookup_resourcesover
10,000 documents from 506 to 8 and from 72 ms to 16 ms (benches/RESULTS.md). - Inside a read snapshot, Postgres statements use generic plans, set with
SET LOCAL, so they
are not replanned on every call. The first open-ended read below head returns to the
server's default, for one more round trip. - Not every Postgres scenario got much faster. Over three benchmark runs against the baseline,
shallow checks stayed about level (median p50:direct_hit-2.2%,direct_hit_below_head
+1.3%,wide_groups_10k_below_head-3.2%) and writes did not change. No scenario was slower in
all three runs, at p50 or p99, but a single run can be:wide_groups_10k_below_headranged from
+30.5% to -20.6% at p50, andwrite_batch_1000, whose code did not change, from +9.6% to -9.0%
(benches/RESULTS.md).
Added
pemba.contrib.fastapi.Authz, a permission check for FastAPI routes, with the new extra
pip install pemba[fastapi]. A deny gets a configurable 4xx (403 by default). A transient
store failure gets a 503 with a fixed detail, and any other engine error a 500. An id the
engine refuses gets a 422, anat_leastbound ahead of the store a 409, and a request with
no subject a 401, whose headers you can set withunauthenticated_headers. See
docs/guides/fastapi.md.ReadStore::batch_read_limitandReadStore::read_batch, provided methods a store may
implement to batch reads, withBatchReadandBatchAnswer.