commander/server
0.1.0Table of Contents
System Information
Definition Index
-
ORG.SHIRAKUMO.COMMANDER.SERVER
No documentation provided.-
EXTERNAL SPECIAL-VARIABLE *DEBUGGER*
Variable bound if the thread is currently in a debugging context.
-
EXTERNAL SPECIAL-VARIABLE *DEFAULT-REPL-BINDINGS*
List of symbols naming default REPL bindings. By default this should contain: *** ** * /// // / +++ ++ + - *package* *readtable You may push additional names onto this list to set other variables to rebind by default within local repl contexts.
-
EXTERNAL SPECIAL-VARIABLE *DEFAULT-STREAM-NAMES*
List of symbols naming default stream bindings. By default this should contain: *standard-output* *standard-input* *error-output* *query-io* *terminal-io* *trace-output* You may push additional names onto this list to set other streams to rebind by default within global server and local repl contexts.
-
EXTERNAL SPECIAL-VARIABLE *HANDLER*
No documentation provided. -
EXTERNAL SPECIAL-VARIABLE *SERVER*
Variable set to the currently running server, if any. See SERVER (type)
-
EXTERNAL CLASS BUFFERED-CLIENT-STREAM
No documentation provided. -
EXTERNAL CLASS CLIENT
No documentation provided. -
EXTERNAL CLASS CLIENT-STREAM
No documentation provided. -
EXTERNAL CLASS HANDLER
A message handler instance. This keeps the necessary context for message handling. Note that a handler by itself will RUN synchronously. In order to handle messages in a background thread instead, see THREADED-HANDLER. See CLIENT See BUSY-P See THREAD See QUEUE-MESSAGE See HANDLE-MESSAGE See RUN See ORG.SHIRAKUMO.COMMANDER.SUPPORT:NAMED (type) See ORG.SHIRAKUMO.COMMANDER.SUPPORT:START See ORG.SHIRAKUMO.COMMANDER.SUPPORT:STOP See ORG.SHIRAKUMO.COMMANDER.SUPPORT:RUN
-
EXTERNAL CLASS NULL-CLIENT-STREAM
No documentation provided. -
EXTERNAL CLASS ONESHOT-HANDLER
A handler that processes one message in a background thread and then stops. See HANDLER (type) See ORG.SHIRAKUMO.COMMANDER.SUPPORT:THREADED (type)
-
EXTERNAL CLASS REPL
A handler that maintains a REPL context. In addition to the usual handler responsibilities, this also maintains its own bindings of the usual repl state variables and streams. See *DEFAULT-REPL-BINDINGS* See *DEFAULT-STREAM-NAMES* See THREADED-HANDLER (type)
-
EXTERNAL CLASS SERVER
Representation of a commander server instance. The server is a singleton for all intents and purposes, as it makes no real sense to try and run multiple servers for a single lisp process. Thus, after starting a server, the *SERVER* variable is set to that instance. On START, the server will also switch out all streams named by the *DEFAULT-STREAM-NAMES* with SERVER-STREAMs. If you would like to prevent global reassignment, use something like WITH-SERVER, or WITH-REBINDING. Finally, the server will call INSTALL-HOOKS to set up global hooks. The default streams and hooks are restored on STOP of the server. See SOCKET See INTERFACE See PORT See IF-NO-CLIENTS See SYNCHRONOUS-RUN-P See CLIENTS See REGISTER See DEREGISTER See MAKE-ACTIVE-CLIENT See ACTIVE-CLIENT See MOVE-HANDLERS See WITH-SERVER See ORG.SHIRAKUMO.COMMANDER.SUPPORT:START See ORG.SHIRAKUMO.COMMANDER.SUPPORT:STOP See ORG.SHIRAKUMO.COMMANDER.SUPPORT:RUN See ORG.SHIRAKUMO.COMMANDER.SUPPORT:THREADED
-
EXTERNAL CLASS SERVER-STREAM
No documentation provided. -
EXTERNAL CLASS THREADED-HANDLER
A handler that processes messages in its own background thread. See HANDLER (type) See ORG.SHIRAKUMO.COMMANDER.SUPPORT:THREADED (type)
-
EXTERNAL FUNCTION INDENTATION-RULE
- NAME
No documentation provided. -
EXTERNAL FUNCTION (SETF INDENTATION-RULE)
- RULE
- NAME
No documentation provided. -
EXTERNAL FUNCTION INSTALL-HOOKS
Install global hooks. This will set INVOKE-DEBUGGER-HOOK as the current global debugger hook and also ensure it is bound as *DEBUGGER-HOOK* in new threads. See CL:*DEBUGGER-HOOK* See BORDEAUX-THREADS:*DEFAULT-SPECIAL-BINDINGS* See INVOKE-DEBUGGER-HOOK See INVOKE-EDITOR-HOOK See INVOKE-INSPECTOR-HOOK See RESTORE-HOOKS
-
EXTERNAL FUNCTION INVOKE-DEBUGGER-HOOK
- CONDITION
- HOOK
Function to serve as *DEBUGGER-HOOK*. When invoked, if *DEBUGGER-HOOK* is set, returns NIL. Otherwise invokes DEBUGGER-HOOK, passing on the arguments. See CL:*DEBUGGER-HOOK* See DEBUGGER-HOOK See INSTALL-HOOKS See RESTORE-HOOKS
-
EXTERNAL FUNCTION INVOKE-EDITOR-HOOK
- OBJECT
Function to serve in *EDITOR-HOOKS*. When invoked, if *SERVER* is set, passes the editing request on to the server. See INSTALL-HOOKS See RESTORE-HOOKS
-
EXTERNAL FUNCTION INVOKE-INSPECTOR-HOOK
- OBJECT
Function to serve for *INSPECTOR-HOOK*. When invoked, if *SERVER* is set, passes the inspection request on to the server. If not, or the server declines, calls the previously installed inspector hook. See INSTALL-HOOKS See RESTORE-HOOKS
-
EXTERNAL FUNCTION MAKE-CLIENT-STREAM
- CLIENT
- &OPTIONAL
- PURPOSE
- &REST
- ARGS
Create a new client stream for the given client. If :BUFFERING is T, a BUFFERED-CLIENT-STREAM is created. If the client refuses the stream, a NULL-CLIENT-STREAM is created. Otherwise a CLIENT-STREAM is created. See CLIENT-STREAM (type) See NULL-CLIENT-STREAM (type) See BUFFERED-CLIENT-STREAM (type)
-
EXTERNAL FUNCTION MAKE-SERVER-STREAM
- SERVER
- &OPTIONAL
- STREAM-NAME
- &REST
- ARGS
Creates a new server-stream. STREAM-NAME will designate the PURPOSE of the server-stream, and also be used to determine the value of the BACKING-STREAM via symbol-value. See SERVER-STREAM (type)
-
EXTERNAL FUNCTION RESTORE-HOOKS
Restores the previous global hooks. Restores whatever value was in place for the global debugger hook prior to INSTALL-DEBUGGER-HOOK being called. Does nothing if INSTALL-DEBUGGER-HOOK was not called. See CL:*DEBUGGER-HOOK* See BORDEAUX-THREADS:*DEFAULT-SPECIAL-BINDINGS* See INSTALL-HOOKS
-
EXTERNAL GENERIC-FUNCTION ACTIVE-CLIENT
- SERVER
Accesses the client currently considered to be the primary, "active" client, if any. The active client is the client used to invoke the debugger on. If you set this value to a client that is not connected, an error is signalled. See CLIENT (type) See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION (SETF ACTIVE-CLIENT)
- CLIENT
- SERVER
No documentation provided. -
EXTERNAL GENERIC-FUNCTION BACKING-STREAM
- OBJECT
Returns the original stream that this stream replaced, if any. See SERVER-STREAM (type)
-
EXTERNAL GENERIC-FUNCTION (SETF BACKING-STREAM)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION BUFFERING
- STREAM
Accesses whether the stream's output is buffered or not. The value can be one of: NIL --- Output is not buffered T --- Output is flushed when the buffer is full. :LINE --- Output is flushed when the buffer is full or a newline is reached. See CLIENT-STREAM (type) -
EXTERNAL GENERIC-FUNCTION (SETF BUFFERING)
- VALUE
- STREAM
No documentation provided. -
EXTERNAL GENERIC-FUNCTION BUSY-P
- OBJECT
Returns whether the handler is currently busy handling a message. See HANDLE-MESSAGE See HANDLER (type)
-
EXTERNAL GENERIC-FUNCTION (SETF BUSY-P)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CLIENT
- OBJECT
Returns the client instance the handler belongs to. See CLIENT (type) See HANDLER (type)
-
EXTERNAL GENERIC-FUNCTION (SETF CLIENT)
- CLIENT
- REPL
No documentation provided. -
EXTERNAL GENERIC-FUNCTION CLIENT-STREAM
- OBJECT
A stream that relays stream operations to the client via messages. This is a bidirectional character stream. By default this stream is *not* buffered, meaning any stream operation will result in a query to the client to perform the operation. Especially with remote clients and character-based operations this can be exceedingly slow. See CLIENT See PURPOSE See MAKE-CLIENT-STREAM See BUFFERING
-
EXTERNAL GENERIC-FUNCTION CLIENTS
- OBJECT
Returns a list of currently known clients. Note that the clients should be connected, but may no longer be connected by the time you investigate the list. As such the list can contain "useless" client instances. See SERVER (type) See CLIENT (type)
-
EXTERNAL GENERIC-FUNCTION (SETF CLIENTS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION DEBUGGER-HOOK
- CONDITION
- HOOK
Handles the given condition with the given object. If the object does not want to handle the condition, NIL is returned. By default, the function will check if a *SERVER* is running and if so invoke the debugger hook on that server. If it is not, or declines handling the condition, the previous debugger hook is invoked, if any. See INVOKE-DEBUGGER-HOOK
-
EXTERNAL GENERIC-FUNCTION DEREGISTER
- STREAM
- CLIENT
Deregisters the given object from the server. This is used to untrack SERVER-STREAMs, CLIENT-STREAMs, CLIENTs, and HANDLERs when they are closed. See REGISTER See SERVER (type) See SERVER-STREAM (type) See CLIENT-STREAM (type) See CLIENT (type) See HANDLER (type)
-
EXTERNAL GENERIC-FUNCTION ENSURE-HANDLER
- DEFAULT
- CLIENT
Ensures that a handler is present for the given thread. If the thread is NIL, a new handler is started every time. If the thread is T, the default handler is used. If the default handler does not exist, it is created. If the default handler is busy, a oneshot handler is created and returned instead. If the thread is an actual thread, the handler for that specific thread is used if it exists, or created if it does not. If the thread is not alive, an error is signalled. See HANDLER See HANDLER (type) See CLIENT (type)
-
EXTERNAL GENERIC-FUNCTION HANDLE-MESSAGE
- CLIENT
- MESSAGE
Function invoked to handle a message for a given client. Causes the requested command from the client to be executed. See ORG.SHIRAKUMO.COMMANDER.PROTOCOL:MESSAGE See CLIENT (type)
-
EXTERNAL GENERIC-FUNCTION HANDLER
- OBJECT
Returns the primary message handler instance for the client. See HANDLER (type) See CLIENT (type)
-
EXTERNAL GENERIC-FUNCTION (SETF HANDLER)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION IF-NO-CLIENTS
- OBJECT
Accesses what to do when the last client of the server disconnects. May be one of the following values: NIL --- Nothing happens, the server keeps running. :STOP --- The server is stopped, but the implementation keeps running. :QUIT --- The server is stopped and the implementation quits. See SERVER (type) -
EXTERNAL GENERIC-FUNCTION (SETF IF-NO-CLIENTS)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION INTERFACE
- OBJECT
Returns the interface on which the server socket will listen. See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION MOVE-HANDLERS
- TO
- FROM
- SERVER
Moves all handlers currently tied to the FROM client to the TO client. This allows you to move REPLs and other evaluation contexts from one handler to another, "passing" the context to them. If FROM is T, then all clients' handlers are moved. See CLIENT (type) See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION PORT
- OBJECT
Returns the port on which the server socket will listen. See ORG.SHIRAKUMO.COMMANDER.PROTOCOL:*STANDARD-PORT* See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION PURPOSE
- OBJECT
Returns the "purpose" of the stream. This is usually a symbol naming the stream that's backed by this stream, or another kind of name that identifies what the stream is supposed to be used for. See CLIENT-STREAM See SERVER-STREAM
-
EXTERNAL GENERIC-FUNCTION QUERY
- CLIENT
- MESSAGE
- &REST
- ARGS
Send a query and block until a reply is received. Once a reply has been received, that message is returned. If the reply never arrives (because the client is stopped, its stream breaks, or some other error), then NIL is returned instead. See SEND! See CLIENT (type)
-
EXTERNAL GENERIC-FUNCTION QUEUE-MESSAGE
- HANDLER
- MESSAGE
Queue the message for processing in the handler's context. See HANDLER (type) See ORG.SHIRAKUMO.COMMANDER.SUPPORT:MINIQUEUE-PUSH
-
EXTERNAL GENERIC-FUNCTION REGISTER
- STREAM
- CLIENT
Registers the given object with the server. This is used to track SERVER-STREAMs, CLIENT-STREAMs, CLIENTs, and HANDLERs. See DEREGISTER See SERVER (type) See SERVER-STREAM (type) See CLIENT-STREAM (type) See CLIENT (type) See HANDLER (type)
-
EXTERNAL GENERIC-FUNCTION REMOTE-EVAL
- CLIENT
- FORM
- &KEY
- PACKAGE
- &ALLOW-OTHER-KEYS
Runs the FORM on the remote server the CLIENT is connected to. Note that FORM must be a Lisp form which can be turned to a string representation via PRIN1. Further, the code will be evaluated in the given package on the server side. If the package is NIL, the *PACKAGE* will be whatever it is on the server side already. Returns whatever values are returned on the server side. See CLIENT (type) See WITH-REMOTE-EVAL
-
EXTERNAL GENERIC-FUNCTION RUN
- THREADED
The function to run within the THREADED's thread. Within primary methods of RUN, the threaded's THREAD is set, and the STOP restart is active. See THREADED (type)
-
EXTERNAL GENERIC-FUNCTION SERVER
- OBJECT
Returns the server instance associated with this object. See CLIENT (type) See SERVER-STREAM (type)
-
EXTERNAL GENERIC-FUNCTION SOCKET
- OBJECT
Returns the socket of the server, if any. See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION START
- THREADED
Starts the threaded if it is not yet alive. Upon return, ALIVE-P should be true. See THREADED (type) See ALIVE-P
-
EXTERNAL GENERIC-FUNCTION STOP
- THREADED
Stops the threaded if it is currently alive. If this is executed within the thread managed by the threaded, then the STOP restart is invoked. Otherwise if the thread is alive, the STOP restart is invoked within it. After calling this function, ALIVE-P should be false. See THREADED (type) See ALIVE-P
-
EXTERNAL GENERIC-FUNCTION SYNCHRONOUS-RUN-P
- OBJECT
Accesses whether the server should run synchronously in the calling thread when START is called. If NIL (the default), then a background thread is used instead. See ORG.SHIRAKUMO.COMMANDER.SUPPORT:START See ORG.SHIRAKUMO.COMMANDER.SUPPORT:RUN See SERVER (type)
-
EXTERNAL GENERIC-FUNCTION (SETF SYNCHRONOUS-RUN-P)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL GENERIC-FUNCTION THREAD
- OBJECT
The thread that the object manages, if any. See THREADED (type) See ALIVE-P
-
EXTERNAL GENERIC-FUNCTION (SETF THREAD)
- NEW-VALUE
- OBJECT
No documentation provided. -
EXTERNAL MACRO WITH-CLIENT-STREAMS
- CLIENT
- &OPTIONAL
- STREAMS
- &KEY
- SHARED
- &BODY
- BODY
Macro to rebind the streams named in STREAMS with client-streams for the given client. If SHARED is true, all streams named in STREAMS are bound to the same, single client-stream instance with the purpose set to the name of the first named stream if SHARED is T, and the value of SHARED otherwise. Otherwise all named streams are bound to their own, individual client-stream instances, with the purpose set to that stream's name. On exit from BODY, the client streams are CLOSEd and thus invalidated again. See CLIENT-STREAM (type) See MAKE-CLIENT-STREAM
-
EXTERNAL MACRO WITH-HOOKS
- &BODY
- BODY
Locally binds the hooks. This avoids affecting the debugger hook globally and only makes the change in the local thread. See INVOKE-DEBUGGER-HOOK See INVOKE-EDITOR-HOOK See INVOKE-INSPECTOR-HOOK See INSTALL-HOOKS See RESTORE-HOOKS
-
EXTERNAL MACRO WITH-REBINDING
- BINDINGS
- &BODY
- BODY
Rebinds the dynamic bindings of the given list of symbols. This prevents any changing of the bindings within BODY affecting the global environment.
-
EXTERNAL MACRO WITH-REMOTE-EVAL
- CLIENT
- &KEY
- PACKAGE
- &BODY
- BODY
No documentation provided. -
EXTERNAL MACRO WITH-SERVER
- INITARGS
- &BODY
- BODY
Helper macro to keep a server running within a limited context. This will rebind *SERVER* and the *DEFAULT-STREAM-NAMES* to protect them from being modified in the global context, create a new server instance, start it, then run body. On exit of body, the server is stopped. See *SERVER* See *DEFAULT-STREAM-NAMES* See ORG.SHIRAKUMO.COMMANDER.SUPPORT:WITH-REBINDING See ORG.SHIRAKUMO.COMMANDER.SUPPORT:START See ORG.SHIRAKUMO.COMMANDER.SUPPORT:STOP
-