Ejemplo n.º 1
0
func main() {
	var err error
	log.Init("/var/log/odyn/server.log")

	// Spin up webserver
	rootMux := http.NewServeMux()
	launcher := webserver.NewLauncher()
	launcher.StartHTTPServer(":8080", rootMux)

	// Test storage engine
	engine := fs.NewEngine("/var/lib/odyn")
	err = engine.Prep()
	if err != nil {
		log.Error(err)
		return
	}

	conn, err := engine.Connect()
	if err != nil {
		log.Error(err)
		return
	}

	conn.Close()

	err = launcher.WaitForComplete()
	log.Info(err.Error())
}
Ejemplo n.º 2
0
func (outbox *PigeonOutbox) send(hostname string, request *PigeonRequest, respChan chan<- Response) error {
	resp := &PigeonResponse{}

	// Dial the server
	// TODO: Inefficient to dial each time?
	log.Info("RPC Dialing")
	rpcClient, err := rpc.DialHTTP("tcp", hostname+":1888")
	if err != nil {
		return fmt.Errorf("Pigeon: (dialing) %s", err.Error())
	}
	defer rpcClient.Close()

	// Make the call
	log.Info("RPC Calling")
	err = rpcClient.Call("PigeonServer.RPCHandleRequest", request, resp)
	if err != nil {
		log.Error("Pigeon: (calling) ", err.Error())
		// Send error response to channel
		respChan <- resp
		return fmt.Errorf("Pigeon: (calling) %s", err.Error())
	}

	// Send response to channel
	respChan <- resp

	return nil
}