Skip to content

feat(plugins): give plugins shared storage #545

Open
4 of 4 issues completed
Open

Description

@uniqueg

Problem

FOCA 0.18's plugin engine gives plugins no storage. Plugins that cache or count can only keep state per process, so with several workers or replicas:

  • caches are not shared: each process repeats the same expensive or rate-limited lookups;
  • counters can't be enforced across processes, e.g. a per-user or per-day budget for a third-party API.

Example: tes.routing.distance in elixir-cloud-aai/foca-plugins (PR #13). With its opt-in dbip provider it caches geolocations per process and can't cap lookups per user, so users who submit many tasks can use up DB-IP's free daily quota (500 requests); distance routing then stops applying until the quota resets. A shared cache and per-user counters would fix both.

Proposal

Give plugins a small, namespaced key-value store through the plugin context (e.g. ctx.store), backed by the app's MongoDB:

  • one namespace per plugin distribution, so plugins can't read each other's data;
  • get, set with an optional TTL (MongoDB TTL index), delete, and an atomic increment with TTL for counters and budgets;
  • size limits per entry and per namespace, configurable by the operator;
  • an in-memory fallback when no database is configured (current behaviour), so plugins work without it.

Open questions: which collections and indexes FOCA creates; whether operators can turn storage off per plugin; how it shows up in the plugin listing (e.g. a capability or data_transfers-like field).

Done when

  • the store is available to plugins, documented in the plugin guide, and tested (unit and integration, 100% coverage);
  • tes.routing.distance can use it for its cache and a per-user lookup budget (follow-up in foca-plugins).

Sub-issues

Sub-issues

4 of 4 Issues completed
Loading 4 sub-issues

Activity

  1. added
    priority: low
    status: triage
    type: feature
    workload: days
    on Oct 28, 2026
  2. added
    status: in progress
    status: on hold
    and removed
    status: triage
    status: in progress
    status: on hold
    on Oct 28, 2026
  3. added this to the v0.19.0 milestone on Oct 30, 2026
  4. added
    status: on hold
    and removed
    status: in progress
    on Oct 30, 2026
  5. removed this from the v0.19.0 milestone on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: lowstatus: on holdtype: featureworkload: days

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions