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.
(close-all-sessions!)
Use this fn to manually shut down all sessions. Since each new session spanws a new thread, and sessions need to be otherwise explicitly closed, we can accumulate too many active sessions for the JVM. This occurs when we are running tests in watch mode.
Use this fn to manually shut down all sessions. Since each new session spanws a new thread, and sessions need to be otherwise explicitly closed, we can accumulate too many active sessions for the JVM. This occurs when we are running tests in watch mode.
Executor for running eval requests in ephemeral sessions.
Executor for running eval requests in ephemeral sessions.
(make-ephemeral-exec-fn session msg)
Return an exec function that should be attached to ephemeral sessions.
Ephemeral exec fn does not persist dynamic bindings and uses
ephemeral-executor
. The submitted task is made of:
Return an exec function that should be attached to ephemeral sessions. Ephemeral exec fn does not persist dynamic bindings and uses `ephemeral-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
(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 session)
Takes a session and returns a map of three functions:
:exec
- takes an id (typically a msg-id), a thunk and an ack runnables.
Only thunk can be interrupted. Executions are serialized and occur 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.Takes a session and returns a map of three functions: - `:exec` - takes an id (typically a msg-id), a thunk and an ack runnables. Only thunk can be interrupted. Executions are serialized and occur 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