You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@curator.apache.org by cammckenzie <gi...@git.apache.org> on 2014/06/18 06:12:21 UTC

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

GitHub user cammckenzie opened a pull request:

    https://github.com/apache/curator/pull/12

    CURATOR-93 - Added compress() option for transactions.

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cammckenzie/curator CURATOR-93

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/curator/pull/12.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #12
    
----
commit 30e66cfa3e8e7d09f553adbaa699edbd05993a4e
Author: Cameron McKenzie <ca...@unico.com.au>
Date:   2014-06-18T01:28:23Z

    CURATOR-93 - Added compress() option for transactions.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by madrob <gi...@git.apache.org>.
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/12#discussion_r13921881
  
    --- Diff: curator-framework/src/main/java/org/apache/curator/framework/api/transaction/TransactionCreateBuilder.java ---
    @@ -19,12 +19,15 @@
     package org.apache.curator.framework.api.transaction;
     
     import org.apache.curator.framework.api.ACLPathAndBytesable;
    +import org.apache.curator.framework.api.Compressible;
    +import org.apache.curator.framework.api.CreateBackgroundModeACLable;
    --- End diff --
    
    nit: unused import?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by madrob <gi...@git.apache.org>.
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/12#discussion_r13921577
  
    --- Diff: curator-framework/src/main/java/org/apache/curator/framework/imps/CreateBuilderImpl.java ---
    @@ -87,16 +87,28 @@ TransactionCreateBuilder asTransactionCreateBuilder(final CuratorTransactionImpl
                     CreateBuilderImpl.this.withMode(mode);
                     return this;
                 }
    -
    +            
    +            @Override
    +            public ACLPathAndBytesable<CuratorTransactionBridge> compressed()
    +            {
    +                CreateBuilderImpl.this.compressed();
    +                return this;
    +            }
    +            
                 @Override
                 public CuratorTransactionBridge forPath(String path) throws Exception
                 {
                     return forPath(path, client.getDefaultData());
    -            }
    +            }            
    --- End diff --
    
    nit: trailing whitespace


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by madrob <gi...@git.apache.org>.
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/12#discussion_r13921732
  
    --- Diff: curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompressionInTransaction.java ---
    @@ -0,0 +1,61 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.curator.framework.imps;
    +
    +import org.apache.curator.test.BaseClassForTests;
    +import org.apache.curator.utils.CloseableUtils;
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.CuratorFrameworkFactory;
    +import org.apache.curator.framework.api.CompressionProvider;
    +import org.apache.curator.retry.RetryOneTime;
    +import org.testng.Assert;
    +import org.testng.annotations.Test;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +public class TestCompressionInTransaction extends BaseClassForTests
    +{
    +    @Test
    +    public void testSimple() throws Exception
    +    {
    +        final String path1 = "/a";
    +        final String path2 = "/a/b";
    +        
    +        final byte[]            data1 = "here's a string".getBytes();
    +        final byte[]            data2 = "here's another string".getBytes();
    +
    +        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
    +        try
    +        {
    +            client.start();
    +
    +            client.inTransaction().create().compressed().forPath(path1, data1).and().
    +            create().compressed().forPath(path2, data2).and().commit();
    +
    +            Assert.assertNotEquals(data1, client.getData().forPath(path1));
    +            Assert.assertEquals(data1.length, client.getData().decompressed().forPath(path1).length);
    --- End diff --
    
    Why is this only asserting equal lengths instead of a strong assertion for equal content (after decompression?)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/curator/pull/12


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by madrob <gi...@git.apache.org>.
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/12#discussion_r13922014
  
    --- Diff: curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompressionInTransaction.java ---
    @@ -0,0 +1,61 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.curator.framework.imps;
    +
    +import org.apache.curator.test.BaseClassForTests;
    +import org.apache.curator.utils.CloseableUtils;
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.CuratorFrameworkFactory;
    +import org.apache.curator.framework.api.CompressionProvider;
    +import org.apache.curator.retry.RetryOneTime;
    +import org.testng.Assert;
    +import org.testng.annotations.Test;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +public class TestCompressionInTransaction extends BaseClassForTests
    +{
    +    @Test
    +    public void testSimple() throws Exception
    +    {
    +        final String path1 = "/a";
    +        final String path2 = "/a/b";
    +        
    +        final byte[]            data1 = "here's a string".getBytes();
    +        final byte[]            data2 = "here's another string".getBytes();
    +
    +        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
    +        try
    +        {
    +            client.start();
    +
    +            client.inTransaction().create().compressed().forPath(path1, data1).and().
    --- End diff --
    
    Would be good to have a test case where the same client creates both compressed and uncompressed data.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by Randgalt <gi...@git.apache.org>.
Github user Randgalt commented on the pull request:

    https://github.com/apache/curator/pull/12#issuecomment-46463734
  
    TransactionSetDataBuilder will need to support compressible too - from client.inTransaction().setData()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] curator pull request: CURATOR-93 - Added compress() option for tra...

Posted by cammckenzie <gi...@git.apache.org>.
Github user cammckenzie commented on a diff in the pull request:

    https://github.com/apache/curator/pull/12#discussion_r13941619
  
    --- Diff: curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompressionInTransaction.java ---
    @@ -0,0 +1,61 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *   http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.curator.framework.imps;
    +
    +import org.apache.curator.test.BaseClassForTests;
    +import org.apache.curator.utils.CloseableUtils;
    +import org.apache.curator.framework.CuratorFramework;
    +import org.apache.curator.framework.CuratorFrameworkFactory;
    +import org.apache.curator.framework.api.CompressionProvider;
    +import org.apache.curator.retry.RetryOneTime;
    +import org.testng.Assert;
    +import org.testng.annotations.Test;
    +import java.util.concurrent.atomic.AtomicInteger;
    +
    +public class TestCompressionInTransaction extends BaseClassForTests
    +{
    +    @Test
    +    public void testSimple() throws Exception
    +    {
    +        final String path1 = "/a";
    +        final String path2 = "/a/b";
    +        
    +        final byte[]            data1 = "here's a string".getBytes();
    +        final byte[]            data2 = "here's another string".getBytes();
    +
    +        CuratorFramework        client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
    +        try
    +        {
    +            client.start();
    +
    +            client.inTransaction().create().compressed().forPath(path1, data1).and().
    +            create().compressed().forPath(path2, data2).and().commit();
    +
    +            Assert.assertNotEquals(data1, client.getData().forPath(path1));
    +            Assert.assertEquals(data1.length, client.getData().decompressed().forPath(path1).length);
    --- End diff --
    
    Good question, I just copied this test from the other non transactional compression tests and modified to be in a transaction. I will update to compare the actual data.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---