Interface PermissionCache


public interface PermissionCache
A thread-safe, generation-scoped cache of permissions associated with resource nodes.

Each instance represents one logical cache generation. For a resource-node ID, implementations maintain two independent semantic slots: one for the permission of the resource node revision itself, and one for the resource-based baseline permission of ordinary objects contained in that resource node or resource. Updating one slot must not change the other. Permissions stored in the cache are non-null CDOPermission values; null is reserved to indicate a cache miss.

Authorization may access a cache concurrently, so implementations must be thread-safe. An obsolete generation may continue to receive calls from authorizations that already captured it, but its entries must not become visible through a newer generation created by PermissionCache.Creator.

Since:
4.13
Author:
Eike Stepper
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Creates independent logical cache generations for repository, user, and branch scopes.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(CDOID resourceNodeID, boolean resourceNode)
    Returns the permission in the selected semantic slot, or null when that slot is unknown.
    void
    put(CDOID resourceNodeID, boolean resourceNode, CDOPermission permission)
    Stores a non-null permission in the selected semantic slot without changing the other slot for the same resource node ID.
  • Method Details

    • get

      CDOPermission get(CDOID resourceNodeID, boolean resourceNode)
      Returns the permission in the selected semantic slot, or null when that slot is unknown.

      A returned CDOPermission.NONE is a cache hit and must not be confused with null, which means that no permission is cached for the slot.

      Parameters:
      resourceNodeID - the resource node identifying the cache entry
      resourceNode - true to select the permission for the resource-node revision itself, or false to select the resource-based baseline used for ordinary objects in that resource
      Returns:
      the cached permission, including CDOPermission.NONE, or null on a cache miss
    • put

      void put(CDOID resourceNodeID, boolean resourceNode, CDOPermission permission)
      Stores a non-null permission in the selected semantic slot without changing the other slot for the same resource node ID.
      Parameters:
      resourceNodeID - the resource node identifying the cache entry
      resourceNode - true to select the permission for the resource-node revision itself, or false to select the resource-based baseline used for ordinary objects in that resource
      permission - the permission to store; null is reserved for cache misses and is not a stored value