You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Add pluggable storage backend for session management
Refactors the session management system to use a pluggable storage
interface, enabling future support for distributed storage backends
like Redis/Valkey while maintaining backward compatibility.
What Changed
- Introduced a Storage interface that abstracts session persistence
- Refactored Manager to use the Storage interface instead of directly
using sync.Map
- Created LocalStorage implementation that maintains the existing
in-memory behavior
- Added JSON serialization support for sessions to enable future
network storage
- Extended Session interface with Type() and metadata methods that
were already implemented in concrete types
Why
The previous implementation was tightly coupled to in-memory storage,
making it impossible to share sessions across multiple ToolHive instances.
This refactoring enables:
- Horizontal scaling with shared session state
- Session persistence across restarts
- Future Redis/Valkey backend support without breaking changes
Testing
Added comprehensive unit tests covering:
- LocalStorage implementation
- Session serialization/deserialization
- Manager with pluggable storage
- All existing session types (ProxySession, SSESession, StreamableSession)
All tests pass and the implementation maintains full backward compatibility.
Signed-off-by: Juan Antonio Osorio <[email protected]>
0 commit comments