Hi Larry, Côme, Rowan, Kévin,

A question of direction, since all of you have touched it from different 
sides.

The RFC today is deliberately the small end of something we know the 
full size of: Swerve (0.2, in release candidates) runs concurrent 
requests on top of the CLI SAPI with all of it isolated per request, 
through ext-scope and the phasync extension. Beyond the superglobals, 
the session, the locale and the timezone that the RFC covers, that means 
the whole of the request info (method, URI, query string, content type 
and length, cookies, auth), the request body and uploaded files, 
filter's raw input, REQUEST_TIME, and on the output side the 
output-buffer stack, zlib's compression state, the header list with 
headers_sent and the header callback, connection_status, and the 
shutdown functions. The output half is not just state to swap: it needs 
a per-request sink, which means a request/response contract that the 
server implements, with write, read, send headers and flush. Error 
handlers, ini_set() values, the last-error functions, setlocale(), 
chdir(), statics and $GLOBALS stay shared in that design too.

Two ways to get there from here:

1. Minimal, then opt in over time. Scope is an identity, and isolation 
is requested per concern with a bitmask, new Scope(isolate: 
Scope::REQUEST | Scope::TIMEZONE); an isolated concern starts fresh, an 
unisolated one is shared with the creator, and the engine gives core and 
extensions enter/leave hooks per bit so each owns its part. Later RFCs 
add bits; code that never asked for a bit is never affected by it, which 
I think answers both Larry's landmine and Côme's question. Scope::ALL 
means everything this version can isolate and grows like E_ALL. This RFC 
would define the mechanism and the first bits.

2. All in. The same mechanism, plus the request and response contract 
and the input/output bits, in one RFC. It is the complete picture, and 
it is the concurrent counterpart of Kévin's request lifecycle hooks, so 
the two could be designed together. It is also a much larger jump, and a 
much larger discussion.

I am not against the second; I started small because the first step is 
the one that has to be in the engine, and the rest can follow once it is 
in. But if you would rather see the whole shape before voting on any of 
it, I'd rather hear that now than after the vote opens.

Best regards,
Frode Børli

Reply via email to