Support for persistent, cross-connection REPL sessions.
Support for persistent, cross-connection REPL sessions.
(add-stdin h)
stdin middleware. Returns a handler that supports a "stdin" :op-eration, which adds content provided in a :stdin slot to the session's in Reader. Delegates to the given handler for other operations.
Requires the session middleware.
stdin middleware. Returns a handler that supports a "stdin" :op-eration, which adds content provided in a :stdin slot to the session's *in* Reader. Delegates to the given handler for other operations. Requires the session middleware.
(default-exec id thunk ack)
Submits a task for execution using #'default-executor. The submitted task is made of:
Submits a task for execution using #'default-executor. The submitted task is made of: * an id (typically the message id), * thunk, a Runnable, the task itself, * ack, another Runnable, ran to notify of successful execution of thunk. The thunk/ack split is meaningful for interruptible eval: only the thunk can be interrupted.
Delay containing the default Executor.
Delay containing the default Executor.
(session h)
Session middleware. Returns a handler which supports these :op-erations:
Messages indicating other operations are delegated to the given handler, with the session identified by the :session ID added to the message. If no :session ID is found, a new session is created (which will only persist for the duration of the handling of the given message).
Requires the interruptible-eval middleware (specifically, its binding of msg to the currently-evaluated message so that session-specific out and err content can be associated with the originating message).
Session middleware. Returns a handler which supports these :op-erations: * "clone", which will cause a new session to be retained. The ID of this new session will be returned in a response message in a :new-session slot. The new session's state (dynamic scope, etc) will be a copy of the state of the session identified in the :session slot of the request. * "interrupt", which will attempt to interrupt the current execution with id provided in the :interrupt-id slot. * "close", which drops the session indicated by the ID in the :session slot. The response message's :status will include :session-closed. * "ls-sessions", which results in a response message containing a list of the IDs of the currently-retained sessions in a :session slot. Messages indicating other operations are delegated to the given handler, with the session identified by the :session ID added to the message. If no :session ID is found, a new session is created (which will only persist for the duration of the handling of the given message). Requires the interruptible-eval middleware (specifically, its binding of *msg* to the currently-evaluated message so that session-specific *out* and *err* content can be associated with the originating message).
(session-exec id)
Takes a session id and returns a maps of three functions meant for interruptible-eval:
Takes a session id and returns a maps of three functions meant for interruptible-eval: * :exec, takes an id (typically a msg-id), a thunk and an ack runnables (see #'default-exec for ampler context). Executions are serialized and occurs on a single thread. * :interrupt, takes an id and tries to interrupt the matching execution (submitted with :exec above). A nil id is meant to match the currently running execution. The return value can be either: :idle (no running execution), the interrupted id, or nil when the running id doesn't match the id argument. Upon successful interruption the backing thread is replaced. * :close, terminates the backing thread.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close