本文整理匯總了Golang中github.com/tedsuo/ifrit/sigmon.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New("file-server")
initializeDropsonde(logger)
members := grouper.Members{
{"file server", initializeServer(logger)},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("ready")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例2: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New("auctioneer")
initializeDropsonde(logger)
if err := validateBBSAddress(); err != nil {
logger.Fatal("invalid-bbs-address", err)
}
consulClient, err := consuladapter.NewClientFromUrl(*consulCluster)
if err != nil {
logger.Fatal("new-client-failed", err)
}
port, err := strconv.Atoi(strings.Split(*listenAddr, ":")[1])
if err != nil {
logger.Fatal("invalid-port", err)
}
clock := clock.NewClock()
auctioneerServiceClient := auctioneer.NewServiceClient(consulClient, clock)
auctionRunner := initializeAuctionRunner(logger, *cellStateTimeout,
initializeBBSClient(logger), *startingContainerWeight)
auctionServer := initializeAuctionServer(logger, auctionRunner)
lockMaintainer := initializeLockMaintainer(logger, auctioneerServiceClient, port)
registrationRunner := initializeRegistrationRunner(logger, consulClient, clock, port)
members := grouper.Members{
{"lock-maintainer", lockMaintainer},
{"auction-runner", auctionRunner},
{"auction-server", auctionServer},
{"registration-runner", registrationRunner},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err = <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例3: Execute
func (cmd *WebCommand) Execute(args []string) error {
tsa := &tsacmd.TSACommand{
BindIP: cmd.TSA.BindIP,
BindPort: cmd.TSA.BindPort,
HostKeyPath: cmd.TSA.HostKeyPath,
AuthorizedKeysPath: cmd.TSA.AuthorizedKeysPath,
HeartbeatInterval: cmd.TSA.HeartbeatInterval,
}
cmd.populateTSAFlagsFromATCFlags(tsa)
atcRunner, err := cmd.ATCCommand.Runner(args)
if err != nil {
return err
}
tsaRunner, err := tsa.Runner(args)
if err != nil {
return err
}
runner := sigmon.New(grouper.NewParallel(os.Interrupt, grouper.Members{
{"atc", atcRunner},
{"tsa", tsaRunner},
}))
return <-ifrit.Invoke(runner).Wait()
}
示例4: main
func main() {
logger := configureLogger()
flag.Parse()
validateFlags(logger)
router := configureRouter(logger)
var server ifrit.Runner
server = http_server.New(*listenAddress, router)
members := grouper.Members{
{"server", server},
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例5: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
logger, reconfigurableSink := cf_lager.New("tps-listener")
initializeDropsonde(logger)
noaaClient := noaa.NewConsumer(*trafficControllerURL, &tls.Config{InsecureSkipVerify: *skipSSLVerification}, nil)
defer noaaClient.Close()
apiHandler := initializeHandler(logger, noaaClient, *maxInFlightRequests, initializeBBSClient(logger))
members := grouper.Members{
{"api", http_server.New(*listenAddr, apiHandler)},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例6: ServeAPI
func ServeAPI(l logger.Logger, conf *config.Config) {
store := connectToStore(l, conf)
apiHandler, err := handlers.New(l, store, buildTimeProvider(l))
if err != nil {
l.Error("initialize-handler.failed", err)
panic(err)
}
handler := handlers.BasicAuthWrap(apiHandler, conf.APIServerUsername, conf.APIServerPassword)
listenAddr := fmt.Sprintf("%s:%d", conf.APIServerAddress, conf.APIServerPort)
members := grouper.Members{
{"api", http_server.New(listenAddr, handler)},
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
l.Info("started")
l.Info(listenAddr)
err = <-monitor.Wait()
if err != nil {
l.Error("exited", err)
os.Exit(1)
}
l.Info("exited")
os.Exit(0)
}
示例7: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New("auctioneer")
initializeDropsonde(logger)
if err := validateBBSAddress(); err != nil {
logger.Fatal("invalid-bbs-address", err)
}
client, err := consuladapter.NewClient(*consulCluster)
if err != nil {
logger.Fatal("new-client-failed", err)
}
sessionMgr := consuladapter.NewSessionManager(client)
consulSession, err := consuladapter.NewSession("auctioneer", *lockTTL, client, sessionMgr)
if err != nil {
logger.Fatal("consul-session-failed", err)
}
clock := clock.NewClock()
bbsServiceClient := bbs.NewServiceClient(consulSession, clock)
auctioneerServiceClient := auctioneer.NewServiceClient(consulSession, clock)
auctionRunner := initializeAuctionRunner(logger, *cellStateTimeout, initializeBBSClient(logger), bbsServiceClient)
auctionServer := initializeAuctionServer(logger, auctionRunner)
lockMaintainer := initializeLockMaintainer(logger, auctioneerServiceClient)
members := grouper.Members{
{"lock-maintainer", lockMaintainer},
{"auction-runner", auctionRunner},
{"auction-server", auctionServer},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err = <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例8: Execute
func (cmd *ATCCommand) Execute(args []string) error {
runner, err := cmd.Runner(args)
if err != nil {
return err
}
return <-ifrit.Invoke(sigmon.New(runner)).Wait()
}
示例9: run
func run(cmd *exec.Cmd) error {
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
runner := sigmon.New(cmdRunner{cmd})
process := ifrit.Invoke(runner)
return <-process.Wait()
}
示例10: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New(*sessionName)
natsClient := diegonats.NewClient()
clock := clock.NewClock()
syncer := syncer.NewSyncer(clock, *syncInterval, natsClient, logger)
initializeDropsonde(logger)
natsClientRunner := diegonats.NewClientRunner(*natsAddresses, *natsUsername, *natsPassword, logger, natsClient)
table := initializeRoutingTable()
emitter := initializeNatsEmitter(natsClient, logger)
watcher := ifrit.RunFunc(func(signals <-chan os.Signal, ready chan<- struct{}) error {
return watcher.NewWatcher(initializeBBSClient(logger), clock, table, emitter, syncer.Events(), logger).Run(signals, ready)
})
syncRunner := ifrit.RunFunc(func(signals <-chan os.Signal, ready chan<- struct{}) error {
return syncer.Run(signals, ready)
})
lockMaintainer := initializeLockMaintainer(logger, *consulCluster, *sessionName, *lockTTL, *lockRetryInterval, clock)
members := grouper.Members{
{"lock-maintainer", lockMaintainer},
{"nats-client", natsClientRunner},
{"watcher", watcher},
{"syncer", syncRunner},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例11: main
func main() {
logger := lager.NewLogger("checkin")
logger.RegisterSink(lager.NewWriterSink(os.Stdout, lager.INFO))
var opts Opts
_, err := flags.Parse(&opts)
if err != nil {
logger.Error("parsing-flags", err)
os.Exit(1)
}
// ts := oauth2.StaticTokenSource(
// &oauth2.Token{AccessToken: opts.GitHubAccessToken},
// )
// tc := oauth2.NewClient(oauth2.NoContext, ts)
// githubClient := github.NewClient(tc)
// checker := build.NewConcourseChecker()
// checker = build.NewStatusReporter(checker, githubClient.Repositories)
dbConn, err := migration.Open(opts.DBDriver, opts.DBURL, migrations.Migrations)
if err != nil {
logger.Error("failed-to-run-migrations", err)
os.Exit(1)
}
sqlDB := db.NewSQL(logger.Session("db"), dbConn)
enqueuer := build.NewEnqueuer(sqlDB)
apiServer := api.NewServer(opts.GitHubSecret, enqueuer)
members := []grouper.Member{
{
"api",
http_server.New(
opts.Addr,
apiServer,
),
},
}
group := grouper.NewParallel(os.Interrupt, members)
running := ifrit.Invoke(sigmon.New(group))
logger.Info("listening", lager.Data{
"api": opts.Addr,
})
err = <-running.Wait()
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
示例12: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
logger, reconfigurableSink := cf_lager.New("sshd")
serverConfig, err := configure(logger)
if err != nil {
logger.Error("configure-failed", err)
os.Exit(1)
}
runner := handlers.NewCommandRunner()
shellLocator := handlers.NewShellLocator()
dialer := &net.Dialer{}
sshDaemon := daemon.New(
logger,
serverConfig,
nil,
map[string]handlers.NewChannelHandler{
"session": handlers.NewSessionChannelHandler(runner, shellLocator, getDaemonEnvironment(), 15*time.Second),
"direct-tcpip": handlers.NewDirectTcpipChannelHandler(dialer),
},
)
server := server.NewServer(logger, *address, sshDaemon)
members := grouper.Members{
{"sshd", server},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err = <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
os.Exit(0)
}
示例13: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New("ssh-proxy")
initializeDropsonde(logger)
proxyConfig, err := configureProxy(logger)
if err != nil {
logger.Error("configure-failed", err)
os.Exit(1)
}
sshProxy := proxy.New(logger, proxyConfig)
server := server.NewServer(logger, *address, sshProxy)
consulClient, err := consuladapter.NewClientFromUrl(*consulCluster)
if err != nil {
logger.Fatal("new-client-failed", err)
}
registrationRunner := initializeRegistrationRunner(logger, consulClient, *address, clock.NewClock())
members := grouper.Members{
{"ssh-proxy", server},
{"registration-runner", registrationRunner},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{{
"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink),
}}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err = <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
os.Exit(0)
}
示例14: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
lifecycles := flags.LifecycleMap{}
flag.Var(&lifecycles, "lifecycle", "app lifecycle binary bundle mapping (lifecycle[/stack]:bundle-filepath-in-fileserver)")
flag.Parse()
cf_http.Initialize(*communicationTimeout)
logger, reconfigurableSink := cf_lager.New("nsync-listener")
initializeDropsonde(logger)
recipeBuilderConfig := recipebuilder.Config{
Lifecycles: lifecycles,
FileServerURL: *fileServerURL,
KeyFactory: keys.RSAKeyPairFactory,
}
recipeBuilders := map[string]recipebuilder.RecipeBuilder{
"buildpack": recipebuilder.NewBuildpackRecipeBuilder(logger, recipeBuilderConfig),
"docker": recipebuilder.NewDockerRecipeBuilder(logger, recipeBuilderConfig),
}
handler := handlers.New(logger, initializeBBSClient(logger), recipeBuilders)
members := grouper.Members{
{"server", http_server.New(*listenAddress, handler)},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
group := grouper.NewOrdered(os.Interrupt, members)
monitor := ifrit.Invoke(sigmon.New(group))
logger.Info("started")
err := <-monitor.Wait()
if err != nil {
logger.Error("exited-with-failure", err)
os.Exit(1)
}
logger.Info("exited")
}
示例15: main
func main() {
cf_debug_server.AddFlags(flag.CommandLine)
cf_lager.AddFlags(flag.CommandLine)
flag.Var(
&insecureDockerRegistries,
"insecureDockerRegistry",
"Docker registry to allow connecting to even if not secure. (Can be specified multiple times to allow insecure connection to multiple repositories)",
)
lifecycles := flags.LifecycleMap{}
flag.Var(&lifecycles, "lifecycle", "app lifecycle binary bundle mapping (lifecycle[/stack]:bundle-filepath-in-fileserver)")
flag.Parse()
logger, reconfigurableSink := cf_lager.New("stager")
initializeDropsonde(logger)
ccClient := cc_client.NewCcClient(*ccBaseURL, *ccUsername, *ccPassword, *skipCertVerify)
backends := initializeBackends(logger, lifecycles)
handler := handlers.New(logger, ccClient, initializeBBSClient(logger), backends, clock.NewClock())
members := grouper.Members{
{"server", http_server.New(*listenAddress, handler)},
}
if dbgAddr := cf_debug_server.DebugAddress(flag.CommandLine); dbgAddr != "" {
members = append(grouper.Members{
{"debug-server", cf_debug_server.Runner(dbgAddr, reconfigurableSink)},
}, members...)
}
logger.Info("starting")
group := grouper.NewOrdered(os.Interrupt, members)
process := ifrit.Invoke(sigmon.New(group))
logger.Info("Listening for staging requests!")
err := <-process.Wait()
if err != nil {
logger.Fatal("Stager exited with error", err)
}
logger.Info("stopped")
}