Module leopard

Module leopard 

Source
Expand description

Leopard Indexing for optimized reachability queries

Implements the Leopard indexing strategy from Google Zanzibar to achieve O(1) authorization checks for pre-computed relationship paths.

§How it works

Instead of traversing the relationship graph at query time, Leopard pre-computes and materializes transitive closures for frequently accessed relationships.

Example: If owner inherits viewer, and alice is an owner of doc1, the index stores both:

  • (alice, owner, doc1) - direct relationship
  • (alice, viewer, doc1) - computed/inherited relationship

§Performance

  • Reads: O(1) lookup in materialized index
  • Writes: O(n) where n is the depth of inheritance chain
  • Space: O(tuples × avg_inheritance_depth)

Structs§

LeopardConfig
Configuration for Leopard indexing
LeopardIndex
Leopard reachability index
LeopardStats
Statistics for Leopard index
ReachabilityEntry
A materialized reachability entry