blob: ef259596f9221fd506f0a22be0ddad1d11981909 [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 Schuh40485ed2019-10-26 21:51:44 -070039 match:Channel;
40 // The channel to merge in.
41 rename:Channel;
Austin Schuhcb108412019-10-13 16:09:54 -070042}
43
44// Application specific information.
45table Application {
46 // Name of the application.
47 name:string;
48 // List of maps to apply for this specific application. Application specific
49 // maps are applied in reverse order, and before the global maps.
50 // For example
51 // "maps": [ { "match": { "name": "/foo" }, "rename": { "name": "/bar" } } ]
Austin Schuh40485ed2019-10-26 21:51:44 -070052 // will make it so any channels named "/foo" actually go to "/bar" for just
Austin Schuhcb108412019-10-13 16:09:54 -070053 // this application. This is super handy for running an application twice
Austin Schuh40485ed2019-10-26 21:51:44 -070054 // publishing to different channels, or for injecting a little application
Austin Schuhcb108412019-10-13 16:09:54 -070055 // to modify messages live for testing.
56 //
57 // "maps": [
58 // { "match": { "name": "/foo" }, "rename": { "name": "/bar" } },
59 // { "match": { "name": "/foo" }, "rename": { "name": "/baz" } }
60 // ]
61 //
62 // will map "/foo" to "/baz", even if there is a global list of maps.
63 maps:[Map];
Austin Schuh217a9782019-12-21 23:02:50 -080064
65 // The node that this application will be started on.
66 // TODO(austin): Teach starter how to use this for starting applications.
67 node:string;
68}
69
70// Per node data and connection information.
71table Node {
72 // Short name for the node. This provides a short hand to make it easy to
73 // setup forwarding rules as part of the channel setup.
74 name:string;
75
76 // Hostname used to identify and connect to the node.
77 hostname:string;
78 // Port to serve forwarded data from.
79 port:ushort = 9971;
Austin Schuhcb108412019-10-13 16:09:54 -070080}
81
82// Overall configuration datastructure for the pubsub.
83table Configuration {
Austin Schuh40485ed2019-10-26 21:51:44 -070084 // List of channels.
85 channels:[Channel] (id: 0);
Austin Schuhcb108412019-10-13 16:09:54 -070086 // List of global maps. These are applied in reverse order.
87 maps:[Map] (id: 1);
Austin Schuh217a9782019-12-21 23:02:50 -080088
89 // If present, this is the list of nodes in the system. If this is not
90 // present, AOS will be running in a single node configuration.
91 nodes:[Node] (id: 4);
92
Austin Schuhcb108412019-10-13 16:09:54 -070093 // List of applications.
94 applications:[Application] (id: 2);
95 // List of imports. Imports are loaded first, and then this configuration
96 // is merged into them.
97 imports:[string] (id: 3);
98}
99
100root_type Configuration;