Пример #1
0
//
// server Ping RPC handler.
//
func (m *Master) Ping(args *client.PingArgs, reply *client.PingReply) error {
	client.Debug("Pinging", args.Id)

	m.mu.Lock()
	defer m.mu.Unlock()

	tx := m.hd.Begin()
	w := GetWorker(m.hd, args.Id)
	if w != nil {
		reply.Err = client.OK
		w.Status = WORKER_ALIVE
		tx.Save(w)
	} else {
		// The worker was not found in our database, so tell it to reset
		reply.Err = client.RESET
	}
	// Timestamp is automatically upated on save
	commitOrPanic(tx)

	return nil
}
Пример #2
0
func (w *Worker) Ping(args *client.PingArgs, reply *client.PingReply) error {
	reply.Err = client.OK

	return nil
}