Example #1
0
// runExterminate destroys the data held in the specified stores.
func runExterminate(cmd *cobra.Command, args []string) {
	err := Context.Init("exterminate")
	if err != nil {
		log.Errorf("failed to initialize context: %s", err)
		return
	}

	// First attempt to shutdown the server. Note that an error of EOF just
	// means the HTTP server shutdown before the request to quit returned.
	if err := server.SendQuit(Context); err != nil {
		log.Infof("shutdown node %s: %s", Context.Addr, err)
	} else {
		log.Infof("shutdown node in anticipation of data extermination")
	}

	// Exterminate all data held in specified stores.
	for _, e := range Context.Engines {
		if rocksdb, ok := e.(*engine.RocksDB); ok {
			log.Infof("exterminating data from store %s", e)
			if err := rocksdb.Destroy(); err != nil {
				log.Fatalf("unable to destroy store %s: %s", e, err)
			}
		}
	}
	log.Infof("exterminated all data from stores %s", Context.Engines)
}
Example #2
0
// runQuit accesses the quit shutdown path.
func runQuit(cmd *cobra.Command, args []string) {
	if err := server.SendQuit(Context); err != nil {
		fmt.Fprintf(osStderr, "quit failed: %s\n", err)
		osExit(1)
		return
	}
}
Example #3
0
// runQuit accesses the quit shutdown path.
func runQuit(cmd *cobra.Command, args []string) {
	if err := server.SendQuit(Context); err != nil {
		log.Error(err)
	}
}