Creating a peer which can either:
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.
(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.
(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:
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 |
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` |
(db server)
Returns the Etch instance used by the server
.
Returns the Etch instance used by the `server`.
(host server)
Returns bind address used by the server
as a string.
Returns bind address used by the `server` as a string.
(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.
(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`.
(port server)
Returns the port used by the server
.
Returns the port used by the `server`.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close