Interface AllowlistStore


public interface AllowlistStore
Interface for persisting the allowlist across restarts.

This SPI allows implementations to store allowlist changes durably to disk, a database, or other persistent storage. By default, AllowlistManager works in-memory; calls to AllowlistManager.add(String) and AllowlistManager.remove(String) can optionally invoke an AllowlistStore to ensure durability.

Implementation requirements

  • The store MUST be thread-safe for concurrent access.
  • Writes MUST be durable and survive process restarts.
  • Load operations MUST be idempotent.

Usage


 AllowlistStore fileStore = new FileAllowlistStore(Paths.get("/data/allowlist.txt"));
 AllowlistManager allowlist = new AllowlistManager();
 allowlist.loadFromStore(fileStore);  // Load previously persisted allowlist

 allowlist.add("new-node");
 allowlist.saveToStore(fileStore);    // Durably save the update
 
Since:
1.0.0
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Loads allowlisted node IDs from persistent storage.
    void
    save(Set<String> nodeIds)
    Saves a set of node IDs to persistent storage, replacing any previously stored list.
  • Method Details

    • load

      Set<String> load()
      Loads allowlisted node IDs from persistent storage.

      This method is typically called once at startup to restore the allowlist from a previous session.

      Returns:
      a set of allowlisted node IDs (maybe empty, but non-null)
    • save

      void save(Set<String> nodeIds)
      Saves a set of node IDs to persistent storage, replacing any previously stored list.

      This method is called whenever the allowlist is modified (in AllowlistManager integration scenarios) to ensure durability.

      Parameters:
      nodeIds - the set of node IDs to persist (non-null, may be empty)