From 717eb0a1008572cc0e9a2f9ae8c6208ffd5feff7 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 17 Jan 2016 14:21:45 -0800 Subject: [PATCH] Added the "flush" extension to ASGI, and clarified group expiry --- docs/asgi.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/asgi.rst b/docs/asgi.rst index d2dbd3d..1eedf70 100644 --- a/docs/asgi.rst +++ b/docs/asgi.rst @@ -178,8 +178,9 @@ code, and so has been made optional in order to enable lightweight channel layers for applications that don't need the full feature set defined here. -There are two extensions defined here: the ``groups`` extension, which -is expanded on below, and the ``statistics`` extension, which allows +There are three extensions defined here: the ``groups`` extension, which +is expanded on below, the ``flush`` extension, which allows easier testing +and development, and the ``statistics`` extension, which allows channel layers to provide global and per-channel statistics. There is potential to add further extensions; these may be defined by @@ -285,7 +286,7 @@ A *channel layer* should provide an object with these attributes * ``extensions``, a list of unicode string names indicating which extensions this layer provides, or empty if it supports none. - The only valid extension names are ``groups`` and ``statistics`. + The only valid extension names are ``groups``, ``flush`` and ``statistics`. A channel layer implementing the ``groups`` extension must also provide: @@ -314,7 +315,12 @@ A channel layer implementing the ``statistics`` extension must also provide: * ``age``, how long the oldest message has been waiting, in seconds * ``per_second``, the number of messages processed in the last second +A channel layer implementing the ``flush`` extension must also provide: +* ``flush()``, a callable that resets the channel layer to no messages and + no groups (if groups is implemented). This call must block until the system + is cleared and will consistently look empty to any client, if the channel + layer is distributed. @@ -359,6 +365,10 @@ protocol servers should quit and hard restart if they detect that the channel layer has gone down or lost data; shedding all existing connections and letting clients reconnect will immediately resolve the problem. +If a channel layer implements the ``groups`` extension, it must persist group +membership until at least the time when the member channel has a message +expire due to non-consumption. + Message Formats ---------------