|
From: Benjamin R. <br...@ya...> - 2008-04-12 00:35:35
|
Great to hear from you Ted!
A) Yes, I agree. I think the common ACL patterns are buried in a weird
place. You have a great perspective since you are a completely new user.
Where was the first place you looked? In other words, were would be the
natural place to put such a thing. Tragically, the ACL class would be a
natural place, but that is a generated class.
B) Agreed. We had that on the list to fix, but we lost track of it. (As
one of our users reminded me just now :)
C) Great point. Will do.
D) Wow, you are right. I can't believe we didn't doc the constructors!
Will fix. The examples usually have the full source code attached. Is
there one that we missed.
I see Mahadev has already responded to your problem. Let me just add
that the error codes are in KeeperException (they are a bit of a pain to
get since you have to do math :). So -111 is NotEmpty.
thanks again for your comments and we will work on the issues you have
pointed out.
ben
Ted Dunning wrote:
> Hi,
>
> First, congrats on a really clean, simple and apparently awesome system. I
> look forward to using it.
>
> I am trying to set up some of our systems to use zookeeper, but am having
> some problems with very basic things.
>
> Here is a summary of grump causing things that I have gotten past:
>
> A) common ACL patterns appear to not be declared in a nice accessible way.
> There are some things in ZooDefs, but they are hard to use due to deep
> nesting of classes.
>
> B) the signature of create requires an ArrayList instead of a List. This
> makes common idioms very verbose (unnecessarily so).
>
> C) the digest authentication scheme is not particularly well documented. A
> code sample would help.
>
> D) the examples don't explain the arguments to the constructor of Zookeeper
> are. Many examples omit some basic setup code which makes them hard to
> replicate.
>
>
> My major question is why the following toy program is saying this:
>
> com.yahoo.zookeeper.KeeperException: KeeperErrorCode = Unknown error -111
> at com.yahoo.zookeeper.ZooKeeper.delete(ZooKeeper.java:306)
> at TestZooKeeper.delete(TestZooKeeper.java:44)
> at TestZooKeeper.test1(TestZooKeeper.java:30)
>
>
> Here is the code. All suggestions are welcome.
>
> public class TestZooKeeper extends TestCase {
> static ZooKeeper zk;
> private ArrayList<ACL> acl;
>
> public void test1() throws IOException, KeeperException,
> InterruptedException {
> zk = new ZooKeeper("ted-rh:8181", 30000, new LoggingWatcher());
>
> assertTrue(exists("/"));
> assertEquals("", get("/"));
> if (exists("/test")) {
> delete("/test");
> }
> create("/test", "");
> assertTrue(exists("/test"));
>
> create("/test/foobar", "test data");
>
> }
>
> private boolean exists(String path) throws KeeperException,
> InterruptedException {
> return zk.exists(path, false) != null;
> }
>
> private void delete(String path) throws KeeperException,
> InterruptedException {
> zk.delete(path, -1);
> }
>
> private String get(String path) throws KeeperException,
> InterruptedException, UnsupportedEncodingException {
> return new String(zk.getData(path, false, null), "UTF-8");
> }
>
>
> private void create(String path, String content) throws KeeperException,
> InterruptedException, UnsupportedEncodingException {
> acl = new ArrayList<ACL>(Collections.singletonList(new
> ACL(ZooDefs.Perms.ALL, new Id("world", "anyone"))));
> zk.create(path, content.getBytes("UTF-8"), acl, 0);
> }
> }
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Zookeeper-user mailing list
> Zoo...@li...
> https://lists.sourceforge.net/lists/listinfo/zookeeper-user
>
|