CollectionStore
Storage for collections with permission management.
Manages the hierarchical collection structure and enforces permission inheritance rules:
- SubCollections inherit parent permissions
- SubCollections can only add restrictions (never loosen)
- Documents can only be added to leaf collections
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
class PgCollectionStore
Members list
Value members
Abstract methods
Check if a user can query a collection.
Check if a user can query a collection.
This considers the effective permissions (with inheritance).
Value parameters
- auth
-
The user's authorization context
- path
-
The collection path
Attributes
- Returns
-
True if the user can query this collection
Count chunks in a collection.
Count chunks in a collection.
Value parameters
- path
-
The collection path
Attributes
- Returns
-
Number of chunks
Count documents in a collection.
Count documents in a collection.
Value parameters
- path
-
The collection path
Attributes
- Returns
-
Number of documents (not chunks)
Create a new collection.
Create a new collection.
Validates that:
- The parent exists (if not a root collection)
- Permissions don't loosen parent restrictions
- The path is valid and not already taken
Value parameters
- config
-
The collection configuration
Attributes
- Returns
-
The created collection, or error
Delete a collection.
Delete a collection.
The collection must be empty (no documents or sub-collections).
Value parameters
- path
-
The collection path
Attributes
- Returns
-
Success or error
Ensure a collection exists, creating it if necessary.
Ensure a collection exists, creating it if necessary.
Creates parent collections as needed (as public, non-leaf).
Value parameters
- config
-
The collection configuration
Attributes
- Returns
-
The existing or newly created collection
Find collections accessible by user matching a pattern.
Find collections accessible by user matching a pattern.
This is the key permission-filtered query used during search. Returns only collections where:
- Pattern matches, AND
- User has access (public OR user's principals overlap with queryableBy)
Also respects inheritance - if a parent is not accessible, its children are also not accessible.
Value parameters
- auth
-
The user's authorization context
- pattern
-
The pattern to match
Attributes
- Returns
-
Accessible collections matching the pattern
Get a collection by path.
Get a collection by path.
Value parameters
- path
-
The collection path
Attributes
- Returns
-
The collection if found, None otherwise
Get a collection by its database ID.
Get a collection by its database ID.
Value parameters
- id
-
The collection ID
Attributes
- Returns
-
The collection if found, None otherwise
Get effective permissions for a collection considering inheritance.
Get effective permissions for a collection considering inheritance.
Effective permissions are the intersection of:
- The collection's own queryableBy, AND
- All ancestor collections' queryableBy sets
If any ancestor is public (empty queryableBy), that level is skipped. If the collection itself is public, returns empty (meaning public).
Value parameters
- path
-
The collection path
Attributes
- Returns
-
The effective permissions set
List all collections matching a pattern.
List all collections matching a pattern.
Does NOT apply permission filtering - returns all matching collections. Use findAccessible for permission-filtered queries.
Value parameters
- pattern
-
The pattern to match (default: all)
Attributes
- Returns
-
All matching collections
List direct children of a collection.
List direct children of a collection.
Value parameters
- parentPath
-
The parent collection path
Attributes
- Returns
-
Direct child collections
Get collection statistics.
Get collection statistics.
Value parameters
- path
-
The collection path
Attributes
- Returns
-
Collection statistics
Update collection metadata.
Update collection metadata.
Value parameters
- metadata
-
The new metadata (replaces existing)
- path
-
The collection path
Attributes
- Returns
-
The updated collection, or error
Update collection permissions.
Update collection permissions.
Validates that new permissions don't loosen parent restrictions.
Value parameters
- path
-
The collection path
- queryableBy
-
The new set of queryable principals
Attributes
- Returns
-
The updated collection, or error
Concrete methods
Check if a collection exists.
Check if a collection exists.
Value parameters
- path
-
The collection path
Attributes
- Returns
-
True if exists