blob: cc1f950082f2eb3d88f4a6f117d3d8f6b9a8baf0 [file] [log] [blame]
Alex Perrycb7da4b2019-08-28 19:35:56 -07001include "reflection/reflection.fbs";
2
Austin Schuhcb108412019-10-13 16:09:54 -07003namespace aos;
4
Austin Schuh40485ed2019-10-26 21:51:44 -07005// Table representing a channel. Channels are where data is published and
Austin Schuhcb108412019-10-13 16:09:54 -07006// subscribed from. The tuple of name, type is the identifying information.
Austin Schuh40485ed2019-10-26 21:51:44 -07007table Channel {
8 // Name of the channel.
Austin Schuhcb108412019-10-13 16:09:54 -07009 name:string;
10 // Type name of the flatbuffer.
11 type:string;
Austin Schuh40485ed2019-10-26 21:51:44 -070012 // Max frequency in messages/sec of the data published on this channel.
Austin Schuhcb108412019-10-13 16:09:54 -070013 frequency:int = 100;
14 // Max size of the data being published. (This will be automatically
15 // computed in the future.)
16 max_size:int = 1000;
Alex Perrycb7da4b2019-08-28 19:35:56 -070017
Austin Schuh80c7fce2019-12-05 20:48:43 -080018 // Sets the maximum number of senders on a channel.
19 num_senders:int = 10;
20 // Sets the maximum number of watchers on a channel.
21 num_watchers:int = 10;
22
Alex Perrycb7da4b2019-08-28 19:35:56 -070023 // The schema for the data sent on this channel.
24 schema:reflection.Schema;
Austin Schuh217a9782019-12-21 23:02:50 -080025
26 // The source node name for the data sent on this channel.
27 // If nodes is populated below, this needs to also be populated.
28 source_node:string;
29
30 // The destination node names for data sent on this channel.
31 // This only needs to be populated if this message is getting forwarded.
32 destination_nodes:[string];
Austin Schuhcb108412019-10-13 16:09:54 -070033}
34
Austin Schuh40485ed2019-10-26 21:51:44 -070035// Table to support renaming channel names.
Austin Schuhcb108412019-10-13 16:09:54 -070036table Map {
Austin Schuh40485ed2019-10-26 21:51:44 -070037 // Channel to match with. If the name in here matches, the name is replaced
Austin Schuhcb108412019-10-13 16:09:54 -070038 // with the name in rename.
Austin Schuhbca6cf02019-12-22 17:28:34 -080039 // Node specific matches are also supported.
Austin Schuh40485ed2019-10-26 21:51:44 -070040 match:Channel;
41 // The channel to merge in.
42 rename:Channel;
Austin Schuhcb108412019-10-13 16:09:54 -070043}
44
45// Application specific information.
46table Application {
47 // Name of the application.
48 name:string;
49 // List of maps to apply for this specific application. Application specific
50 // maps are applied in reverse order, and before the global maps.
51 // For example
52 // "maps": [ { "match": { "name": "/foo" }, "rename": { "name": "/bar" } } ]
Austin Schuh40485ed2019-10-26 21:51:44 -070053 // will make it so any channels named "/foo" actually go to "/bar" for just
Austin Schuhcb108412019-10-13 16:09:54 -070054 // this application. This is super handy for running an application twice
Austin Schuh40485ed2019-10-26 21:51:44 -070055 // publishing to different channels, or for injecting a little application
Austin Schuhcb108412019-10-13 16:09:54 -070056 // to modify messages live for testing.
57 //
58 // "maps": [
59 // { "match": { "name": "/foo" }, "rename": { "name": "/bar" } },
60 // { "match": { "name": "/foo" }, "rename": { "name": "/baz" } }
61 // ]
62 //
63 // will map "/foo" to "/baz", even if there is a global list of maps.
64 maps:[Map];
Austin Schuh217a9782019-12-21 23:02:50 -080065
66 // The node that this application will be started on.
67 // TODO(austin): Teach starter how to use this for starting applications.
68 node:string;
69}
70
71// Per node data and connection information.
72table Node {
73 // Short name for the node. This provides a short hand to make it easy to
74 // setup forwarding rules as part of the channel setup.
75 name:string;
76
77 // Hostname used to identify and connect to the node.
78 hostname:string;
79 // Port to serve forwarded data from.
80 port:ushort = 9971;
Austin Schuhcb108412019-10-13 16:09:54 -070081}
82
83// Overall configuration datastructure for the pubsub.
84table Configuration {
Austin Schuh40485ed2019-10-26 21:51:44 -070085 // List of channels.
86 channels:[Channel] (id: 0);
Austin Schuhcb108412019-10-13 16:09:54 -070087 // List of global maps. These are applied in reverse order.
88 maps:[Map] (id: 1);
Austin Schuh217a9782019-12-21 23:02:50 -080089
90 // If present, this is the list of nodes in the system. If this is not
91 // present, AOS will be running in a single node configuration.
92 nodes:[Node] (id: 4);
93
Austin Schuhcb108412019-10-13 16:09:54 -070094 // List of applications.
95 applications:[Application] (id: 2);
96 // List of imports. Imports are loaded first, and then this configuration
97 // is merged into them.
98 imports:[string] (id: 3);
Austin Schuhaa79e4e2019-12-29 20:43:32 -080099
100 // Length of the channels in nanoseconds. Every channel will have enough
101 // data allocated so that if data is published at the configured frequency,
102 // this many seconds of messages will be available for fetchers.
103 channel_storage_duration:long = 2000000000 (id: 5);
Austin Schuhcb108412019-10-13 16:09:54 -0700104}
105
106root_type Configuration;