Skip to main content
Version: 2.0.1

πŸ“Š SPACE Feature Evaluation Workflow

SPACE helps you decide whether a user can access a feature, while keeping subscription states consistent even under concurrency or partial failures.

SPACE Feature Evaluation Process


πŸ”‘ Key Idea​

To evaluate a feature, SPACE must receive:

  • A userId.

  • A featureId, which has the following structure: <serviceName>-<featureName>. E.g.: petclinic-pets.

  • Optionally, an expectedConsumption (e.g., size of a video upload).

    info

    If provided, this value enables optimistic updates, i.e. usage levels are tentatively increased before the request is processed.


πŸ›  How It Works​

  1. Get the contract for the given userId and infer his current subscription (which remember is attached to a configuration).
  2. Retrieve the configuration from the pricing using the information of the subscription.
  3. Evaluate access.
    • ❌ If denied β†’ stop.
    • βœ… If allowed β†’ continue with one of the two paths below.

⚑ Path 1: With expectedConsumption​

  1. Stores a snapshot of the current usage levels (which is kept for 30–60s).
  2. Applies the expected increase.
  3. Return access verdict to the managed service:
  • βœ”οΈ If the request succeeds β†’ no more actions are needed.
  • ❌ If it fails β†’ rollback must be triggered during the snapshot window.

πŸ‘‰ This is ideal for operations where you already know the consumption associated with a request (like the size of a file being uploaded).

πŸ“© Path 2: Without expectedConsumption​

  1. Return access verdict to the managed service:
  • βœ”οΈ If the request succeeds and the feature has associated usage limit/s β†’ the managed service must notify SPACE when it completes so it can update usage levels.
  • ❌ Otherwise β†’ no more actions are needed.

βœ… Summary​

  • Use expectedConsumption β†’ optimistic updates, better performance, but must be prepared to perform rollbacks in case of failures.

  • Don’t use it β†’ explicit confirmation required, safer for unknown or variable resource usage, but requires an extra request from the managed service.