47 #include <sys/types.h>
58 struct AppPolicy :
Policy {
59 static void init_options() {
61 (
"root",
str()->default_value(
"fs/local"),
"root directory for local "
62 "broker (if relative, it's relative to the installation directory")
64 alias(
"port",
"FsBroker.Local.Port");
65 alias(
"root",
"FsBroker.Local.Root");
66 alias(
"workers",
"FsBroker.Local.Workers");
67 alias(
"reactors",
"FsBroker.Local.Reactors");
71 typedef Meta::list<AppPolicy, FsBrokerPolicy, DefaultCommPolicy>
Policies;
76 int main(
int argc,
char **argv) {
78 init_with_policies<Policies>(argc, argv);
80 int worker_count = get_i32(
"workers");
83 port = get_i16(
"port");
85 port = get_i16(
"FsBroker.Port");
88 if (
has(
"DfsBroker.Local.Port"))
89 port = get_i16(
"DfsBroker.Local.Port");
90 else if (
has(
"DfsBroker.Port"))
91 port = get_i16(
"DfsBroker.Port");
92 if (
has(
"DfsBroker.Local.Workers"))
93 worker_count = get_i32(
"DfsBroker.Local.Workers");
100 make_shared<FsBroker::Lib::ConnectionHandlerFactory>(comm, app_queue, broker);
101 InetAddr listen_addr(INADDR_ANY, port);
103 comm->listen(listen_addr, handler_factory);
static Comm * instance()
Creates/returns singleton instance of the Comm class.
Interface and base of config policy.
Meta::list< AppPolicy, FsBrokerPolicy, DefaultCommPolicy > Policies
PropertiesPtr properties
This singleton map stores all options.
static bool unlink(const String &fname)
Unlinks (deletes) a file or directory.
Helper class for printing usage banners on the command line.
Po::typed_value< String > * str(String *v=0)
File system broker definitions.
int main(int argc, char **argv)
Desc & cmdline_desc(const char *usage)
A macro which definds global functions like get_bool(), get_str(), get_i16() etc. ...
bool has(const String &name)
Check existence of a configuration value.
File system utility functions.
Declarations for DispatchHandler.
std::shared_ptr< ConnectionHandlerFactory > ConnectionHandlerFactoryPtr
Smart pointer to ConnectionHandlerFactory.
Encapsulate an internet address.
Compatibility Macros for C/C++.
Initialization helper for applications.
std::shared_ptr< Broker > BrokerPtr
Smart pointer to Broker.
Entry point to AsyncComm service.
Internet address wrapper classes and utility functions.
This is a generic exception class for Hypertable.
Declarations for ApplicationQueue.
void alias(const String &cmdline_opt, const String &file_opt, bool overwrite)
Setup command line option alias for config file option.
std::shared_ptr< ApplicationQueue > ApplicationQueuePtr
Shared smart pointer to ApplicationQueue object.
Error codes, Exception handling, error logging.