func (s *Sat) Start() error {
	// start Vektor first so that the server is started up before Grav starts discovery
	go func() {
		if err := s.v.Start(); err != nil {
			if err == http.ErrServerClosed {
				// that's fine, do nothing
			} else {
				log.Fatal(errors.Wrap(err, "failed to Start server"))
			}
		}
	}()

	// configure Grav to join the mesh for its appropriate application
	// and broadcast its "interest" (i.e. the loaded function)
	s.g = grav.New(
		grav.UseBelongsTo(s.c.Identifier),
		grav.UseInterests(s.c.JobType),
		grav.UseLogger(s.c.Logger),
		grav.UseTransport(s.t),
		grav.UseDiscovery(local.New()),
		grav.UseEndpoint(fmt.Sprintf("%d", s.c.Port), "/meta/message"),
	)

	s.p = s.g.Connect()

	// set up the Executor to listen for jobs and handle them
	s.e.UseGrav(s.g)
	s.e.ListenAndRun(s.c.JobType, s.handleFnResult)

	if err := connectStaticPeers(s.c.Logger, s.g); err != nil {
		log.Fatal(errors.Wrap(err, "failed to connectStaticPeers"))
	}

	// write a file to disk which describes this instance
	info := process.NewInfo(s.c.Port, s.c.JobType)
	if err := info.Write(s.c.ProcUUID); err != nil {
		log.Fatal(errors.Wrap(err, "failed to Write process info"))
	}

	shutdownChan := make(chan error)

	s.setupSignals(shutdownChan)

	return <-shutdownChan
}
// Start starts Sat's Vektor server and Grav discovery
Start starts Sat's Vektor server and Grav discovery
// Start starts Sat ' s Vektor server and Grav discovery
func (s *Sat) Start() error {
	go func() {
		if err := s.v.Start(); err != nil {
			if err == http.ErrServerClosed {
			} else {
				log.Fatal(errors.Wrap(err, "failed to Start server"))
			}
		}
	}()
	s.g = grav.New(
		grav.UseBelongsTo(s.c.Identifier),
		grav.UseInterests(s.c.JobType),
		grav.UseLogger(s.c.Logger),
		grav.UseTransport(s.t),
		grav.UseDiscovery(local.New()),
		grav.UseEndpoint(fmt.Sprintf("%d", s.c.Port), "/meta/message"),
	)
	s.p = s.g.Connect()
	s.e.UseGrav(s.g)
	s.e.ListenAndRun(s.c.JobType, s.handleFnResult)
	if err := connectStaticPeers(s.c.Logger, s.g); err != nil {
		log.Fatal(errors.Wrap(err, "failed to connectStaticPeers"))
	}
	info := process.NewInfo(s.c.Port, s.c.JobType)
	if err := info.Write(s.c.ProcUUID); err != nil {
		log.Fatal(errors.Wrap(err, "failed to Write process info"))
	}
	shutdownChan := make(chan error)
	s.setupSignals(shutdownChan)
	return <-shutdownChan
}
func ( s * Sat ) Start ( ) error { go func ( ) { if err := s . v . Start ( ) ; err != nil { if err == http . ErrServerClosed { } else { log . Fatal ( errors . Wrap ( err , " " ) ) } } } ( ) s . g = grav . New ( grav . UseBelongsTo ( s . c . Identifier ) , grav . UseInterests ( s . c . JobType ) , grav . UseLogger ( s . c . Logger ) , grav . UseTransport ( s . t ) , grav . UseDiscovery ( local . New ( ) ) , grav . UseEndpoint ( fmt . Sprintf ( " " , s . c . Port ) , " " ) , ) s . p = s . g . Connect ( ) s . e . UseGrav ( s . g ) s . e . ListenAndRun ( s . c . JobType , s . handleFnResult ) if err := connectStaticPeers ( s . c . Logger , s . g ) ; err != nil { log . Fatal ( errors . Wrap ( err , " " ) ) } info := process . NewInfo ( s . c . Port , s . c . JobType ) if err := info . Write ( s . c . ProcUUID ) ; err != nil { log . Fatal ( errors . Wrap ( err , " " ) ) } shutdownChan := make ( chan error ) s . setupSignals ( shutdownChan ) return <- shutdownChan }
Start starts Sat's Vektor server and Grav discovery
Start starts Sat ' s Vektor server and Grav discovery
// start Vektor first so that the server is started up before Grav starts discovery // that's fine, do nothing // configure Grav to join the mesh for its appropriate application // and broadcast its "interest" (i.e. the loaded function) // set up the Executor to listen for jobs and handle them // write a file to disk which describes this instance