From: Fernando P. <fe...@al...> - 2008-06-25 17:27:49
|
I'm new to ZooKeeper and learning the recipes, and I got an idea to help implement the lock algorithm, and thought it would be a good start to break the ice. The punchline is that I would like to set a watch for "isFirst", "isLast". So that instead of each client always getting the full list of children ( maybe really large ), just to do sorting and seeing if they hold the first znode in the list.. it just seems like the server should be doing this for the clients. The main questions revolve around the sorting rules.. 1) string or number sorting? If the sort is done only via string id, then it breaks.. because "id_5" doesn't sort correctly with "id_100". The server would have to break out the sequence number and sort by that. - Maybe you can add the sequence number as another stat property. 2) can it support prefix matter? To implement the read/write locking, the prefix matters.. I'm I the first write holder or am I the first read holder, or are there any write holders at the moment? - Maybe getFirst/getLast should be added as extra calls as well, instead of calling getChildren What do you guys think? What would an api look like? |