Skip to content

neo v0.5.0 (alpha 5)

Compare
Choose a tag to compare
@gavin-norman-sociomantic gavin-norman-sociomantic released this 12 Jun 08:10
· 137 commits to v15.x.x since this release

Note: As this is a minor release on an alpha branch, breaking changes may be included.

https://github.com/sociomantic-tsunami/dhtproto/milestone/9

Migration Instructions

Request arguments now passed to neo notifiers as const

dhtproto.client.DhtClient, dhtproto.client.mixins.NeoSupport

The second argument of all neo notifier delegates must be changed to const.

New Features

Neo Exists request

dhtproto.client.DhtClient, dhtproto.client.request.Exists

The new request, Exists, checks whether a record with the specified key exists
in the specified channel.

New handshake helper with built-in task support

dhtproto.client.legacy.internal.helper.Handshake

The new DhtHandshake class wraps the existing RetryHandshake with
easy support for a task-based workflow. This should make it easy for
applications to support a partial handshake, e.g.:

auto retry_delay_seconds = 3;
auto handshake = new DhtHandshake(dht_client, retry_delay_seconds);

// block on at least one node connecting
theScheduler.await(handshake.oneNodeConnected());
Stdout.formatln("At least one node is now connected!");

// wait until either all nodes have connected, or 60 seconds
// have passed, whichever comes sooner (N.B. `awaitOrTimeout`
// is only available for more recent ocean releases)
auto timeout_microsec = 60_000_000;

auto handshake_timed_out =   // true if timeout is reached
    theScheduler.awaitOrTimeout(
        handshake.allNodesConnected(),
        timeout_microsec);

if (handshake_timed_out)
{
    Stdout.formatln(
        "DHT handshake did not succeed within {} seconds!",
        timeout_microsec / 1_000_000);
}
else
{
    Stdout.formatln(
        "DHT handshake reached all nodes before timeout!");
}

// if we timed out, the `DhtHandshake` instance will still
// keep working in the background to connect to the missing
// DHT nodes, so all nodes should be reached eventually

Neo RemoveChannel request

dhtproto.client.DhtClient, dhtproto.client.request.RemoveChannel

The new request, RemoveChannel, allows a complete channel to be removed from
all nodes in a DHT.

Note:

  • The real DHT implementation will reject this request if it is sent by a
    non-admin client. For testing convenience, the fake DHT in this repo allows
    any client to remove channels.

Neo Remove request

dhtproto.client.DhtClient, dhtproto.client.request.Exists

The new request, Remove, removes a record with the specified key from the
specified channel.

Neo Update request

dhtproto.client.DhtClient, dhtproto.client.request.Update

The new request, Update, fetches a record value, allows the user to specify an
updated value, and replaces the old value in the node with the new value. Note
that the request will notice if the value being updated has been modified by
another request, while the Update is in progress. If this happens, the Update
will be rejected (the client should retry the request).