func NewLogger(uri string) (logging.Logger, errors.Error) { var logger logging.Logger if strings.HasPrefix(uri, "golog") { logger = logger_golog.NewLogger(os.Stderr, logging.Info, false) logging.SetLogger(logger) return logger, nil } return nil, errors.NewAdminInvalidURL("Logger", uri) }
func NewAcctstore(uri string) (accounting.AccountingStore, errors.Error) { if strings.HasPrefix(uri, "stub:") { return accounting_stub.NewAccountingStore(uri) } if strings.HasPrefix(uri, "gometrics:") { return accounting_gm.NewAccountingStore(), nil } return nil, errors.NewAdminInvalidURL("AccountingStore", uri) }
func NewClusterConfig(uri string, clusterName string, version string, datastore datastore.Datastore, acctstore accounting.AccountingStore, cfgstore clustering.ConfigurationStore) (clustering.Cluster, errors.Error) { if strings.HasPrefix(uri, "zookeeper:") { v := clustering.NewVersion(version) return clustering_zk.NewCluster(clusterName, v, cfgstore, datastore, acctstore) } return nil, errors.NewAdminInvalidURL("ConfigurationStore", uri) }
func NewQueryNodeConfig(uri string, version string, httpAddr string, opts clustering.ClOptions, datastore datastore.Datastore, acctstore accounting.AccountingStore, cfgstore clustering.ConfigurationStore) (clustering.QueryNode, errors.Error) { if strings.HasPrefix(uri, "zookeeper:") { v := clustering.NewVersion(version) s := clustering.NewStandalone(v, cfgstore, datastore, acctstore) return clustering_zk.NewQueryNode(httpAddr, s, &opts) } return nil, errors.NewAdminInvalidURL("ConfigurationStore", uri) }
func NewConfigstore(uri string) (clustering.ConfigurationStore, errors.Error) { if strings.HasPrefix(uri, "http:") { clustering_cb.Enable_ns_server_shutdown() return clustering_cb.NewConfigstore(uri) } if strings.HasPrefix(uri, "zookeeper:") { return clustering_zk.NewConfigstore(uri) } if strings.HasPrefix(uri, "stub:") { return clustering_stub.NewConfigurationStore() } return nil, errors.NewAdminInvalidURL("ConfigurationStore", uri) }