Whim icon indicating copy to clipboard operation
Whim copied to clipboard

Sector data store

Open dalyIsaac opened this issue 1 month ago • 0 comments

This is a revised version of #859.

Overview

There is an IStore which contains Whim's state. The IStore has:

  • a Dispatch method to perform updates to the state, using Transform implementations
  • a Pick method to retrieve data from the state

Mutability

The IStore can only be updated via Transforms being Dispatched to it. Within the IStore, all items are immutable.

Sectors

The IStore will consist of the following sectors:

  • MonitorSector
  • WindowSector
  • MapSector
  • WorkspaceSector
  • CommandSector
  • RouterSector
  • FilterSector

Managers will remain to facilitate plugins and native calls.

External API

Transforms and Pickers will use handles or IDs. Results will be used to return errors.

Internal API

Defaults will be preferred over nullables for IDs:

public void BobTransform(WorkspaceId id = default)
{
    id = id.OrActiveWorkspace();
}

Transition

During the transition, Whim classes like Workspace, WorkspaceManager, Monitor etc. will deprecate methods as Transforms and Pickers become available. These classes will also become immutable over time.

Threading

The IStore will be protected by a reader-writer lock - see #849

Events

Events will be triggered at the end of each transform. DoLayout will be triggered at the end of the first transform to be called, before any events are triggered.

Follow-ups

  • Set a router to open a window in a workspace and open it in the correct monitor (see discussion 883).

Plan

  • [x] Create new minor release
  • [x] #890
  • [x] #893
  • [ ] #895
  • [ ] #900
  • [ ] WorkspaceSector (we need workspace events)
  • [ ] CommandSector
  • [ ] RouterSector
  • [ ] FilterSector
  • [ ] Threading
    • [ ] Remove DeferWorkspacePosManager etc.
    • [ ] Ensure that the LayoutPreviewPlugin works
  • [ ] Deprecate methods
  • [ ] Store docs
  • [ ] Docs on Result
  • [ ] Investigate using struct where possible
  • [ ] Remove deprecated methods

dalyIsaac avatar May 12 '24 02:05 dalyIsaac