Commit 6ab4638
authored
feat: implement advanced state API for Go and Python (#214)
- Go SDK: add state package with codec, keyed state, and structures
- codec: bool/bytes/float/int/string/uint/json and ordered types
- keyed: Value, List, Map, Aggregating, Reducing, PriorityQueue keyed
states
- structures: underlying implementations for each state type
- Python API: refactor store into codec, keyed, structures submodules
- keyed: KeyedValueState, KeyedListState, KeyedMapState, etc.
- structures: state structures aligned with Go
- Runtime: update fs_context to work with new state API
Made-with: Cursor
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Adds new Go and Python “advanced state” libraries and updates the Go
runtime context concurrency behavior, which could affect state access
and build/runtime integration. Main risk is correctness/performance of
the new state encodings (ordered codecs, merge/list packing) and any
assumptions about thread-safety after removing locking.
>
> **Overview**
> Introduces a new **Go advanced SDK** (`go-sdk-advanced`) providing
typed state abstractions (`ValueState`, `ListState`, `MapState`,
`PriorityQueueState`, `AggregatingState`, `ReducingState`) plus keyed
variants via factories, all backed by the existing low-level `Store` and
a new codec layer with ordered primitive codecs and `DefaultCodecFor`.
>
> Adds a new **Python advanced state package**
(`functionstream-api-advanced`) with parallel codec/state/keyed APIs and
packaging metadata, and wires builds/docs to recognize the new advanced
modules (Makefile `PYTHONPATH` update, `.gitignore` build output,
README/doc links, and new advanced-state API guides in EN/ZH).
>
> Also tweaks the Go SDK runtime context implementation by removing
internal mutex guarding `closed`/`stores`, changing thread-safety
expectations for `Emit`/`GetOrCreateStore`/`Close`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e93c4a4. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent f58af82 commit 6ab4638
81 files changed
Lines changed: 5944 additions & 56 deletions
File tree
- docs
- Go-SDK
- Python-SDK
- go-sdk-advanced
- codec
- keyed
- structures
- go-sdk
- impl
- state/common
- python
- functionstream-api-advanced
- src/fs_api_advanced
- codec
- keyed
- structures
- functionstream-api
- src/fs_api
- store
- functionstream-runtime
- src/fs_runtime
- store
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
209 | | - | |
| 209 | + | |
| 210 | + | |
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| |||
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
305 | 316 | | |
306 | 317 | | |
307 | 318 | | |
| |||
317 | 328 | | |
318 | 329 | | |
319 | 330 | | |
| 331 | + | |
| 332 | + | |
320 | 333 | | |
321 | 334 | | |
322 | 335 | | |
323 | 336 | | |
324 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
305 | 316 | | |
306 | 317 | | |
307 | 318 | | |
| |||
317 | 328 | | |
318 | 329 | | |
319 | 330 | | |
| 331 | + | |
| 332 | + | |
320 | 333 | | |
321 | 334 | | |
322 | 335 | | |
323 | 336 | | |
324 | | - | |
| 337 | + | |
0 commit comments