Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

remote-mailbox

  1. Outdated egg!
  2. remote-mailbox
  3. Documentation
    1. Common Parameters
      1. default-remote-mailbox-tcp-port
      2. default-remote-mailbox-hostname
    2. Client
      1. Usage
      2. default-remote-mailbox-connect
      3. default-remote-mailbox-hostname
      4. remote-mailbox
      5. remote-mailbox?
      6. remote-mailbox-name
      7. remote-mailbox-tcp-port
      8. remote-mailbox-connected?
      9. remote-mailboxes
      10. remote-mailbox-send!
      11. drop-remote-mailbox!
      12. drop-remote-mailboxes!
    3. Server
      1. Usage
      2. default-remote-mailbox-listen
      3. default-remote-mailbox-auto-create?
      4. make-remote-mailbox-server
      5. make-remote-mailbox-server-thread
      6. remote-mailbox-server?
      7. remote-mailbox-server-name
      8. remote-mailbox-server-auto-create?
      9. remote-mailbox-server-listener
      10. remote-mailbox-server-request-limit
      11. remote-mailbox-server-debug
      12. remote-mailbox-server-start!
      13. remote-mailbox-server-run!
      14. local-mailbox-for-server
      15. drop-local-mailbox!-for-server
      16. local-mailbox-names-for-server
      17. local-mailbox
      18. local-mailbox-start!
      19. local-mailbox-server
      20. local-mailbox-thread
    4. Adapter
      1. Usage
      2. serializer
      3. deserializer
      4. deserializer-input
      5. serializer-output
      6. serialize
      7. deserialize
  4. Requirements
  5. Bugs and Limitations
  6. Author
  7. Version history
  8. License

Documentation

Purports to provide an API for sending and receiving remote messages. This egg attempts to duplicate the mailbox egg semantics across an IP connection.

Common Parameters

default-remote-mailbox-tcp-port

[parameter] (default-remote-mailbox-tcp-port [TCP-PORT]) -> fixnum

The standard port number to establish a remote mailbox connection.

Defaults to the environment variable REMOTE-MAILBOX-TCP-PORT, or 63001 if undefined at startup.

default-remote-mailbox-hostname

[parameter] (default-remote-mailbox-hostname [HOSTNAME]) -> string

The host name to establish a remote mailbox connection.

Defaults to the environment variable REMOTE-MAILBOX-HOSTNAME, or "localhost" if undefined at startup.

Client

Usage

(require-extension remote-mailbox-client)

default-remote-mailbox-connect

[parameter] (default-remote-mailbox-connect [PROCEDURE]) -> procedure

The procedure used to establish network connections for a remote mailbox. Defaults to tcp-connect and must be signature-compatible.

default-remote-mailbox-hostname

[parameter] (default-remote-mailbox-hostname REMOTE-MAILBOX)

Returns the REMOTE-MAILBOX hostname.

remote-mailbox

[procedure] (remote-mailbox NAME [#:hostname HOSTNAME] [#:tcp-port TCP-PORT] [#:connect CONNECT]) -> remote-mailbox

Returns a unique remote-mailbox object for the specified NAME.

HOSTNAME
A string. Defaults to (default-remote-mailbox-tcp-port).
TCP-PORT
A fixnum in [0 65535] or #f. Defaults to (default-remote-mailbox-hostname).
CONNECT
A procedure. Defaults to (default-remote-mailbox-connect).

When TCP-PORT is #f the HOSTNAME must contain the port or service.

remote-mailbox?

[procedure] (remote-mailbox? OBJECT)

Is the OBJECT a valid remote-mailbox?

remote-mailbox-name

[procedure] (remote-mailbox-name REMOTE-MAILBOX)

Returns the REMOTE-MAILBOX name.

remote-mailbox-tcp-port

[procedure] (remote-mailbox-tcp-port REMOTE-MAILBOX)

Returns the REMOTE-MAILBOX tcp-port.

remote-mailbox-connected?

[procedure] (remote-mailbox-connected? REMOTE-MAILBOX)

Is the REMOTE-MAILBOX connected? (Has it been used?)

remote-mailboxes

[procedure] (remote-mailboxes) -> (list-of remote-mailbox)

Returns mailboxes.

remote-mailbox-send!

[procedure] (remote-mailbox-send! REMOTE-MAILBOX OBJECT)

Transmit the OBJECT to the REMOTE-MAILBOX.

drop-remote-mailbox!

[procedure] (drop-remote-mailbox! REMOTE-MAILBOX)

Invalidate and forget the REMOTE-MAILBOX.

drop-remote-mailboxes!

[procedure] (drop-remote-mailboxes!)

Invalidate and forget all the remote mailboxes. Performs a reset to the initial state.

Server

Usage

(require-extension remote-mailbox-server)

default-remote-mailbox-listen

[parameter] (default-remote-mailbox-listen [PROCEDURE]) -> procedure

The procedure used to establish network connections for a remote mailbox. Defaults to tcp-listen and must be signature-compatible.

default-remote-mailbox-auto-create?

[parameter] (default-remote-mailbox-auto-create? [AUTO-CREATE?]) -> boolean

Automatically create local-mailbox? Defaults to #t.

make-remote-mailbox-server

[procedure] (make-remote-mailbox-server [#:name NAME] [#:tcp-port TCP-PORT] [#:listen LISTEN] [#:request-limit REQUEST-LIMIT] [#:auto-create? AUTO-CREATE?] [#:debug DEBUG])

Creates and returns a remote-mailbox-server. Uses make-tcp-server to create a server procedure. The server threads spawned by this procedure are continuously processing remote mailbox sends until the connection is closed.)

NAME
Defaults to remote-mailbox-server:#
TCP-PORT
Defaults to (default-remote-mailbox-tcp-port)
LISTEN
Defaults to (default-remote-mailbox-listen)
REQUEST-LIMIT
The tcp-server upper limit for currently executing requests. Defaults to 10000.
AUTO-CREATE?
Automatically create local-mailbox. Defaults to #t
DEBUG
Print tcp diagnostics with DEBUG prefix when true. Defaults to #f

make-remote-mailbox-server-thread

[procedure] (make-remote-mailbox-server-thread REMOTE-MAILBOX-SERVER) -> thread

Returns a thread that, when started, will run the REMOTE-MAILBOX-SERVER.

remote-mailbox-server?

[procedure] (remote-mailbox-server? OBJECT) -> boolean

Is the OBJECT a remote-mailbox-server?

remote-mailbox-server-name

[procedure] (remote-mailbox-server-name REMOTE-MAILBOX-SERVER) -> string

Returns the name of the specified REMOTE-MAILBOX-SERVER.

remote-mailbox-server-auto-create?

[procedure] (remote-mailbox-server-auto-create? REMOTE-MAILBOX-SERVER) -> boolean

remote-mailbox-server-listener

[procedure] (remote-mailbox-server-listener REMOTE-MAILBOX-SERVER) -> procedure

Returns the listener object for the specified REMOTE-MAILBOX-SERVER.

remote-mailbox-server-request-limit

[procedure] (remote-mailbox-server-request-limit REMOTE-MAILBOX-SERVER) -> fixnum

remote-mailbox-server-debug

[procedure] (remote-mailbox-server-debug REMOTE-MAILBOX-SERVER)

remote-mailbox-server-start!

[procedure] (remote-mailbox-server-start! REMOTE-MAILBOX-SERVER)

Starts the server in a thread continuously processing remote mailbox sends until the connection is closed.

Returns the started thread.

remote-mailbox-server-run!

[procedure] (remote-mailbox-server-run! REMOTE-MAILBOX-SERVER)

Starts the server continuously processing remote mailbox sends until the connection is closed.

local-mailbox-for-server

[procedure] (local-mailbox-for-server REMOTE-MAILBOX-SERVER NAME) -> mailbox

Returns the mailbox of NAME for REMOTE-MAILBOX-SERVER (a mailbox object as returned by the procedure make-mailbox). Should the mailbox not exist it will be created if the REMOTE-MAILBOX-SERVER has a true AUTO-CREATE? flag, otherwise returns #f.

To receive remote messages:

(mailbox-receive! (local-mailbox-for-server REMOTE-MAILBOX-SERVER NAME))

drop-local-mailbox!-for-server

[procedure] (drop-local-mailbox!-for-server REMOTE-MAILBOX-SERVER NAME)

Forget the server's mailbox.

local-mailbox-names-for-server

[procedure] (local-mailbox-names-for-server REMOTE-MAILBOX-SERVER)

Returns a list of all the names of the mailboxes created for the server.

local-mailbox

[procedure] (local-mailbox NAME [DEBUG])

This is a convenience interface and only recommended for the simplest of situations.

When NAME is:

default-remote-mailbox-server-thread
returns the thread for the default server.
default-remote-mailbox-server
returns the default server record.
<other symbol>
returns the mailbox for NAME.

The DEBUG argument is passed on to tcp-server which will print tcp diagnostics with DEBUG as a prefix. The other parameters to make-remote-mailbox-server are defaulted.

The default server is created and run in a separate thread upon the first call.

To receive remote messages:

(mailbox-receive! (local-mailbox NAME))

local-mailbox-start!

[procedure] (local-mailbox-start! [DEBUG])

What local-mailbox does upon the first invocation.

local-mailbox-server

[procedure] (local-mailbox-server) -> remote-mailbox-server

The remote-mailbox-server object for local-mailbox.

local-mailbox-thread

[procedure] (local-mailbox-thread) -> thread

The thread object for local-mailbox.

Adapter

Usage

(require-extension remote-mailbox-adapter)

serializer

[parameter] (serializer [PROCEDURE]) -> procedure

Parameter for Scheme object serialization procedure. Default is s11n::serialize.

deserializer

[parameter] (deserializer [PROCEDURE]) -> procedure

Parameter for Scheme object deserialization procedure. Default is s11n::deserialize.

deserializer-input

[parameter] (deserializer-input [INPUT-PORT]) -> input-port

Parameter for deserialization procedure input. Default is (current-input-port).

serializer-output

[parameter] (serializer-output [OUTPUT-PORT]) -> output-port

Parameter for serialization procedure output. Default is (current-output-port).

serialize

[procedure] (serialize OBJECT [OUTPUT-PORT (serializer-output)])

Serialize the OBJECT to the OUTPUT-PORT.

deserialize

[procedure] (deserialize [INPUT-PORT (deserializer-input)]) -> *

Deserialize the OBJECT from the INPUT-PORT.

Requirements

tcp-server s11n mailbox miscmacros moremacros synch lookup-table type-errors

setup-helper

Bugs and Limitations

Author

Kon Lovett

Version history

2.2.0
Add types. Add local-mailbox-for-server, drop-local-mailbox!-for-server, local-mailbox-names-for-server.
2.1.2
2.1.1
2.1.0
Add remote-mailbox-adapter. Remove default-remote-mailbox-serializer, default-remote-mailbox-deserializer, & associated parameters.
2.0.1
Explicit requirements.
2.0.0
Initial Chicken 4 release.

License

Copyright (C) 2009-2018 Kon Lovett. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.