Documentation
¶
Overview ¶
Package storage provides persistent state used by the composite server.
Index ¶
- type DSNSelector
- type Dialect
- type EventAdapter
- func (a *EventAdapter) After(ctx context.Context, sessionID, streamID string, index int) iter.Seq2[[]byte, error]
- func (a *EventAdapter) Append(ctx context.Context, sessionID, streamID string, data []byte) error
- func (a *EventAdapter) Open(ctx context.Context, sessionID, streamID string) error
- func (a *EventAdapter) SessionClosed(ctx context.Context, sessionID string) error
- type Options
- type Registry
- type SQLStore
- func (s *SQLStore) After(ctx context.Context, sessionID, streamID string, index int) iter.Seq2[[]byte, error]
- func (s *SQLStore) Append(ctx context.Context, sessionID, streamID string, data []byte) error
- func (s *SQLStore) Close() error
- func (s *SQLStore) DB() *sql.DB
- func (s *SQLStore) Dialect() Dialect
- func (s *SQLStore) Open(ctx context.Context, sessionID, streamID string) error
- func (s *SQLStore) Prune(ctx context.Context) error
- func (s *SQLStore) SessionClosed(ctx context.Context, sessionID string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DSNSelector ¶
DSNSelector selects the complete effective configuration's DSN for the request that creates a stateful MCP session.
type EventAdapter ¶
type EventAdapter struct {
// contains filtered or unexported fields
}
EventAdapter binds each MCP session to the store selected by its first stream. Later requests cannot move that session to another database.
func NewEventAdapter ¶
func NewEventAdapter(registry *Registry, selectDSN DSNSelector) *EventAdapter
NewEventAdapter creates a session-affine event-store adapter.
func (*EventAdapter) After ¶
func (a *EventAdapter) After(ctx context.Context, sessionID, streamID string, index int) iter.Seq2[[]byte, error]
After replays from the store permanently bound to sessionID.
func (*EventAdapter) Open ¶
func (a *EventAdapter) Open(ctx context.Context, sessionID, streamID string) error
Open binds sessionID on first use and opens streamID in that store.
func (*EventAdapter) SessionClosed ¶
func (a *EventAdapter) SessionClosed(ctx context.Context, sessionID string) error
SessionClosed removes persisted events and releases the session binding.
type Options ¶
type Options struct {
// DataDirectory overrides the platform data directory used by an empty DSN.
DataDirectory string
// EventTTL controls how long inactive streams are retained.
EventTTL time.Duration
// MaxEventBytes bounds retained event payload bytes across all streams.
MaxEventBytes int64
// MaxOpenConns bounds PostgreSQL and MySQL pool size.
MaxOpenConns int
// MaxIdleConns bounds idle PostgreSQL and MySQL connections.
MaxIdleConns int
// ConnMaxLifetime limits connection reuse. The default remains below common
// MySQL and proxy idle limits.
ConnMaxLifetime time.Duration
// Now is used for retention decisions. It defaults to time.Now.
Now func() time.Time
}
Options controls database pooling and event retention.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry lazily opens and deduplicates stores by a non-reversible DSN digest. It owns every store it returns.
func NewRegistry ¶
NewRegistry creates a storage registry.
type SQLStore ¶
type SQLStore struct {
// contains filtered or unexported fields
}
SQLStore is a database/sql-backed Store.
func Open ¶
Open classifies and opens a supported SQL store, verifies it, and applies all dialect migrations before returning it to callers.
func (*SQLStore) After ¶
func (s *SQLStore) After(ctx context.Context, sessionID, streamID string, index int) iter.Seq2[[]byte, error]
After returns a stable snapshot strictly after index. It checks the purge watermark before reading any rows so callers never receive partial replay.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations embeds and applies storage schema migrations.
|
Package migrations embeds and applies storage schema migrations. |