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

Ivan Bessonov reassigned IGNITE-15166:
--------------------------------------

    Assignee: Ivan Bessonov

> Support renaming in named list configuration elements
> -----------------------------------------------------
>
>                 Key: IGNITE-15166
>                 URL: https://issues.apache.org/jira/browse/IGNITE-15166
>             Project: Ignite
>          Issue Type: Improvement
>    Affects Versions: 3.0.0-alpha2
>            Reporter: Ivan Bessonov
>            Assignee: Ivan Bessonov
>            Priority: Major
>              Labels: iep-55, ignite-3
>
> h3. Motivation
> Current NamedListChange API does not allow you to perform rename operation. 
> Best that you can do is to manually copy the required element and then delete 
> the original. This is bad for several reasons:
>  * inconvenient both in Java API and CLI tool;
>  * results in "onDelete" and "onCreate" events, which is probably not what 
> people want.
> There must be a way to rename elements in Java API at least so that "ALTER 
> ..." DDL command could be properly implemented.
> h3. Java API
> {{NamedListChange}} is a right place to add "rename" method. It should have 
> two parameters and following restrictions:
>  * "old" and "new" names are not null;
>  * element with "old" name must exist;
>  * element with "new" name must not exist.
> New method must be added {{to ConfigurationNamedListListener}}, named 
> "onRename". It should have "onUpdate" semantics, but with two new parameters: 
> "oldKey" and "newKey". Names are a subject to change.
> h3. CLI
> -This is a little less obvious since HOCON/JSON describe data, not 
> operations. We already have specific syntax for "delete" operation. I suggest 
> making "rename" look similar:-
> {code:java}
> root.namedList {
>   oldName = newName
> }{code}
> -In short, now we can assign 3 things to the element:-
>  * -regular composite object with its inner values;-
>  * -"null" for deletion;-
>  * -"String" for renaming.-
> HOCON/JSON format will have no alterations for this feature. DDL commands are 
> to be used for these operations instead.
> h3. Implementation hints
> This will be similar to how we store ordering of named list elements. But 
> this time we have to assign each element a unique identifier. This can be a 
> String or a number. Laziest solution is to use UUID with hyphens removed from 
> it. That'll do it.
> NamedListNode object will store these ids. In short, following algorithms 
> will have to be altered:
>  * conversion of update tree to the flat map - this one should be easy;
>  * applying the flat map to the tree - a bit trickier. Matching from ids to 
> keys will be required, we have to make sure that it won't cost too much;
>  * matching old list with a new one to properly invoke listeners - should be 
> partially solved by the code from the issue above, but still, might be tricky 
> as well.
> -HOCON / JSON "parsers" will have to be altered as well to support "rename" 
> operation. That should be easy.-



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

Reply via email to