core / pragma.session /

Package pragma.session #

Types #

NameSummary

DefaultSessionPlugin

class DefaultSessionPlugin(service: Service, contentDataNodeService: ContentDataNodeService, logger: Logger) : SessionPlugin, ConfigurablePlugin<DefaultSessionPluginConfig>

This plugin accepts a configurable number of entries, with a limit on the size of the keys and values.

SessionPlugin

interface SessionPlugin

The SessionContextPlugin provides the opportunity for performing server side validation and sanitization of state to be cached within a Pragma session

Functions #

NameSummary

notifyAllActiveSessionsImpl

internal fun <Request : Request, Response : GeneratedMessage> DistributedService.notifyAllActiveSessionsImpl(localNotificationRequest: Request, parseResponse: ParseFromFunction<Response>)

Direct-routes localNotificationRequest to every distributed instance of the calling service, including this one. The request is identical for each instance - only the routing target varies - and the response is empty, so callers pass a prebuilt request rather than a per-instance builder.

notifyLocalActiveSessionsImpl

internal suspend fun DistributedService.notifyLocalActiveSessionsImpl(sessionManager: SessionManager, notification: ExternalNotification, batchSize: Int = DEFAULT_NOTIFY_ALL_BATCH_SIZE, batchIntervalMillis: Long = DEFAULT_NOTIFY_ALL_BATCH_INTERVAL_MILLIS, pragmaIdOf: (PragmaSession) -> UUID)

Delivers notification to every session held by this instance.

stampRequestId

private fun ExternalMessage.Builder.stampRequestId(requestId: Int): ExternalMessage.Builder

Defense-in-depth: every executor stamps the request id onto the answer it builds (valid responses and errors alike, including bad-session/no-permission, which now receive the id), but every request also flows through this one choke point on the way out, so a future executor that forgets still cannot emit an answer a client is unable to correlate. Belt to the executors’ suspenders.

Properties #

NameSummary

DEFAULT_NOTIFY_ALL_BATCH_SIZE

internal const val DEFAULT_NOTIFY_ALL_BATCH_SIZE: Int = 500

Default batching for partner and operator broadcasts. Player sessions size their batches from PlayerSessionConfig because a shard can hold enough of them for an unthrottled fan-out to matter. Partner sessions default to these values through PartnerSessionConfig, with no inter-batch delay since partner connection counts are orders of magnitude smaller. Operator sessions always use these values.