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

Ivan Bessonov updated IGNITE-15412:
-----------------------------------
    Labels: iep-55 ignite-3  (was: ignite-3)

> Configuration registry: add ability to retreive distributed value  
> -------------------------------------------------------------------
>
>                 Key: IGNITE-15412
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15412
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Alexander Lapin
>            Assignee: Ivan Bessonov
>            Priority: Major
>              Labels: iep-55, ignite-3
>
> In some cases it's required to retrieve configuration distributed value. 
> Currently we use meta storage manager interface for this purpose and cause 
> configuration registry hides the keys the code of the distributed property 
> retrieval looks horrible:
>  
> {code:java}
> //TODO This is an egregious violation of encapsulation. Current approach has 
> to be revisited.
> private Set<String> tableNamesConfigured() {
>     IgniteBiTuple<ByteArray, ByteArray> range = toRange(new 
> ByteArray(PUBLIC_PREFIX));
>     Set<String> tableNames = new HashSet<>();
>     try (Cursor<Entry> cursor = metaStorageMgr.range(range.get1(), 
> range.get2())) {
>         while (cursor.hasNext()) {
>             Entry entry = cursor.next();
>             List<String> keySplit = 
> ConfigurationUtil.split(entry.key().toString());
>             if (keySplit.size() == 5 && 
> NamedListNode.NAME.equals(keySplit.get(4)))
>                 tableNames.add(ByteUtils.fromBytes(entry.value()).toString());
>         }
>     }
>     catch (Exception e) {
>         LOG.error("Can't get table names.", e);
>     }
>     return tableNames;
> }
> {code}
> Let's refactor it by adding distributedValue() (concrete name of the method 
> is up to an implementator) to ConfigurationProperty. That will allow to 
> simplify distributed retrieval:
> {code:java}
> private Set<String> tableNamesConfigured() {
>     return new 
> HashSet<>(clusterCfgMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables().
>         distirbuteValue().namedListKeys());
> }
> {code}
> Internally distributedValue() should fetch corresponding key->val from the 
> meta storage without applying this value to local state updating 
> localRoots.version etc.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to