gunn.storage package¶
Submodules¶
gunn.storage.dedup_store module¶
Deduplication storage using SQLite for intent idempotency.
This module provides persistent storage for intent deduplication with TTL cleanup and warmup guards for relaxed deduplication after restart.
- class gunn.storage.dedup_store.DedupStore(db_path=':memory:', dedup_ttl_minutes=60, max_entries=10000, cleanup_interval_minutes=10, warmup_duration_minutes=5)[ソース]¶
ベースクラス:
object
SQLite-based deduplication store for intent idempotency.
Provides persistent storage for tracking processed intents with TTL-based cleanup and warmup guards for relaxed deduplication after restart.
Requirements addressed: - 3.3: Two-phase commit with idempotency checking - 10.1: Idempotent ingestion where duplicate req_id must not create duplicate effects - 10.2: TTL cleanup for expired entries
- パラメータ:
- async check_and_record(world_id, agent_id, req_id, global_seq)[ソース]¶
Check if intent was already processed and record if not.
- Args:
world_id: World identifier agent_id: Agent identifier req_id: Request identifier global_seq: Global sequence number for this intent
- Returns:
None if intent is new (and was recorded) Existing global_seq if intent was already processed
- Raises:
RuntimeError: If database is not initialized ValueError: If any identifier is empty
- async cleanup_expired()[ソース]¶
Clean up expired deduplication entries.
- 戻り値の型:
- Returns:
Number of entries cleaned up
- class gunn.storage.dedup_store.InMemoryDedupStore(dedup_ttl_minutes=60, max_entries=10000, warmup_duration_minutes=5)[ソース]¶
ベースクラス:
object
In-memory deduplication store for testing.
Provides the same interface as DedupStore but uses in-memory storage for faster testing without SQLite overhead.
- async check_and_record(world_id, agent_id, req_id, global_seq)[ソース]¶
Check if intent was already processed and record if not.
Module contents¶
Persistent storage layer.
This package provides storage components for the multi-agent simulation, including deduplication stores and snapshot management.
- class gunn.storage.DedupStore(db_path=':memory:', dedup_ttl_minutes=60, max_entries=10000, cleanup_interval_minutes=10, warmup_duration_minutes=5)[ソース]¶
ベースクラス:
object
SQLite-based deduplication store for intent idempotency.
Provides persistent storage for tracking processed intents with TTL-based cleanup and warmup guards for relaxed deduplication after restart.
Requirements addressed: - 3.3: Two-phase commit with idempotency checking - 10.1: Idempotent ingestion where duplicate req_id must not create duplicate effects - 10.2: TTL cleanup for expired entries
- パラメータ:
- async check_and_record(world_id, agent_id, req_id, global_seq)[ソース]¶
Check if intent was already processed and record if not.
- Args:
world_id: World identifier agent_id: Agent identifier req_id: Request identifier global_seq: Global sequence number for this intent
- Returns:
None if intent is new (and was recorded) Existing global_seq if intent was already processed
- Raises:
RuntimeError: If database is not initialized ValueError: If any identifier is empty
- async cleanup_excess_entries()[ソース]¶
Clean up excess entries when max_entries is exceeded.
- 戻り値の型:
- Returns:
Number of entries cleaned up
- async cleanup_expired()[ソース]¶
Clean up expired deduplication entries.
- 戻り値の型:
- Returns:
Number of entries cleaned up
- class gunn.storage.InMemoryDedupStore(dedup_ttl_minutes=60, max_entries=10000, warmup_duration_minutes=5)[ソース]¶
ベースクラス:
object
In-memory deduplication store for testing.
Provides the same interface as DedupStore but uses in-memory storage for faster testing without SQLite overhead.
- async check_and_record(world_id, agent_id, req_id, global_seq)[ソース]¶
Check if intent was already processed and record if not.