[ 
https://issues.apache.org/jira/browse/CURATOR-712?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kevin Wikant updated CURATOR-712:
---------------------------------
    Description: 
Curator users may want to leverage recipes such as 
[SharedValue|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L100]
 & 
[PersistentNode|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java#L156]
 directly to avoid maintaining additional code

These recipes take a 
[CuratorFramework|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L95]
 as an argument

It seems that when CuratorFramework is configured with a 
[CompressionProvider|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L110]
 that compression is not used by default for recipes such as SharedValue & 
PersistentNode

Taking getData & setData as examples, we see that compression is only used 
based on a boolean flag in the 
[GetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java#L239]
 & 
[SetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L72]

>From what I am seeing, this flag does not get set by default when using 
>SharedValue & PersistentNode. For example:
 * 
[SharedValue.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L141]
 * 
[CuratorFrameworkImpl.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L505]
 * [SetDataBuilderImpl 
constructor|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L57]

Seems from my testing & code inspection that to enable compression you need to 
do the following:
{quote}CuratorFramework client;
// SetData
Stat result = client.setData().compressed()....
// GetData
Stat result = client.setData().decompressed()....
{quote}
This means that Curator users either need to:
1. Modify the SharedValue, PersistentNode, & other recipes to create customized 
versions
2. Create an abstraction on-top of the SharedValue, PersistentNode, & other 
recipes to perform compression/decompression

I think a better experience could be to give users the ability to enable 
compression at the CuratorFramework-level so that any recipes created with that 
CuratorFramework will automatically use compression

For backwards compatibility, you could simply add a new boolean config to the 
CuratorFrameworkImpl which specifies "compressionEnabled"

When this config is enabled, you can [create the GetDataBuilderImpl & 
SetDataBuilderImpl objects with compression/decompression enabled in the 
CuratorFrameworkImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L496-L506]

My initial intuition was that creating the CuratorFramework with a 
CompressionProvider would have enabled compression by default, but it seems 
this is not the case currently 

  was:
Curator users may want to leverage recipes such as 
[SharedValue|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L100]
 & 
[PersistentNode|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java#L156]
 directly to avoid maintaining additional code

These recipes take a 
[CuratorFramework|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L95]
 as an argument

It seems that when CuratorFramework is configured with a 
[CompressionProvider|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L110]
 that compression is not used by default for recipes such as SharedValue & 
PersistentNode

Taking getData & setData as examples, we see that compression is only used 
based on a boolean flag in the 
[GetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java#L239]
 & 
[SetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L72]

>From what I am seeing, this flag does not get set by default when using 
>SharedValue & PersistentNode. For example:
 * 
[SharedValue.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L141]
 * 
[CuratorFrameworkImpl.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L505]
 * [SetDataBuilderImpl 
constructor|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L57]

Seems from my testing & code inspection that to enable compression you need to 
do the following:
{quote}CuratorFramework client;
// SetData
Stat result = client.setData().compressed()....
// GetData
Stat result = client.getData().decompressed()....
{quote}
This means that Curator users either need to:
1. Modify the SharedValue, PersistentNode, & other recipes to create customized 
versions
2. Create an abstraction on-top of the SharedValue, PersistentNode, & other 
recipes to perform compression/decompression

I think a better experience could be to give users the ability to enable 
compression at the CuratorFramework-level so that any recipes created with that 
CuratorFramework will automatically use compression

For backwards compatibility, you could simply add a new boolean config to the 
CuratorFrameworkImpl which specifies "compressionEnabled"

When this config is enabled, you can [create the GetDataBuilderImpl & 
SetDataBuilderImpl objects with compression/decompression enabled in the 
CuratorFrameworkImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L496-L506]

My initial intuition was that creating the CuratorFramework with a 
CompressionProvider would have enabled compression by default, but it seems 
this is not the case currently 


> Simplify user experience for enabling compression via CompressionProvider
> -------------------------------------------------------------------------
>
>                 Key: CURATOR-712
>                 URL: https://issues.apache.org/jira/browse/CURATOR-712
>             Project: Apache Curator
>          Issue Type: Improvement
>            Reporter: Kevin Wikant
>            Assignee: Enrico Olivelli
>            Priority: Major
>
> Curator users may want to leverage recipes such as 
> [SharedValue|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L100]
>  & 
> [PersistentNode|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/nodes/PersistentNode.java#L156]
>  directly to avoid maintaining additional code
> These recipes take a 
> [CuratorFramework|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L95]
>  as an argument
> It seems that when CuratorFramework is configured with a 
> [CompressionProvider|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L110]
>  that compression is not used by default for recipes such as SharedValue & 
> PersistentNode
> Taking getData & setData as examples, we see that compression is only used 
> based on a boolean flag in the 
> [GetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/GetDataBuilderImpl.java#L239]
>  & 
> [SetDataBuilderImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L72]
> From what I am seeing, this flag does not get set by default when using 
> SharedValue & PersistentNode. For example:
>  * 
> [SharedValue.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-recipes/src/main/java/org/apache/curator/framework/recipes/shared/SharedValue.java#L141]
>  * 
> [CuratorFrameworkImpl.setData|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L505]
>  * [SetDataBuilderImpl 
> constructor|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/SetDataBuilderImpl.java#L57]
> Seems from my testing & code inspection that to enable compression you need 
> to do the following:
> {quote}CuratorFramework client;
> // SetData
> Stat result = client.setData().compressed()....
> // GetData
> Stat result = client.setData().decompressed()....
> {quote}
> This means that Curator users either need to:
> 1. Modify the SharedValue, PersistentNode, & other recipes to create 
> customized versions
> 2. Create an abstraction on-top of the SharedValue, PersistentNode, & other 
> recipes to perform compression/decompression
> I think a better experience could be to give users the ability to enable 
> compression at the CuratorFramework-level so that any recipes created with 
> that CuratorFramework will automatically use compression
> For backwards compatibility, you could simply add a new boolean config to the 
> CuratorFrameworkImpl which specifies "compressionEnabled"
> When this config is enabled, you can [create the GetDataBuilderImpl & 
> SetDataBuilderImpl objects with compression/decompression enabled in the 
> CuratorFrameworkImpl|https://github.com/apache/curator/blob/eeee4c63be6e2377ab9fa8a70f9406dc410ee7d2/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java#L496-L506]
> My initial intuition was that creating the CuratorFramework with a 
> CompressionProvider would have enabled compression by default, but it seems 
> this is not the case currently 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to