Add basic support for nodes
This adds the infrastructure and configuration language to describe a
multinode world. This only checks that if there are multiple nodes
setup, everything is both configured for multiple nodes, and that we are
listening and sending data on the correct node per the configuration.
Change-Id: I658ba05620337a210d677c43e5eb840e05f96051
diff --git a/aos/configuration.h b/aos/configuration.h
index b837391..5d4a79b 100644
--- a/aos/configuration.h
+++ b/aos/configuration.h
@@ -49,10 +49,22 @@
return GetChannel(&config.message(), name, type, application_name);
}
-// TODO(austin): GetSchema<T>(const Flatbuffer<Configuration> &config);
+// Returns the Node out of the config with the matching name, or nullptr if it
+// can't be found.
+const Node *GetNode(const Configuration *config, std::string_view name);
+// Returns the Node out of the configuration which matches our hostname.
+// CHECKs if it can't be found.
+const Node *GetMyNode(const Configuration *config);
+const Node *GetNodeFromHostname(const Configuration *config,
+ std::string_view name);
-// Returns "our" IP address.
-const in_addr &GetOwnIPAddress();
+// Returns true if the provided channel is sendable on the provided node.
+bool ChannelIsSendableOnNode(const Channel *channel, const Node *node);
+// Returns true if the provided channel is able to be watched or fetched on the
+// provided node.
+bool ChannelIsReadableOnNode(const Channel *channel, const Node *node);
+
+// TODO(austin): GetSchema<T>(const Flatbuffer<Configuration> &config);
// Returns the "root directory" for this run. Under linux, this is the
// directory where the executable is located (from /proc/self/exe)