Skip to content

Split modules and shard EvaluationSession state#26

Open
hardbyte wants to merge 3 commits into
brian/bulk-authz-batchfrom
brian/sharded-session-modules
Open

Split modules and shard EvaluationSession state#26
hardbyte wants to merge 3 commits into
brian/bulk-authz-batchfrom
brian/sharded-session-modules

Conversation

@hardbyte
Copy link
Copy Markdown
Contributor

Summary

  • Splits src/lib.rs into private implementation modules with root-level reexports, preserving the existing use gatehouse::{...} API shape.
  • Refactors EvaluationSession internals from global source/cache/in-flight maps into per-fact-type FactState<K> with striped cache and in-flight state.
  • Keeps FactSource::load_many() outside locks and preserves the cancellation invariant: cancelled loaders cache LoaderCancelled and wake waiters.
  • Documents that checker/combinator batch evaluation remains sequential; parallel work is currently policy/fact-source internal unless a future checker-level API makes it explicit.
  • Adds contention/cancellation tests and a hot in-RAM benchmark comparing a coarse cached reference against the sharded session path.

Addresses #21.
Addresses #25.

Notes

This PR is stacked on brian/bulk-authz-batch because both issues depend on the v0.3 EvaluationSession / FactSource work in PR #18. Issue #21's proposed Lookup* module contents are not present because PR #18 removed the unconsumed lookup draft; no lookup API is introduced here.

Validation

  • cargo fmt --all --check
  • cargo build
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo doc --all-features --no-deps
  • cargo test --doc
  • cargo test --all-targets --all-features
  • cargo bench --bench permission_checker --no-run
  • cargo check --example axum
  • cargo check --example pg18_bulk_rebac
  • cargo run --example in_ram_rebac
  • DATABASE_URL="host=localhost port=15432 user=postgres password=test dbname=awa_test" cargo run --example pg18_bulk_rebac --release

PG18 release example completed against local PostgreSQL 18.3; largest row: 10000,8000,807.565,11.745,6000,x68.8.

Comment thread src/session.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant