Liking cljdoc? Tell your friends :D

convex.server

Creating a peer which can either:

  • Run alone for dev and test
  • Run locally, synced with other local peers
  • Run locally but synced with the test network on convex.world

See README.

Creating a peer which can either:

- Run alone for dev and test
- Run locally, synced with other local peers
- Run locally but synced with the test network on `convex.world`

See README.
raw docstring

controllerclj

(controller server)

Returns the controller associated with server.

It was either explicitly specified in create or retrieved from the state.

Returns the controller associated with `server`.

It was either explicitly specified in [[create]] or retrieved from the state.
sourceraw docstring

createclj

(create keypair)
(create keypair option+)

Returns a new server that can be started using start when required.

A key pair is mandatory. See the convex.key-pair.

An map of options may be provided:

KeyValueDefault
:convex.server/bindBind address (string)"localhost"
:convex.server/stateSee below[:genesis]
:convex.server/controllerController account addressRetrieved from state
:convex.server/dbDatabase (see :module/cvm)Default temp instance created automatically
:convex.server/n-peerMaximum number of other peers this one should broadcast to20
:convex.server/persist-at-stop? | True if peer data should be persisted in DB when stopped |true`
:convex.server/portPort18888
`:convex.server/urlURL of this peer (string) that will be registered on chain/

The URL, if given, is stored on-chain so that other peers can use it to broadcast beliefs and state updates. It is typically different from :convex.server/bind and :convex.server/port. For instance, convex.world has registered URL convex.world:18888 in on-chain peer data, it is publicly accessible to all peers which wants to broadcast data to it.

A peer needs initial state optionally specified in :convex.server/state which is a vector. Either:

Item 0Item 1Does
:genesis/Creates new genesis state from scratch
:db/Restores state from :convex.server/db
:syncOption mapPerforms peer syncing (see below)
:useState cellAdvanced. Uses given convex.core.State cell

Peer syncing retrieves state from the given peer and connection will automatically be formed to that other peer at start, forming a network. The option map may specify:

KeyValueDefault
:convex.server/hostAddress of the remote peer"localhost"
:convex.server/portPort of the remote peer18888
Returns a new server that can be started using [[start]] when required.

A key pair is mandatory. See the [[convex.key-pair]].

An map of options may be provided:

| Key                              | Value                                                      | Default                                     |
|----------------------------------|------------------------------------------------------------|---------------------------------------------|
| `:convex.server/bind`            | Bind address (string)                                      | `"localhost"`                             |
| `:convex.server/state`           | See below                                                  | `[:genesis]`                                |
| `:convex.server/controller`      | Controller account address                                 | Retrieved from state                        |
| `:convex.server/db`              | Database (see `:module/cvm`)                               | Default temp instance created automatically |
| `:convex.server/n-peer`          | Maximum number of other peers this one should broadcast to | `20`                                        |
| `:convex.server/persist-at-stop? | True if peer data should be persisted in DB when stopped   | `true`                                      |
| `:convex.server/port`            | Port                                                       | `18888`                                     |
| `:convex.server/url              | URL of this peer (string) that will be registered on chain | /                                           |

The URL, if given, is stored on-chain so that other peers can use it to broadcast beliefs and state updates.
It is typically different from `:convex.server/bind` and `:convex.server/port`. For instance, `convex.world`
has registered URL `convex.world:18888` in on-chain peer data, it is publicly accessible to all peers which
wants to broadcast data to it.

A peer needs initial state optionally specified in `:convex.server/state` which is a vector. Either:

| Item 0     | Item 1     | Does                                          |
|------------|------------|-----------------------------------------------|
| `:genesis` | /          | Creates new genesis state from scratch        |
| `:db`      | /          | Restores state from `:convex.server/db`       |
| `:sync`    | Option map | Performs peer syncing (see below)             |
| `:use`     | State cell | Advanced. Uses given `convex.core.State` cell |

Peer syncing retrieves state from the given peer and connection will automatically be formed to that
other peer at [[start]], forming a network. The option map may specify:

| Key                   | Value                      | Default         |
|-----------------------|----------------------------|-----------------|
| `:convex.server/host` | Address of the remote peer | `"localhost"` |
| `:convex.server/port` | Port of the remote peer    | `18888`         |
sourceraw docstring

dbclj

(db server)

Returns the Etch instance used by the server.

Returns the Etch instance used by the `server`.
sourceraw docstring

hostclj

(host server)

Returns bind address used by the server as a string.

Returns bind address used by the `server` as a string.
sourceraw docstring

peerclj

(peer server)

Advanced feature. Returns the peer object wrapped by the server. More precisely, the server provided network connectivity over this object.

Advanced feature. Returns the peer object wrapped by the server. More precisely, the server
provided network connectivity over this object.
sourceraw docstring

persistclj

(persist server)

Persists peer data at the root of the server's Etch instance

Persisted data can be recovered when creating a server with the same Etch instance (see :convex.server/state option in create).

Done automatically at stop is :convex.server/persist-at-stop? as set to true at create.

However, the database is not flushed. See convex.db/flush from :module/cvm.

Returns the server.

Persists peer data at the root of the server's Etch instance

Persisted data can be recovered when creating a server with the same Etch instance (see `:convex.server/state`
option in [[create]]).

Done automatically at [[stop]] is `:convex.server/persist-at-stop?` as set to `true` at [[create]].

However, the database is not flushed. See `convex.db/flush` from `:module/cvm`.

Returns the `server`.
sourceraw docstring

portclj

(port server)

Returns the port used by the server.

Returns the port used by the `server`.
sourceraw docstring

startclj

(start server)

Starts server created in create.

If peer syncing was configured in create, also connects to remote peer.

Returns the server.

Starts `server` created in [[create]].

If peer syncing was configured in [[create]], also connects to remote peer.

Returns the `server`.
sourceraw docstring

stopclj

(stop server)

Stops server previously started with start.

Does not close the Etch instance optionally provided when starting.

Stops `server` previously started with `start`.

Does not close the Etch instance optionally provided when starting.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close