Eventstore-tcp v0.1.0: almost first release


#1

I’ve been tinkering with tokio for some time now and have written first steps to a client API for EventStore as yet-unpublished crate eventstore-tcp. It is currently unpublished because I need a custom version of tokio-proto with my pull request. While unpublished to crates.io, it is somewhat usable if you don’t mind the custom dependency.

If you are new to EventStore, it is a database for storing immutable events related to the pattern “event sourcing”. It has some similarity to Apache Kafka, but has a number of differences and different feature set (most notably the ability to write queries over events in JavaScript). EventStore is written in C# but runs on Linux and Windows (perhaps other OSs as well). EventStore has basically two supported protocols: http (see http_event_store) and tcp, which is protobuf based multiplexed custom protocol. eventstore-tcp uses quick_protobuf for en/decoding the payloads.

Using eventstore-tcp you can connect to a server, write events and read them back in a few ways. There are a number of unsupported features if you are interested in joining in. Under examples/testclient you will find an aspiring command line interface built on top of the library, mainly for testing the client itself against the real server.

If you read this far and are interested in the subject, I’d like to welcome any and all comments on the code, future API ideas and such.


#2

Just a small update here: still no crates.io release, but some progress has been made, and learnings might be useful for anyone else working on a protocol which has protobuf or similar descriptors: Have a base layer of the raw protocol messages, don’t attempt to provide better ones at the lowest layer. I wish I had immediatedly taken this path.

In eventstore-tcp this means that codec::PackageCodec will decode values of Package that contain values of raw::RawMessage, which is an enumeration of currently supported (and unsupported) messages. raw::RawMessage can be converted using MessageContainer::try_adapt(self). “Adaptation” to nicer messages (adapted::AdaptedMessage) can fail and previously it paniced, now there is a descriptive error why (error is not in the docs though).

Some other new features:

  • deleting streams (protocol support)
  • testclient supports deleting streams: cargo run -- delete STREAM_ID EXPECTED_VERSION

I don’t think I’ll be working much more on eventstore-tcp for a while until tokio-rs has progressed.