
#ifndef metadata_server_h
#define metadata_server_h

#include "member.h"
#include "lock_protocol.h"
#include <list>
class metadata_server {
	public:
    metadata_server();

		lock_protocol::status join(member m, std::list<member> & lst);
		lock_protocol::status leave(member m, int &);
		lock_protocol::status update(int, std::list<member> & lst);
		lock_protocol::status  stats(int, int & r);
	
		//STATE 
		lock_protocol::status clear_state();
		lock_protocol::status state_commit(); //the last client in the system commits the data at the server
		lock_protocol::status state_get(); //a client gets state from the server
	private:
		pthread_mutex_t metadata_lock;
        	std::list<member> mems;
		rpcc cl;

		int rpc_count;
		const static int PRINT_GRANULARITY = 100;
		pthread_mutex_t count_lock;
};

#endif /*consistent hash*/
