The intercom Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The intercom Reference Manual

This is the intercom Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 04:53:24 2022 GMT+0.

Table of Contents


1 Introduction

h1. Intercom

Intercom is an easy to use library for high-level, bi-direcational communication between javascript and a lisp image with hunchentoot. It tries to optimize the amount of requests to the server and keeps the interface clean.

Features:
* JSON communication channel
* automatically adapting polling speed
* clean js and lisp RPC interface
* multiple responses per request
* requests can be canceled
* bundled requests and responses

h2. Simple Example

As a simple example, we create a remote procedure call which sends you a string every interval seconds, count times.

h3. Lisp implementation

To define a remote procedure in the lisp backend, you use the macro define-remote-procedure.

The first argument is the name of the remote procedure, which can be either a string or a symbol (which will be downcased). The following is an arg list, similar to what you would expect in a function definition. These values will be filled in with jsown objects (this can be lisp numbers, lisp lists, lisp strings or jsown representations of a javascript object).

Inside the body of the RPC definition, you have access to the message function. This sends a response for _this_ RPC to the client. The first argument is a type of the response, the second argument is a jsown instance, which represents the body. Remember, many lisp primitives are jsown objects.


  (define-remote-procedure echo (string count interval)
    (loop repeat count
       do (sleep interval)
	 (message "value" string))
    (message "ready" :true))

h3. Javascript implementation The javascript side uses a ks.Intercom object to interact with the server. The intercom object is initialized with the url of the server. Requests are made to the /talk interface of the server. To call a remote procedure on the server, you use the call function of an intercom object. This call function expects an object with the following properties: * *name* the name of the remote procedure to call * *args* the arguments to be passed to the remote procedure, as a list of JSON objects or javascript primitives. * *keys* when a message with this type is received, we stop listening for further requests for this RPC and call the onFinish function. * *onResponse* this function gets called when we receive a message from the server. The entire message object is passed in as an argument. * *onFinish* this function gets called when a message is received with a type in the keys list. It behaves exactly as the onResponse function.

  var intercom=new ks.Intercom({url:"/talk"});
  intercom.call({name:"test",
		    args:[10,2,1],
		    keys:["ready"],
		    onResponse:function(response){
			console.log("intermediate response: " +JSON.stringify(response));
		    },
		    onFinish:function(response){
			console.log("final response: "+ JSON.stringify(response));
		    }
		   });

The response argument that is passed in to the onResponse and onFinish function is a javascript object with the following properties: * *type* the type of response that was provided by the server. If this type is contained in the keys list of the call, the onFinish function is called instead of the onResponse function. * *body* the body of the response the actual content that is returned by the server. h3. What happens on the wire # Slow speed polling # intercom.call(...) # immediately send request + start high speed polling # responses arrive # ... # final resonse arrives + start slow speed polling Or in prosaic format: When no requests are running on the server, we poll the server at a slow speed (configurable through the defaultPollSpeed property of the intercom object in ms). When a call is made, this speed can be increased. At every poll to the server, we requests all messages that the server wishes to send and send them to the javascript client. At the client side, these responses are then handled by the appropriate request. When no active requests remain, the polling speed is decreased again. The fast pollspeed when there are open requests is obtained by taking the minimum of the following properties: * the minimum of the minSpeed properties of the open requests (for requests that specify this property) in ms. * the minimum of the result of the getSpeedAfterTime function of the open requests if such a function is specified. This function accepts a time in ms since the request was accepted and returns the pollspeed in ms. * the defaultPollSpeed property of the intercom object in ms. Please note that the polling mechanism is used as a heartbeat as well. As a result, we have had to limit the minimum pollSpeed to one poll per ten seconds. Values of more than 10000 will be interpreted as being equal to the maximum. Values smaller than zero will be assumed equal to zero (poll as soon as possible). h2. Javascript Features The API that is provided on the javascript side consists of the ks.Intercom class and its three public functions: call, cancel and complete. The call function has been described in some detail above. However, it is worth noting that the call function actually returns an object that can be used to cancel a request, as in the following example:

var request=intercom.call(
       {name:"echo",
	args:[{string:"foobar",
	       count:3,
	       interval:1}],
	keys:["ready"],
	onResponse:function(response){
	    console.log("received single response with body: "+response.body);
	},
	onFinish:function(response){
	    console.log("received final response with body: "+response.body);
	}
       });

...
    
results.intercom.cancel(request);

The cancel function expects an object that was created by the call function. It sends a message to the server to inform it that no further messages are required for the given request and also calls the complete function on the intercom object. The complete function also expects an object that was created by the call function. It simply tells the intercom object to stop listening for messages for the given request. It does not inform the server about this, as it is assumed the server already knows (this happens for instance when the server sends a message with a finalizing type). Users are not recommended to use the complete function, they should use the keys list of a request instead. h2. Lisp Features the implementation on te lisp side offers two 'special' features when defininig remote procedure calls. h3. RPC name The name of the RPC can either be a string or a symbol. When a string is used, this name can be used (case sensitive) for identifying the RPC in the javascript call. When a symbol is used, it is downcased and the downcased name is used for the javascript call. Let's build two example functions and check when each one is called when.

(define-remote-procedure echo (string)
  (message "result" string))

(define-remote-procedure "eCHo" (string)
  (message "result" (format nil "HELLO! ~A" string)))

The following javascript calls call both remote procedures.

intercom.call(
     {name:"echo",
      args:["Hello John"],
      keys:["result"],
      onFinish:function(response){
          console.log("echo resulted in " + response.body);
      }});

intercom.call(
     {name:"eCHo",
      args:["Hello Jake"],
      keys:["result"],
      onFinish:function(response){
          console.log("eCHo resulted in " + response.body);
      }});

They result in these messages to be logged on the console:

echo resulted in Hello John
eCHo resulted in HELLO! Hello Jake

h3. Keyword Arguments The &key argument in the parameter list in the definition of a remote procedure would traditionally be nonsensical when coming from a list of javascript objects. There's no way to generate keyword symbols from the javascript side. The use of the &key argument list destructures the javascript object and fetches the keys with that name from the javascript object. The name of the key to fetch is the lowercased name of the symbol. This allows for a slightly more javascript-style of passing complex arguments. Let's build two examples to show how this can make code i bit more readable.

(define-remote-procedure hello (friend-p &key first-name last-name)
  (message "result"
           (if friend-p
               (format nil "Hello ~A ~A" first-name last-name)
               (format nil "Hi ~A" first-name))))

(define-remote-procedure format-buy-car (&key title first-name last-name &key make type engine)
  (message "result"
           (format nil "~A ~A ~A is buying a ~A ~A with a ~A in it."
                   title first-name last-name make type engine)))

These examples can be called with the following javascript snippets:

intercom.call(
     {name:"hello",
      args:[false, {"first-name":"James", "last-name":"Dean"],
      keys:["result"],
      onFinish:function(response){
          console.log(response.body);
      }});

intercom.call(
     {name:"format-buy-car",
      args:[{title:"Mr.", "first-name":"Bill", "last-name":"Gates"},
            {make:"Seat",type:"Marbella",engine:"843cc"}],
      keys:["result"],
      onFinish:function(response){
          console.log(response.body);
      }});

h2. Performance Considerations For every RPC a new thread is built. If you have a lot active threads, this can hose your system.

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 intercom

Intercom allows bidirectional message passing between javascript and lisp.

Maintainer

Aad Versteden <aad@knowified.com>

Author

Aad Versteden <aad@knowified.com>

License

MIT

Version

0.0.1

Dependencies
  • jsown (system).
  • hunchentoot (system).
  • bordeaux-threads (system).
  • split-sequence (system).
  • alexandria (system).
Source

intercom.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

3.1.1 intercom/intercom.asd

Source

intercom.asd.

Parent Component

intercom (system).

ASDF Systems

intercom.


3.1.2 intercom/packages.lisp

Source

intercom.asd.

Parent Component

intercom (system).

Packages

intercom.


Previous: , Up: Lisp   [Contents][Index]

3.1.3 intercom/intercom.lisp

Dependency

packages.lisp (file).

Source

intercom.asd.

Parent Component

intercom (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 intercom

Source

packages.lisp.

Use List
  • alexandria.
  • common-lisp.
  • jsown.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Public Interface


Next: , Previous: , Up: Public Interface   [Contents][Index]

5.1.1 Special variables

Special Variable: *hydra-body-timeout*

the time we have before we assume the session has ended.

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-head-timeout*

the time we have before we assume the head is detached.

Package

intercom.

Source

intercom.lisp.

Special Variable: *log-request-stream*

when non-nil, this should be a character stream. an s-expression based log is written to the stream containing the ping-times, the requests and the responses for each user. the format is as follows:
- ping :: (ping utime hydra-body-id hydra-head-id ip-address)
- request :: (req utime hydra-body-id hydra-head-id request-id request-name arg1..argn)
- responses :: (res utime hydra-body-id hydra-head-id request-id time message-type message-value) - closes :: (close utime hydra-body-id hydra-head-id request-id)

Package

intercom.

Source

intercom.lisp.

Special Variable: *remote-procedure-context*

should contain an alist in which the keywords are special variables and the values are evaluated (in the creating thread) each time a remote procedure is built. this allows you to pass special variables.

Package

intercom.

Source

intercom.lisp.


5.1.2 Macros

Macro: define-remote-procedure (name (&rest arguments) &body body)

defines a remote procedure with <name> as the name to be called and <arguments> as the assumed arguments. if <name> is a symbol with only non- lower-case-p characters, then it is converted to lowercase.

Package

intercom.

Source

intercom.lisp.

Macro: threadable-lambda ((&rest arglist) &body body)

creates a lambda which can be threaded. it locally binds the variables which are needed by intercom.

Package

intercom.

Source

intercom.lisp.

Macro: with-error-as-fail (&body body)

executes <body> in an environment in which all errors are catched and sent as a message with type "fail" to the user.

Package

intercom.

Source

intercom.lisp.

Macro: with-screen-db-lock ((&optional session) &body body)

executes <body> with a lock on the datastore of hydra-head.
this should be used when the new value is based on previous values in the session.

Package

intercom.

Source

intercom.lisp.

Macro: with-session-db-lock ((&optional session) &body body)

executes <body> with a lock on the datastore of hydra-body.
this should be used when the new value is based on previous values in the session.

Package

intercom.

Source

intercom.lisp.


Previous: , Up: Public Interface   [Contents][Index]

5.1.3 Ordinary functions

Function: activep ()

returns non-nil if we are currently in an active remote procedure. alias for in-active-remote-procedure-p.

Package

intercom.

Source

intercom.lisp.

Function: add-screen-gc-callback (function &optional screen)

adds <function> to the list of functions to call on garbage collection of <screen>.

Package

intercom.

Source

intercom.lisp.

Function: add-session-gc-callback (function &optional session)

adds <function> to the list of functions to call on garbage collection of <session>.

Package

intercom.

Source

intercom.lisp.

Function: auto-end-remote-procedure-p ()

returns non-nil iff the end of the current remote-procedure indicates that the rid should be killed. setfable place defaults to t.

Package

intercom.

Source

intercom.lisp.

Function: (setf auto-end-remote-procedure-p) ()

sets the killing of the remote-procedure to <value>. non-nil indicates that the remote-procedure should be killed (the default), nil indicates the inverse.

Package

intercom.

Source

intercom.lisp.

Function: handle-talk-request ()

handle-talk-request handles a talk request.
splitting this off allows us to handle talking when easy-handlers aren’t in use.

Package

intercom.

Source

intercom.lisp.

Function: message (type body)

sends a message to the client

Package

intercom.

Source

intercom.lisp.

Function: remove-screen-gc-callback (function &optional screen)

removes <function> from the list of functions to call on the garbage collection of <screen>.

Package

intercom.

Source

intercom.lisp.

Function: remove-session-gc-callback (function &optional session)

removes <function> from the list of functions to call on the garbage collection of <session>.

Package

intercom.

Source

intercom.lisp.

Function: screen-var (key &optional screen)

returns the value of <key> which belongs to <screen>, or nil if it didn’t exist. the second value is non-nil iff <key> was found in <screen>.

Package

intercom.

Source

intercom.lisp.

Function: (setf screen-var) (key &optional screen)

sets the value of ,key> which belongs to <screen> to <value>.

Package

intercom.

Source

intercom.lisp.

Function: session-var (key &optional session)

returns the value of <key> which belongs to <session>, or nil if it didn’t exist. the second value is non-nil iff <key> was found in <session>.

Package

intercom.

Source

intercom.lisp.

Function: (setf session-var) (key &optional session)

sets the value of ,key> which belongs to <session> to <value>.

Package

intercom.

Source

intercom.lisp.

Function: translate-remote-procedure-name (name)

translates the remote procedure name <name> to the remote procedure name as can be called from the javascript world.

Package

intercom.

Source

intercom.lisp.


5.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.1 Special variables

Special Variable: *auto-kill-rid*

when this is set to non-nil in a given thread (which is the default for call-remote-procedure, then the ending of the call to call-remote-procedure signals the end of the rid. you can turn it on with #’auto-end-remote-procedure and turn it off with #’dont-auto-end-remote-procedure.

Package

intercom.

Source

intercom.lisp.

Special Variable: *current-thread-start-internal-runtime*

contains the internal runtime when this RPC call was started.

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-auth-lock*

this lock is used when accessing the hydra-auth-store

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-auth-store*

a hash-table linking each "hydra" cookie value to the authentication which belongs to it.

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-body*

contains the hydra-body once we have a hydra-body in the current request

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-head*

contains the hydra-head once we have one in the current request

Package

intercom.

Source

intercom.lisp.

Special Variable: *hydra-head-id*

represents the screen identifier of the current request

Package

intercom.

Source

intercom.lisp.

Special Variable: *log-stream-lock*

this lock should be held when writing to the log stream.

Package

intercom.

Source

intercom.lisp.

Special Variable: *remote-procedures*

contains all intercom remote procedures, the keywords being the matched string and the values being the corresponding function.

Package

intercom.

Source

intercom.lisp.

Special Variable: *rid*

variable which contains the request id in functions which represent the execution of a remote procedure.

Package

intercom.

Source

intercom.lisp.


5.2.2 Macros

Macro: assert-eql-compatible (place)

asserts that place is an eql-compatible place. this means it must be one of:
1. a symbol
2. a character
3. a number

Package

intercom.

Source

intercom.lisp.

Macro: assert-hydra-body (place)

asserts that <place> contains a hydra-body

Package

intercom.

Source

intercom.lisp.

Macro: assert-hydra-head (place)

asserts that <place> contains a hydra-head

Package

intercom.

Source

intercom.lisp.

Macro: assert-hydra-session-validation (place)

asserts that <place> contains a hydra-session

Package

intercom.

Source

intercom.lisp.

Macro: assert-nonempty-string (place)

asserts that <place> contains a non-empty string.

Package

intercom.

Source

intercom.lisp.

Macro: esc ((escape-symbol &key test return) &body body)
Package

intercom.

Source

intercom.lisp.

Macro: in-intercom-session (&body body)

executes a hunchentoot request in an environment in which the special local variables are bound to be special and local.
this contains:
- *hydra-body*
- *hydra-head*
- *hydra-head-id*

Package

intercom.

Source

intercom.lisp.

Macro: maybe-log-request (&body body)

executes <body> in an environment where the <log*> function is defined iff *log-request-stream* is non-nil. the <log*> function takes the type of content to log, followed by the content itself by &rest and it splices hydra-body-id hydra-head-id in that list.

Package

intercom.

Source

intercom.lisp.

Macro: with-doublequotes ((&rest variables) &body body)

makes sure each variable in variables is bound to itself, essentially allowing you to write ,, in a double backtick to get that symbol. handy for gensym.

Package

intercom.

Source

intercom.lisp.

Macro: with-hydra-auth-store-lock (&body body)

executes <body> in an environment in which *hydra-auth-store* is locked.

Package

intercom.

Source

intercom.lisp.

Macro: with-key-value-store-lock (store &body body)

executes body in an environment in which <store> is locked.

Package

intercom.

Source

intercom.lisp.

Macro: with-local-screen-lock ((protection-symbol) &body body)

executes <body> in a piece of code in which the head’s data is locked

Package

intercom.

Source

intercom.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.3 Ordinary functions

Function: assert-session ()

asserts that we’re currently running in an environment which is sane for intercom requests/executions

Package

intercom.

Source

intercom.lisp.

Function: attach-head (hydra-body hydra-head)

attaches <hydra-head> to <hydra-body>

Package

intercom.

Source

intercom.lisp.

Function: build-active-authentication (hydra-body)

builds a new authentication, which identifies hydra-body, and stores it in the necessary structures.

Package

intercom.

Source

intercom.lisp.

Function: build-active-hydra-body ()

builds a new hydra-body and sets it as the current hydra-body.

Package

intercom.

Source

intercom.lisp.

Function: call-remote-procedure (rid name &rest args)

calls the remote prodecure with name <name> and <args> as the arguments with <rid> as reference. assumes the special variables *hydra-head* and *hydra-body* exist and respectively contain a hydra-head and a hydra-body.

Package

intercom.

Source

intercom.lisp.

Function: close-request-logging (requests)

handles the logging of close requests

Package

intercom.

Source

intercom.lisp.

Function: copy-hydra-body (instance)
Package

intercom.

Source

intercom.lisp.

Function: copy-hydra-head (instance)
Package

intercom.

Source

intercom.lisp.

Function: copy-key-value-store (instance)
Package

intercom.

Source

intercom.lisp.

Function: copy-session-validation (instance)
Package

intercom.

Source

intercom.lisp.

Function: discover-hydra ()

discover-hydra returns non-nil iff we had a session-cookie through which we could find a hydra session-validation which is valid for our current session. this function sets up all special variables for the hydra to be happy. it also touches the hydra-body and the relevant hydra-head so we’re active.

Package

intercom.

Source

intercom.lisp.

Function: discover-hydra-body ()

returns non-nil iff we had a session-cookie through which we could find a hydra session-validation which is valid for our current session. this function sets up all special variables for the hydra-body,
but leaves the hydra-head for another solution to figure out.

Package

intercom.

Source

intercom.lisp.

Function: ensure-hhid ()

returns the hhid if one was given as a get-variable, or creates a new hhid. does *not* put the hhid on the message stack.
returns (values hhid newp). if newp is t, a message should be sent to the client (see (send-current-hhid)) so the client knows the hhid.

Package

intercom.

Source

intercom.lisp.

Function: ensure-hydra ()

ensures the hydra is set up. this means that:
- after this function execution:
- *hydra-head* is bound to the hydra’s head
- *hydra-body* is bound to the hydra’s body
- *hydra-auth-store* contains an authentication for continued storage - after this request:
- the user has a "hydra" cookie which links to this session.

Package

intercom.

Source

intercom.lisp.

Function: ensure-hydra-head (hydra-body)

ensures the hydra-head exists and is set in the variable *hydra-head*. assumes *hydra-body* is set. returns the current hydra-head.

Package

intercom.

Source

intercom.lisp.

Function: fetch-and-clear-messages ()

fetches and clears the messages in the mailbox

Package

intercom.

Source

intercom.lisp.

Function: gc-hydra-bodies ()

garbage collect the head hydras. this removes the session-validation objects and removes the head heads.

Package

intercom.

Source

intercom.lisp.

Function: gc-hydra-body (hydra-body)

garbage-collects a hydra-body

Package

intercom.

Source

intercom.lisp.

Function: gc-hydra-head (hydra-head)

garbage-collects a hydra-head

Package

intercom.

Source

intercom.lisp.

Function: gc-hydra-heads (hydra-body)

detaches the dead heads from <hydra-body>.

Package

intercom.

Source

intercom.lisp.

Function: generate-id ()

we generate an id by taking the universal time and augmenting it by some random number

Package

intercom.

Source

intercom.lisp.

Function: get-remote-procedure (name)

returns the remote procedure for <name> or nil if the procedure doesn’t exist.

Package

intercom.

Source

intercom.lisp.

Function: hash-keys (hash)

returns a list of all hash-keys in <hash>

Package

intercom.

Source

intercom.lisp.

Function: hydra-body-active-p (hydra)

returns non-nil iff the <hydra> hasn’t been touched for too long of a time.

Package

intercom.

Source

intercom.lisp.

Reader: hydra-body-atime (instance)
Writer: (setf hydra-body-atime) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

atime.

Reader: hydra-body-data (instance)
Writer: (setf hydra-body-data) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

data.

Reader: hydra-body-garbage-collected-body-p (instance)
Writer: (setf hydra-body-garbage-collected-body-p) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

garbage-collected-body-p.

Reader: hydra-body-gc-callbacks (instance)
Writer: (setf hydra-body-gc-callbacks) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

gc-callbacks.

Reader: hydra-body-heads (instance)
Writer: (setf hydra-body-heads) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

heads.

Function: hydra-body-p (object)
Package

intercom.

Source

intercom.lisp.

Function: hydra-head-active-p (hydra)

returns non-nil iff the <hydra> hasn’t been touched for too long of a time.

Package

intercom.

Source

intercom.lisp.

Reader: hydra-head-atime (instance)
Writer: (setf hydra-head-atime) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

atime.

Reader: hydra-head-data (instance)
Writer: (setf hydra-head-data) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

data.

Reader: hydra-head-garbage-collected-body-p (instance)
Writer: (setf hydra-head-garbage-collected-body-p) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

garbage-collected-body-p.

Reader: hydra-head-gc-callbacks (instance)
Writer: (setf hydra-head-gc-callbacks) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

gc-callbacks.

Reader: hydra-head-id (instance)
Writer: (setf hydra-head-id) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

id.

Function: hydra-head-p (object)
Package

intercom.

Source

intercom.lisp.

Function: in-active-remote-procedure-p ()

returns non-nil if we are currently in a remote procedure with an active rid.

Package

intercom.

Source

intercom.lisp.

Reader: key-value-store-hash (instance)
Writer: (setf key-value-store-hash) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

hash.

Reader: key-value-store-lock (instance)
Writer: (setf key-value-store-lock) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

lock.

Function: key-value-store-p (object)
Package

intercom.

Source

intercom.lisp.

Function: kv-store-read (key store)

reads the key from store

Package

intercom.

Source

intercom.lisp.

Function: (setf kv-store-read) (key store)

sets <key> in <store> to <value>

Package

intercom.

Source

intercom.lisp.

Function: make-hydra-body (&key data atime heads gc-callbacks garbage-collected-body-p)
Package

intercom.

Source

intercom.lisp.

Function: make-hydra-head (&key id data atime gc-callbacks garbage-collected-body-p)
Package

intercom.

Source

intercom.lisp.

Function: make-key-value-store (&key lock hash)
Package

intercom.

Source

intercom.lisp.

Function: make-log-message-string (type &rest args)

constructs a log message string for type and the followed arguments.

Package

intercom.

Source

intercom.lisp.

Function: make-remote-procedure-lambda-function (arguments body)

builds the s-expression representation for the lambda function which can be called for the definition of a remote procedure. this handles the creation of the &key arguments.

Package

intercom.

Source

intercom.lisp.

Function: make-session-validation (hydra-body cookie-identifier)

constructs a new session-validation object for the current session.

Package

intercom.

Source

intercom.lisp.

Function: mk-session-validation (&key hydra-id host user-agent hydra-body)
Package

intercom.

Source

intercom.lisp.

Function: perform-close-request (rid)

closes the request for the rid.

Package

intercom.

Source

intercom.lisp.

Function: perform-intercom-request (jsown-request)

performs an intercom request as described by <jsown-request>.

Package

intercom.

Source

intercom.lisp.

Function: ping-logging ()

handles the logging of the ping request

Package

intercom.

Source

intercom.lisp.

Function: register-remote-procedure (name function)

registers the remote procedure for <name> to be <function>.

Package

intercom.

Source

intercom.lisp.

Function: remove-hydra-validation (session-validation)

removes the session-validation <session-validation> from the known validations.

Package

intercom.

Source

intercom.lisp.

Function: remove-rid (rid)

removes the <rid> from the list of active rids

Package

intercom.

Source

intercom.lisp.

Function: request-logging (requests)

handles the logging of the new requests

Package

intercom.

Source

intercom.lisp.

Function: response-logging (responses)

handles the logging of the responses

Package

intercom.

Source

intercom.lisp.

Function: retrieve-hydra-validations (hydra-id)

returns all hydra session-varlidation instance which belong to the given hydra-id

Package

intercom.

Source

intercom.lisp.

Function: rid-active-p (rid &optional my-active-rids)

returns non-nil iff <rid> is active for the current user. by use of the variable my-active-rids, the currently active rids can be overridden. !only use when you know what you’re doing!

Package

intercom.

Source

intercom.lisp.

Function: s+ (&rest args)

pretty-prints and concatenates the resulting strings of each arg in <args>.

Package

intercom.

Source

intercom.lisp.

Function: send-current-hhid ()

sends the current hhid to the client by using the correct intercom message. requires that *hydra-head* and *hydra-head-id* are set correctly.

Package

intercom.

Source

intercom.lisp.

Reader: session-validation-host (instance)
Writer: (setf session-validation-host) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

host.

Reader: session-validation-hydra-body (instance)
Writer: (setf session-validation-hydra-body) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

hydra-body.

Reader: session-validation-hydra-id (instance)
Writer: (setf session-validation-hydra-id) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

hydra-id.

Function: session-validation-p (object)
Package

intercom.

Source

intercom.lisp.

Reader: session-validation-user-agent (instance)
Writer: (setf session-validation-user-agent) (instance)
Package

intercom.

Source

intercom.lisp.

Target Slot

user-agent.

Function: start-rid (rid)

sets <rid> to be active

Package

intercom.

Source

intercom.lisp.

Function: store-hydra-validation (session-validation)

stores the hydra session-validation so it can be found back.

Package

intercom.

Source

intercom.lisp.

Function: talk (&key)
Package

intercom.

Source

intercom.lisp.

Function: thread-initial-bindings ()

calculates the initial bindings for the current thread. this consists of whatever is available in bordeaux-threads:*initial-bindings*, but with what *remote-procedure* contains in front of it (in which the values are evaluated).

Package

intercom.

Source

intercom.lisp.

Function: valid-session-p (session-validation cookie-identifier)

validates the session-validation for the current request

Package

intercom.

Source

intercom.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

5.2.4 Generic functions

Generic Function: touch (object)

touches an object, updating the modification time.

Package

intercom.

Source

intercom.lisp.

Methods
Method: touch ((hydra hydra-head))
Method: touch ((hydra hydra-body))

Previous: , Up: Internals   [Contents][Index]

5.2.5 Structures

Structure: hydra-body
Package

intercom.

Source

intercom.lisp.

Direct superclasses

structure-object.

Direct methods

touch.

Direct slots
Slot: data
Initform

(intercom::make-key-value-store)

Readers

hydra-body-data.

Writers

(setf hydra-body-data).

Slot: atime
Initform

(get-universal-time)

Readers

hydra-body-atime.

Writers

(setf hydra-body-atime).

Slot: heads
Readers

hydra-body-heads.

Writers

(setf hydra-body-heads).

Slot: gc-callbacks
Readers

hydra-body-gc-callbacks.

Writers

(setf hydra-body-gc-callbacks).

Slot: garbage-collected-body-p
Readers

hydra-body-garbage-collected-body-p.

Writers

(setf hydra-body-garbage-collected-body-p).

Structure: hydra-head
Package

intercom.

Source

intercom.lisp.

Direct superclasses

structure-object.

Direct methods

touch.

Direct slots
Slot: id
Readers

hydra-head-id.

Writers

(setf hydra-head-id).

Slot: data
Initform

(intercom::make-key-value-store)

Readers

hydra-head-data.

Writers

(setf hydra-head-data).

Slot: atime
Initform

(get-universal-time)

Readers

hydra-head-atime.

Writers

(setf hydra-head-atime).

Slot: gc-callbacks
Readers

hydra-head-gc-callbacks.

Writers

(setf hydra-head-gc-callbacks).

Slot: garbage-collected-body-p
Readers

hydra-head-garbage-collected-body-p.

Writers

(setf hydra-head-garbage-collected-body-p).

Structure: key-value-store
Package

intercom.

Source

intercom.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: lock
Initform

(bordeaux-threads:make-recursive-lock "key-value-lock")

Readers

key-value-store-lock.

Writers

(setf key-value-store-lock).

Slot: hash
Initform

(make-hash-table)

Readers

key-value-store-hash.

Writers

(setf key-value-store-hash).

Structure: session-validation
Package

intercom.

Source

intercom.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: hydra-id
Type

string

Initform

""

Readers

session-validation-hydra-id.

Writers

(setf session-validation-hydra-id).

Slot: host
Type

string

Initform

""

Readers

session-validation-host.

Writers

(setf session-validation-host).

Slot: user-agent
Type

string

Initform

""

Readers

session-validation-user-agent.

Writers

(setf session-validation-user-agent).

Slot: hydra-body
Type

(or intercom::hydra-body null)

Readers

session-validation-hydra-body.

Writers

(setf session-validation-hydra-body).


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   (  
A   B   C   D   E   F   G   H   I   K   M   P   R   S   T   V   W  
Index Entry  Section

(
(setf auto-end-remote-procedure-p): Public ordinary functions
(setf hydra-body-atime): Private ordinary functions
(setf hydra-body-data): Private ordinary functions
(setf hydra-body-garbage-collected-body-p): Private ordinary functions
(setf hydra-body-gc-callbacks): Private ordinary functions
(setf hydra-body-heads): Private ordinary functions
(setf hydra-head-atime): Private ordinary functions
(setf hydra-head-data): Private ordinary functions
(setf hydra-head-garbage-collected-body-p): Private ordinary functions
(setf hydra-head-gc-callbacks): Private ordinary functions
(setf hydra-head-id): Private ordinary functions
(setf key-value-store-hash): Private ordinary functions
(setf key-value-store-lock): Private ordinary functions
(setf kv-store-read): Private ordinary functions
(setf screen-var): Public ordinary functions
(setf session-validation-host): Private ordinary functions
(setf session-validation-hydra-body): Private ordinary functions
(setf session-validation-hydra-id): Private ordinary functions
(setf session-validation-user-agent): Private ordinary functions
(setf session-var): Public ordinary functions

A
activep: Public ordinary functions
add-screen-gc-callback: Public ordinary functions
add-session-gc-callback: Public ordinary functions
assert-eql-compatible: Private macros
assert-hydra-body: Private macros
assert-hydra-head: Private macros
assert-hydra-session-validation: Private macros
assert-nonempty-string: Private macros
assert-session: Private ordinary functions
attach-head: Private ordinary functions
auto-end-remote-procedure-p: Public ordinary functions

B
build-active-authentication: Private ordinary functions
build-active-hydra-body: Private ordinary functions

C
call-remote-procedure: Private ordinary functions
close-request-logging: Private ordinary functions
copy-hydra-body: Private ordinary functions
copy-hydra-head: Private ordinary functions
copy-key-value-store: Private ordinary functions
copy-session-validation: Private ordinary functions

D
define-remote-procedure: Public macros
discover-hydra: Private ordinary functions
discover-hydra-body: Private ordinary functions

E
ensure-hhid: Private ordinary functions
ensure-hydra: Private ordinary functions
ensure-hydra-head: Private ordinary functions
esc: Private macros

F
fetch-and-clear-messages: Private ordinary functions
Function, (setf auto-end-remote-procedure-p): Public ordinary functions
Function, (setf hydra-body-atime): Private ordinary functions
Function, (setf hydra-body-data): Private ordinary functions
Function, (setf hydra-body-garbage-collected-body-p): Private ordinary functions
Function, (setf hydra-body-gc-callbacks): Private ordinary functions
Function, (setf hydra-body-heads): Private ordinary functions
Function, (setf hydra-head-atime): Private ordinary functions
Function, (setf hydra-head-data): Private ordinary functions
Function, (setf hydra-head-garbage-collected-body-p): Private ordinary functions
Function, (setf hydra-head-gc-callbacks): Private ordinary functions
Function, (setf hydra-head-id): Private ordinary functions
Function, (setf key-value-store-hash): Private ordinary functions
Function, (setf key-value-store-lock): Private ordinary functions
Function, (setf kv-store-read): Private ordinary functions
Function, (setf screen-var): Public ordinary functions
Function, (setf session-validation-host): Private ordinary functions
Function, (setf session-validation-hydra-body): Private ordinary functions
Function, (setf session-validation-hydra-id): Private ordinary functions
Function, (setf session-validation-user-agent): Private ordinary functions
Function, (setf session-var): Public ordinary functions
Function, activep: Public ordinary functions
Function, add-screen-gc-callback: Public ordinary functions
Function, add-session-gc-callback: Public ordinary functions
Function, assert-session: Private ordinary functions
Function, attach-head: Private ordinary functions
Function, auto-end-remote-procedure-p: Public ordinary functions
Function, build-active-authentication: Private ordinary functions
Function, build-active-hydra-body: Private ordinary functions
Function, call-remote-procedure: Private ordinary functions
Function, close-request-logging: Private ordinary functions
Function, copy-hydra-body: Private ordinary functions
Function, copy-hydra-head: Private ordinary functions
Function, copy-key-value-store: Private ordinary functions
Function, copy-session-validation: Private ordinary functions
Function, discover-hydra: Private ordinary functions
Function, discover-hydra-body: Private ordinary functions
Function, ensure-hhid: Private ordinary functions
Function, ensure-hydra: Private ordinary functions
Function, ensure-hydra-head: Private ordinary functions
Function, fetch-and-clear-messages: Private ordinary functions
Function, gc-hydra-bodies: Private ordinary functions
Function, gc-hydra-body: Private ordinary functions
Function, gc-hydra-head: Private ordinary functions
Function, gc-hydra-heads: Private ordinary functions
Function, generate-id: Private ordinary functions
Function, get-remote-procedure: Private ordinary functions
Function, handle-talk-request: Public ordinary functions
Function, hash-keys: Private ordinary functions
Function, hydra-body-active-p: Private ordinary functions
Function, hydra-body-atime: Private ordinary functions
Function, hydra-body-data: Private ordinary functions
Function, hydra-body-garbage-collected-body-p: Private ordinary functions
Function, hydra-body-gc-callbacks: Private ordinary functions
Function, hydra-body-heads: Private ordinary functions
Function, hydra-body-p: Private ordinary functions
Function, hydra-head-active-p: Private ordinary functions
Function, hydra-head-atime: Private ordinary functions
Function, hydra-head-data: Private ordinary functions
Function, hydra-head-garbage-collected-body-p: Private ordinary functions
Function, hydra-head-gc-callbacks: Private ordinary functions
Function, hydra-head-id: Private ordinary functions
Function, hydra-head-p: Private ordinary functions
Function, in-active-remote-procedure-p: Private ordinary functions
Function, key-value-store-hash: Private ordinary functions
Function, key-value-store-lock: Private ordinary functions
Function, key-value-store-p: Private ordinary functions
Function, kv-store-read: Private ordinary functions
Function, make-hydra-body: Private ordinary functions
Function, make-hydra-head: Private ordinary functions
Function, make-key-value-store: Private ordinary functions
Function, make-log-message-string: Private ordinary functions
Function, make-remote-procedure-lambda-function: Private ordinary functions
Function, make-session-validation: Private ordinary functions
Function, message: Public ordinary functions
Function, mk-session-validation: Private ordinary functions
Function, perform-close-request: Private ordinary functions
Function, perform-intercom-request: Private ordinary functions
Function, ping-logging: Private ordinary functions
Function, register-remote-procedure: Private ordinary functions
Function, remove-hydra-validation: Private ordinary functions
Function, remove-rid: Private ordinary functions
Function, remove-screen-gc-callback: Public ordinary functions
Function, remove-session-gc-callback: Public ordinary functions
Function, request-logging: Private ordinary functions
Function, response-logging: Private ordinary functions
Function, retrieve-hydra-validations: Private ordinary functions
Function, rid-active-p: Private ordinary functions
Function, s+: Private ordinary functions
Function, screen-var: Public ordinary functions
Function, send-current-hhid: Private ordinary functions
Function, session-validation-host: Private ordinary functions
Function, session-validation-hydra-body: Private ordinary functions
Function, session-validation-hydra-id: Private ordinary functions
Function, session-validation-p: Private ordinary functions
Function, session-validation-user-agent: Private ordinary functions
Function, session-var: Public ordinary functions
Function, start-rid: Private ordinary functions
Function, store-hydra-validation: Private ordinary functions
Function, talk: Private ordinary functions
Function, thread-initial-bindings: Private ordinary functions
Function, translate-remote-procedure-name: Public ordinary functions
Function, valid-session-p: Private ordinary functions

G
gc-hydra-bodies: Private ordinary functions
gc-hydra-body: Private ordinary functions
gc-hydra-head: Private ordinary functions
gc-hydra-heads: Private ordinary functions
generate-id: Private ordinary functions
Generic Function, touch: Private generic functions
get-remote-procedure: Private ordinary functions

H
handle-talk-request: Public ordinary functions
hash-keys: Private ordinary functions
hydra-body-active-p: Private ordinary functions
hydra-body-atime: Private ordinary functions
hydra-body-data: Private ordinary functions
hydra-body-garbage-collected-body-p: Private ordinary functions
hydra-body-gc-callbacks: Private ordinary functions
hydra-body-heads: Private ordinary functions
hydra-body-p: Private ordinary functions
hydra-head-active-p: Private ordinary functions
hydra-head-atime: Private ordinary functions
hydra-head-data: Private ordinary functions
hydra-head-garbage-collected-body-p: Private ordinary functions
hydra-head-gc-callbacks: Private ordinary functions
hydra-head-id: Private ordinary functions
hydra-head-p: Private ordinary functions

I
in-active-remote-procedure-p: Private ordinary functions
in-intercom-session: Private macros

K
key-value-store-hash: Private ordinary functions
key-value-store-lock: Private ordinary functions
key-value-store-p: Private ordinary functions
kv-store-read: Private ordinary functions

M
Macro, assert-eql-compatible: Private macros
Macro, assert-hydra-body: Private macros
Macro, assert-hydra-head: Private macros
Macro, assert-hydra-session-validation: Private macros
Macro, assert-nonempty-string: Private macros
Macro, define-remote-procedure: Public macros
Macro, esc: Private macros
Macro, in-intercom-session: Private macros
Macro, maybe-log-request: Private macros
Macro, threadable-lambda: Public macros
Macro, with-doublequotes: Private macros
Macro, with-error-as-fail: Public macros
Macro, with-hydra-auth-store-lock: Private macros
Macro, with-key-value-store-lock: Private macros
Macro, with-local-screen-lock: Private macros
Macro, with-screen-db-lock: Public macros
Macro, with-session-db-lock: Public macros
make-hydra-body: Private ordinary functions
make-hydra-head: Private ordinary functions
make-key-value-store: Private ordinary functions
make-log-message-string: Private ordinary functions
make-remote-procedure-lambda-function: Private ordinary functions
make-session-validation: Private ordinary functions
maybe-log-request: Private macros
message: Public ordinary functions
Method, touch: Private generic functions
Method, touch: Private generic functions
mk-session-validation: Private ordinary functions

P
perform-close-request: Private ordinary functions
perform-intercom-request: Private ordinary functions
ping-logging: Private ordinary functions

R
register-remote-procedure: Private ordinary functions
remove-hydra-validation: Private ordinary functions
remove-rid: Private ordinary functions
remove-screen-gc-callback: Public ordinary functions
remove-session-gc-callback: Public ordinary functions
request-logging: Private ordinary functions
response-logging: Private ordinary functions
retrieve-hydra-validations: Private ordinary functions
rid-active-p: Private ordinary functions

S
s+: Private ordinary functions
screen-var: Public ordinary functions
send-current-hhid: Private ordinary functions
session-validation-host: Private ordinary functions
session-validation-hydra-body: Private ordinary functions
session-validation-hydra-id: Private ordinary functions
session-validation-p: Private ordinary functions
session-validation-user-agent: Private ordinary functions
session-var: Public ordinary functions
start-rid: Private ordinary functions
store-hydra-validation: Private ordinary functions

T
talk: Private ordinary functions
thread-initial-bindings: Private ordinary functions
threadable-lambda: Public macros
touch: Private generic functions
touch: Private generic functions
touch: Private generic functions
translate-remote-procedure-name: Public ordinary functions

V
valid-session-p: Private ordinary functions

W
with-doublequotes: Private macros
with-error-as-fail: Public macros
with-hydra-auth-store-lock: Private macros
with-key-value-store-lock: Private macros
with-local-screen-lock: Private macros
with-screen-db-lock: Public macros
with-session-db-lock: Public macros

Jump to:   (  
A   B   C   D   E   F   G   H   I   K   M   P   R   S   T   V   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
A   D   G   H   I   L   S   U  
Index Entry  Section

*
*auto-kill-rid*: Private special variables
*current-thread-start-internal-runtime*: Private special variables
*hydra-auth-lock*: Private special variables
*hydra-auth-store*: Private special variables
*hydra-body*: Private special variables
*hydra-body-timeout*: Public special variables
*hydra-head*: Private special variables
*hydra-head-id*: Private special variables
*hydra-head-timeout*: Public special variables
*log-request-stream*: Public special variables
*log-stream-lock*: Private special variables
*remote-procedure-context*: Public special variables
*remote-procedures*: Private special variables
*rid*: Private special variables

A
atime: Private structures
atime: Private structures

D
data: Private structures
data: Private structures

G
garbage-collected-body-p: Private structures
garbage-collected-body-p: Private structures
gc-callbacks: Private structures
gc-callbacks: Private structures

H
hash: Private structures
heads: Private structures
host: Private structures
hydra-body: Private structures
hydra-id: Private structures

I
id: Private structures

L
lock: Private structures

S
Slot, atime: Private structures
Slot, atime: Private structures
Slot, data: Private structures
Slot, data: Private structures
Slot, garbage-collected-body-p: Private structures
Slot, garbage-collected-body-p: Private structures
Slot, gc-callbacks: Private structures
Slot, gc-callbacks: Private structures
Slot, hash: Private structures
Slot, heads: Private structures
Slot, host: Private structures
Slot, hydra-body: Private structures
Slot, hydra-id: Private structures
Slot, id: Private structures
Slot, lock: Private structures
Slot, user-agent: Private structures
Special Variable, *auto-kill-rid*: Private special variables
Special Variable, *current-thread-start-internal-runtime*: Private special variables
Special Variable, *hydra-auth-lock*: Private special variables
Special Variable, *hydra-auth-store*: Private special variables
Special Variable, *hydra-body*: Private special variables
Special Variable, *hydra-body-timeout*: Public special variables
Special Variable, *hydra-head*: Private special variables
Special Variable, *hydra-head-id*: Private special variables
Special Variable, *hydra-head-timeout*: Public special variables
Special Variable, *log-request-stream*: Public special variables
Special Variable, *log-stream-lock*: Private special variables
Special Variable, *remote-procedure-context*: Public special variables
Special Variable, *remote-procedures*: Private special variables
Special Variable, *rid*: Private special variables

U
user-agent: Private structures

Jump to:   *  
A   D   G   H   I   L   S   U