Skip to main content

Module Storage

Module Storage 

Source
Expand description

§Persistent Storage handlers

Wind invokes these via the WindServiceHandlers dispatcher; each delegates to Environment::Require<dyn StorageProvider>. Two scopes: workspace (false) for StorageGet/StorageSet, global (true) for the rest - VS Code’s storage service distinguishes the two; we follow.

Layout (one export per file, file name = identity):

  • StorageGet::StorageGet - single key read (workspace).
  • StorageSet::StorageSet - single key write (workspace).
  • StorageDelete::StorageDelete - single key delete (global).
  • StorageKeys::StorageKeys - list every key (global).
  • StorageGetItems::StorageGetItems - bulk read as [key,value] tuples; called by VS Code’s NativeWorkbenchStorageService at boot.
  • StorageUpdateItems::StorageUpdateItems - bulk insert + delete; matches IndexedDBStorageDatabase’s wire shape.

Modules§

StorageDelete
Delete a key from global storage. The true first arg to UpdateStorageValue targets the global (cross-workspace) store; pairs with StorageKeys / StorageGetItems which also read from global.
StorageGet
Read a single value from persistent storage by key. The false first arg to GetStorageValue selects the workspace-scoped store; true would target global storage.
StorageGetItems
Bulk-read every key/value pair as [key, value] tuples. VS Code’s NativeWorkbenchStorageService calls this exactly once at boot to hydrate its in-memory cache. Stringifies non-string values for wire-shape compatibility with the upstream StorageDatabase contract.
StorageKeys
Return every key in global storage as a JSON array. Used by Wind’s storage-debug surfaces and by extensions iterating the global storage namespace.
StorageSet
Write a single value to workspace-scoped storage. Atomic per key - concurrent set/get against the same key serialise through the StorageProvider’s lock.
StorageUpdateItems
Bulk insert + delete in one round-trip. VS Code’s IndexedDBStorageDatabase batches every write through this shape: { insert: [[key,value], …] | { key: value }, delete: [keys…] }. Both insert encodings (array-of-pairs and object-map) accepted.