Crate shotover

Crate shotover 

Source
Expand description

This library allows the creation of custom shotover transforms.

There are two consumers of this library:

§Custom Transforms

To create a custom transform you need to implement these traits:

  • transforms::TransformConfig - Defines what configuration fields the transform has in the topology.yaml.
  • transforms::TransformBuilder - Defines how to build the Transform for a new incoming connection. Only one instance is created over shotovers runtime.
  • transforms::Transform - Defines the transformation logic of the transform. A new instance is created per incoming connection.

Simple transforms can implement all of these onto a single struct but generally you need seperate structs for each.

§The shotover binary

All custom transforms the user wants to use are statically compiled into a single binary. The crate for this binary is very simple, it just consists of a main.rs like:

shotover::import_transform!(transform_crate::TransformConfig);

fn main() {
    shotover::runner::Shotover::new().run_block();
}

Modules§

codec
Codec types to use for connecting to a DB in a sink transform
config
Config types, used for serializing/deserializing shotover configuration files
connection
All Sink transforms use SinkConnection for their outgoing connections.
frame
parsed AST-like representations of messages
message
Message and supporting types - used to hold a message/query/result going between the client and database
runner
Tools for initializing shotover in the final binary.
sources
Sources used to listen for connections and send/recieve with the client.
tcp
Use to establish a TCP connection to a DB in a sink transform
tls
Use to establish a TLS connection to a DB in a sink transform
transforms
Various types required for defining a transform

Macros§

import_transform
Imports a custom transform into the shotover binary.