Skip to main content

Module paths

Module paths 

Source
Expand description

Which match statements cover a path, and what their wildcards hold (#59).

As measured with tools/oracle/rules_paths.py (tests/fixtures/rules_paths.json):

  • A match covers a path when its segments, after those of every match around it (outermost first, from the service), take the whole path: databases, the database ID, documents, then the document’s segments. Its allow statements apply to that path only; a match that takes part of it only leads to the matches inside.
  • A literal segment takes itself; a wildcard ({d}, {d=*}) takes one segment and holds it as a string.
  • A recursive wildcard ({rest=**}) holds a path: one or more segments in rules version 1, where the compiler only allows it last, and zero or more in version 2, where it may come anywhere, once per match. So in version 2 /c/{d}/{rest=**} covers c/d itself, and a nested /{rest=**} covers the document of the match around it.

A list is checked on its collection’s path followed by an unknown document ID, and a collection group’s path holds an unknown run of segments before its collection ID (tools/oracle/rules_list.py): only a wildcard takes the unknown ID, and leaves its variable unbound (using it is a Null value error); only a recursive wildcard takes an unknown run.

Structs§

Covering
A match that covers a path: the matches from the service down to it, and the variables they bound, outermost first.

Enums§

Binding
The value of a path variable.
Part
A segment of a path to cover.

Constants§

UNKNOWN_ID
How an unknown document ID shows in a recursive wildcard’s path (no segment holds it).
UNKNOWN_RUN
How an unknown run of segments shows in a recursive wildcard’s path.

Functions§

covering
Every match of service that covers path, in source order (a match before the ones inside it). A match that covers it in several ways (two recursive wildcards splitting it differently) is listed once, with the first way found, which gives earlier recursive wildcards fewer segments.
covering_parts
covering for a path with unknown parts.