Commit 3b7e68e
authored
chore: Add read/write mode support for persistent store. (#206)
Adds support for controlling the read/write mode of the persistent
store.
Added an exception for failure to write to the persistent store.
Adds a test suite for the WriteThroughStore.
Almost the entire PR size is from tests.
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Adds persistence mode to `WriteThroughStore` with conditional
writes/init and improved apply error handling; wires mode in
`FDv2DataSystem`; introduces a comprehensive test suite.
>
> - **Data system**:
> - `FDv2DataSystem`: Pass
`configuration.DataSystem.PersistentDataStoreMode` to
`WriteThroughStore`.
> - **Data store**:
> - `WriteThroughStore`:
> - Add `_persistenceMode` and ctor param to control persistent store
behavior.
> - Init/Upsert/Apply write to persistent store only in `ReadWrite`
mode; `ReadOnly` skips writes.
> - Switch active read store to memory on first initializing payload;
`Initialized()` uses `_activeReadStore`.
> - In legacy persistence path, throw on failed apply (partial upserts)
with clear exception message.
> - **Tests**:
> - New `WriteThroughStoreTest`: covers constructor behavior,
init/get/getAll, upsert, apply (transactional vs legacy), store
switching, initialized/selector/status monitoring, dispose, and error
handling (including switch-to-memory on persistence failures).
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
0e23440. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 0d809f0 commit 3b7e68e
File tree
3 files changed
+1030
-17
lines changed- pkgs/sdk/server
- src/Internal/DataSystem
- test/Internal/DataSystem
3 files changed
+1030
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
Lines changed: 24 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | | - | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
59 | | - | |
60 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
73 | 80 | | |
74 | 81 | | |
75 | 82 | | |
76 | | - | |
| 83 | + | |
77 | 84 | | |
78 | 85 | | |
79 | 86 | | |
| |||
86 | 93 | | |
87 | 94 | | |
88 | 95 | | |
89 | | - | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
93 | 100 | | |
94 | 101 | | |
| 102 | + | |
95 | 103 | | |
96 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
97 | 107 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
103 | 115 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | 119 | | |
110 | | - | |
111 | | - | |
112 | 120 | | |
113 | 121 | | |
114 | 122 | | |
| |||
0 commit comments