Commit 251f80c
authored
Unified TimeSeriesStore with pluggable backends, global rewrite of timed event storage (#1080)
* embeddings not generic, lsp added to dev deps
* Fix return type annotations for reactive pipe operators
- quality_barrier: Callable[[Observable[T]], Observable[T]]
- sharpness_barrier: Callable[[Observable[Image]], Observable[Image]]
* sketching a new embedding db
* benchmark prints loss heatmap
* typing
* get_data supports nested paths
* sensor storage sketch and pickle implementation
* Implement SensorStore convenience methods with drift-free streaming
- Implement find_closest(), first_timestamp(), iterate(), iterate_ts(),
iterate_realtime() methods using abstract _iter_items/_find_closest_timestamp
- Add scheduler-based stream() with absolute time reference to prevent timing
drift during long playback (ported from replay.py)
- Move imports to top of file, add proper typing throughout
- Fix pickledir.py mypy error (pickle.load returns Any)
* Add SqliteStore backend for sensor data
- Single-file SQLite storage with indexed timestamp queries
- BLOB storage for pickled sensor data
- INSERT OR REPLACE for duplicate timestamp handling
- Supports multiple tables per database (different sensors)
- Added to parametrized tests (15 tests across 3 backends)
* Add PostgresStore backend for sensor data
- PostgresStore implements SensorStore[T] + Resource for lifecycle management
- Multiple stores can share same database with different tables
- Tables created automatically on first save
- Tests are optional - skip gracefully if PostgreSQL not available
- Added psycopg2-binary and types-psycopg2 dependencies
- Includes reset_db() helper for simple migrations (drop/recreate)
* Add SQL identifier validation and fix mypy issues
- Validate table/database names in SqliteStore and PostgresStore
using regex (alphanumeric/underscore, not starting with digit)
- Fix Transform.to_pose() return type using TYPE_CHECKING import
- Add return type annotation to TF.get_pose()
- Fix ambiguous doclink in transports.md
* Make SqliteStore use get_data/get_data_dir like PickleDirStore
SqliteStore now accepts a name (e.g. "recordings/lidar") that gets
resolved via get_data_dir to data/recordings/lidar.db. Still supports
absolute paths and :memory: for backward compatibility.
* Require T to be Timestamped subclass in SensorStore
- Add TypeVar bound: T = TypeVar("T", bound=Timestamped)
- Simplify save() to always use data.ts (no more optional timestamp)
- Update tests to use SampleData(Timestamped) instead of strings
- SqliteStore accepts str | Path for backward compatibility
* consolidating old replay and new sensor store
* Add LegacyPickleStore backend for TimedSensorReplay compatibility
* legacy sensor store implemented, replay shim implemented
* replaced legacy replay with new system
* Remove import-untyped type ignores for consistency with dev
* Restore import-untyped type ignores for local mypy compatibility
Required when cupy/contact_graspnet are installed locally without type stubs.
* record/replay on modules
* Fix mypy errors: add psycopg2 stubs and xacro type ignore
- Add import-untyped to xacro type: ignore comment in mesh_utils.py
- Remove unused record/replay RPC methods from ModuleBase
* Decouple SensorStore from Timestamped type constraint
Remove the Timestamped bound from SensorStore's TypeVar, enabling storage
of arbitrary data types. Timestamps are now provided explicitly via
save(ts, data), with Timestamped convenience methods (save_ts, pipe_save_ts,
consume_stream_ts) as opt-in helpers. iterate_realtime() and stream() now
use stored timestamps instead of data.ts.
* CI code cleanup
* Fix ruff errors in embedding models
Fix import sorting in treid.py and suppress B027 for optional warmup()
in base.py.
* Remove unused EmbeddingModel.warmup method
* Remove unused warmup(), fix consume_stream callers
Remove dead EmbeddingModel.warmup() method. Update go2.py to use
consume_stream_ts() for the new SensorStore API.
* Rename SensorStore methods: Timestamped as default, raw for explicit ts
save/pipe_save/consume_stream now work with Timestamped data by default.
save_raw/pipe_save_raw/consume_stream_raw take explicit timestamps for
non-Timestamped data.
* Rename SensorStore to TimeSeriesStore
* Add _delete to all backends, fix find_closest and add/get/prune_old
Implement _delete for InMemoryStore, SqliteStore, PickleDirStore,
PostgresStore (LegacyPickleStore raises NotImplementedError). Fix
find_closest docstring placement and add get/add/prune_old convenience
methods.
* Add collection API to TimeSeriesStore, rewrite InMemoryStore with SortedKeyList
Replace InMemoryStore's dict + sorted-cache (O(n log n) rebuild on every write)
with SortedKeyList for O(log n) insert, delete, and range queries. Add collection
methods to TimeSeriesStore base: __len__, __iter__, last/last_timestamp, start_ts/
end_ts, time_range, duration, find_before/find_after, slice_by_time. Implement
backing abstract methods (_count, _last_timestamp, _find_before, _find_after) in
all five backends. Performance benchmarks confirm InMemoryStore matches
TimestampedCollection on 100k items.
* Rename memory/sensor to memory/timeseries, extract InMemoryStore to inmemory.py
Rename the module to better reflect its purpose. Extract InMemoryStore from
base.py into its own file (inmemory.py) to keep base.py focused on the abstract
TimeSeriesStore class. Update all internal and external imports.
* Simplify TimeSeriesStore: bound T to Timestamped, remove _raw methods, store T directly
- Bound T to Timestamped — no more raw/non-Timestamped data paths
- Removed save_raw, pipe_save_raw, consume_stream_raw
- InMemoryStore stores T directly in SortedKeyList (no _Entry wrapper)
- Removed duplicate-check on insert (same semantics as TimestampedCollection)
- Performance now at parity with TimestampedCollection
* tests reorganization
* replacing memory store in tf.py
* Fix mypy types: remove base get/add (TBuffer overrides), add None guards in tests
* Replace TimestampedCollection with InMemoryStore, remove dead code
- Delete TimestampedCollection class (replaced by InMemoryStore)
- Rewrite TimestampedBufferCollection to inherit InMemoryStore
- Remove TBuffer_old dead code from tf.py
- Fix prune_old mutation-during-iteration bug in base.py
- Break circular import with TYPE_CHECKING guard in base.py
- Update Image.py to use public API instead of _items access
- Update tests to use InMemoryStore directly
* delete legacy code
* removed small comment
* test fix, psql mypy
* fix(memory): import ModuleConfig from concrete module to fix mypy error
Import Module and ModuleConfig from dimos.core.module instead of the
lazy-loaded dimos.core namespace, which mypy sees as type Any.1 parent ad956e7 commit 251f80c
39 files changed
Lines changed: 2656 additions & 733 deletions
File tree
- dimos
- core
- mapping/pointclouds
- memory
- timeseries
- models/embedding
- msgs
- geometry_msgs
- sensor_msgs
- perception/detection/reid
- protocol
- pubsub/benchmark
- tf
- robot/unitree
- go2
- type
- types
- utils
- testing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | 82 | | |
84 | 83 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
33 | 32 | | |
34 | 33 | | |
35 | | - | |
| 34 | + | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments