Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | include "reflection/reflection.fbs"; |
| 2 | |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 3 | namespace aos; |
| 4 | |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 5 | // Table representing a channel. Channels are where data is published and |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 6 | // subscribed from. The tuple of name, type is the identifying information. |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 7 | table Channel { |
| 8 | // Name of the channel. |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 9 | name:string; |
| 10 | // Type name of the flatbuffer. |
| 11 | type:string; |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 12 | // Max frequency in messages/sec of the data published on this channel. |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 13 | 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 Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 17 | |
Austin Schuh | 80c7fce | 2019-12-05 20:48:43 -0800 | [diff] [blame] | 18 | // 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 Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 23 | // The schema for the data sent on this channel. |
| 24 | schema:reflection.Schema; |
Austin Schuh | 217a978 | 2019-12-21 23:02:50 -0800 | [diff] [blame] | 25 | |
| 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 Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 35 | // Table to support renaming channel names. |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 36 | table Map { |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 37 | // Channel to match with. If the name in here matches, the name is replaced |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 38 | // with the name in rename. |
Austin Schuh | bca6cf0 | 2019-12-22 17:28:34 -0800 | [diff] [blame^] | 39 | // Node specific matches are also supported. |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 40 | match:Channel; |
| 41 | // The channel to merge in. |
| 42 | rename:Channel; |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | // Application specific information. |
| 46 | table 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 Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 53 | // will make it so any channels named "/foo" actually go to "/bar" for just |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 54 | // this application. This is super handy for running an application twice |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 55 | // publishing to different channels, or for injecting a little application |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 56 | // 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 Schuh | 217a978 | 2019-12-21 23:02:50 -0800 | [diff] [blame] | 65 | |
| 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. |
| 72 | table 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 Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | // Overall configuration datastructure for the pubsub. |
| 84 | table Configuration { |
Austin Schuh | 40485ed | 2019-10-26 21:51:44 -0700 | [diff] [blame] | 85 | // List of channels. |
| 86 | channels:[Channel] (id: 0); |
Austin Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 87 | // List of global maps. These are applied in reverse order. |
| 88 | maps:[Map] (id: 1); |
Austin Schuh | 217a978 | 2019-12-21 23:02:50 -0800 | [diff] [blame] | 89 | |
| 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 Schuh | cb10841 | 2019-10-13 16:09:54 -0700 | [diff] [blame] | 94 | // 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); |
| 99 | } |
| 100 | |
| 101 | root_type Configuration; |