blob: 576616e63272d477497718c20c4f2217b2c8f8ca [file] [log] [blame]
include "reflection/reflection.fbs";
namespace aos;
enum LoggerConfig : ubyte {
// This data should be logged on this node.
LOCAL_LOGGER,
// This data should be logged on a remote node.
REMOTE_LOGGER,
// This data should not be logged.
NOT_LOGGED,
// This data should be logged both on this node and on the remote node.
// This is useful where you want to log a message on both the sender and
// receiver to create self-contained log files.
LOCAL_AND_REMOTE_LOGGER
}
table Connection {
// Node name to forward to.
name:string;
// How the delivery timestamps for this connection should be logged. Do we
// log them with the local logger (i.e. the logger running on the node that
// this message is delivered to)? Do we log them on another node (a central
// logging node)? Do we log them in both places redundantly?
timestamp_logger:LoggerConfig = LOCAL_LOGGER;
// If the corresponding delivery timestamps for this channel are logged
// remotely, which node should be responsible for logging the data. Note:
// for now, this can only be the source node. Empty implies the node this
// connection is connecting to (i.e. name).
timestamp_logger_node:string;
// Priority to forward data with.
priority:ushort = 100;
// Time to live in nanoseconds before the message is dropped.
// A value of 0 means no timeout, i.e. reliable. When a client connects, the
// latest message from this channel will be sent regardless.
// TODO(austin): We can retry more than just the last message on reconnect
// if we want. This is an unlikely scenario though.
time_to_live:uint = 0;
}
// Table representing a channel. Channels are where data is published and
// subscribed from. The tuple of name, type is the identifying information.
table Channel {
// Name of the channel.
name:string;
// Type name of the flatbuffer.
type:string;
// Max frequency in messages/sec of the data published on this channel.
frequency:int = 100;
// Max size of the data being published. (This will hopefully be
// automatically computed in the future.)
max_size:int = 1000;
// Sets the maximum number of senders on a channel.
num_senders:int = 10;
// Sets the maximum number of watchers on a channel.
num_watchers:int = 10;
// The schema for the data sent on this channel.
schema:reflection.Schema;
// The source node name for the data sent on this channel.
// If nodes is populated below, this needs to also be populated.
source_node:string;
// The destination nodes for data sent on this channel.
// This only needs to be populated if this message is getting forwarded.
destination_nodes:[Connection];
// What service is responsible for logging this channel:
logger:LoggerConfig = LOCAL_LOGGER;
// If the channel is logged remotely, which node should be responsible for
// logging the data. Note: this requires that the data is forwarded to the
// node responsible for logging it. Empty implies the node this connection
// is connecting to (i.e. name).
logger_node:string;
}
// Table to support renaming channel names.
table Map {
// Channel to match with. If the name in here matches, the name is replaced
// with the name in rename.
// Node specific matches are also supported.
match:Channel;
// The channel to merge in.
rename:Channel;
}
// Application specific information.
table Application {
// Name of the application.
name:string;
// List of maps to apply for this specific application. Application specific
// maps are applied in reverse order, and before the global maps.
// For example
// "maps": [ { "match": { "name": "/foo" }, "rename": { "name": "/bar" } } ]
// will make it so any channels named "/foo" actually go to "/bar" for just
// this application. This is super handy for running an application twice
// publishing to different channels, or for injecting a little application
// to modify messages live for testing.
//
// "maps": [
// { "match": { "name": "/foo" }, "rename": { "name": "/bar" } },
// { "match": { "name": "/foo" }, "rename": { "name": "/baz" } }
// ]
//
// will map "/foo" to "/baz", even if there is a global list of maps.
maps:[Map];
// The node that this application will be started on.
// TODO(austin): Teach starter how to use this for starting applications.
node:string;
}
// Per node data and connection information.
table Node {
// Short name for the node. This provides a short hand to make it easy to
// setup forwarding rules as part of the channel setup.
name:string;
// Hostname used to identify and connect to the node.
hostname:string;
// Port to serve forwarded data from.
port:ushort = 9971;
// An alternative to hostname which allows specifying multiple hostnames,
// any of which will match this node.
//
// Don't specify a hostname in multiple nodes in the same configuration.
hostnames:[string];
}
// Overall configuration datastructure for the pubsub.
table Configuration {
// List of channels.
channels:[Channel] (id: 0);
// List of global maps. These are applied in reverse order.
maps:[Map] (id: 1);
// If present, this is the list of nodes in the system. If this is not
// present, AOS will be running in a single node configuration.
nodes:[Node] (id: 4);
// List of applications.
applications:[Application] (id: 2);
// List of imports. Imports are loaded first, and then this configuration
// is merged into them.
imports:[string] (id: 3);
// Length of the channels in nanoseconds. Every channel will have enough
// data allocated so that if data is published at the configured frequency,
// at least this many nanoseconds of messages will be available for fetchers.
channel_storage_duration:long = 2000000000 (id: 5);
}
root_type Configuration;