Documentation
¶
Overview ¶
Package idmap maps gateway-assigned request IDs to backend server request IDs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithEntryTTL ¶ added in v0.6.0
WithEntryTTL sets the safety-net TTL for Redis-backed entries. Only applies when a Redis client is configured.
func WithRedisClient ¶ added in v0.6.0
WithRedisClient configures the Map to use an existing Redis client.
Types ¶
type Entry ¶
type Entry struct {
BackendID any `json:"backendID"` // per mcp spec, the ID can be string, int64, or float64
ServerName string `json:"serverName"`
SessionID string `json:"sessionID"`
GatewaySessionID string `json:"gatewaySessionID"`
}
Entry holds a backend request ID and its associated server/session info.
type Map ¶
type Map interface {
// Store a new id mapping, returning the downstream gateway id
Store(ctx context.Context, backendID any, serverName string, sessionID string, gatewaySessionID string) (string, error)
// Lookup gets an entry for a gateway id without removing it.
// Callers must call Remove explicitly after successful processing.
Lookup(ctx context.Context, gatewayID string) (Entry, bool, error)
// Remove is explicit best-effort removal for a gateway id
Remove(ctx context.Context, gatewayID string)
}
Map stores and retrieves request ID mappings.
Click to show internal directories.
Click to hide internal directories.