Esempio n. 1
0
func doRun() error {
	svc, err := revrpc.GetDefaultServiceFromEnv("demo")
	if err != nil {
		return err
	}
	return revrpc.BabysitService(rpcSetup, svc, nil)
}
Esempio n. 2
0
func doRunPort() error {
	svc, err := revrpc.GetDefaultServiceFromEnv("saslauthd-port")
	if err != nil {
		return err
	}
	go runStdinWatcher()
	return revrpc.BabysitService(setupPortRPC, svc, nil)
}
Esempio n. 3
0
func RegisterServiceManager(mgr ServiceManager,
	errorPolicy revrpc.BabysitErrorPolicy) error {

	service, err := revrpc.GetDefaultServiceFromEnv("service_api")
	if err != nil {
		return err
	}

	setup := func(rpc *rpc.Server) error {
		return rpc.Register(&ServiceAPI{mgr})
	}

	return revrpc.BabysitService(setup, service, errorPolicy)
}
Esempio n. 4
0
func runRPCForSvc(rpcsvc *revrpc.Service, svc *cbauthimpl.Svc) error {
	defPolicy := revrpc.DefaultBabysitErrorPolicy.New()
	// error restart policy that we're going to use simply
	// resets service before delegating to default restart
	// policy. That way we always mark service as stale
	// right after some error occurred.
	cbauthPolicy := func(err error) error {
		resetErr := err
		if err == nil {
			resetErr = errDisconnected
		}
		cbauthimpl.ResetSvc(svc, &DBStaleError{resetErr})
		return defPolicy(err)
	}
	return revrpc.BabysitService(func(s *rpc.Server) error {
		return s.RegisterName("AuthCacheSvc", svc)
	}, rpcsvc, revrpc.FnBabysitErrorPolicy(cbauthPolicy))
}