[ 
https://issues.apache.org/jira/browse/CASSANDRA-15725?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17113030#comment-17113030
 ] 

Benedict Elliott Smith commented on CASSANDRA-15725:
----------------------------------------------------

Sorry for the slow response.  I really like the approach taken, of permitting 
authors of custom verbs to specify integers in the normal way, just with their 
own distinct number space.

I have just some minor cosmetic suggestions, none of them important and happy 
to be overruled:

1. Perhaps we want to specify a maximum custom id, so that we leave plenty of 
room for Cassandra growing upwards without accidentally infringing on custom 
spaces that have begun to be used by others?

2. I think it _might_ help to introduce a {{Kind}} enum with e.g. {{NORMAL, 
CUSTOM}}, and for the custom constructor accept {{Kind}} as the first argument, 
so you would see {{UNUSED_CUSTOM_VERB (CUSTOM, 0...}} which might help prevent 
fat finger errors, and also demarcate more visibly the compiler-enforced divide 
between the verbs

3. In {{fromId}} it might be ever so slightly cleaner to simply choose the 
array to look inside, and update {{id}}, e.g.:

{code}
        public static Verb fromId(int id)
        {
            Verb[] verbs = idToVerbMap;
            if (id >= minCustomId)
            {
                id = idForCustomVerb(id);
                verbs = idToCustomVerbMap;
            }
            Verb verb = id >= 0 && id < verbs.length ? verbs[id] : null;
            if (verb == null)
                throw new IllegalArgumentException("Unknown verb id " + id);
            return verb;
        }
{code}

Either way, LGTM +1

> Add support for adding custom Verbs
> -----------------------------------
>
>                 Key: CASSANDRA-15725
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-15725
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: Messaging/Internode
>            Reporter: Marcus Eriksson
>            Assignee: Marcus Eriksson
>            Priority: Normal
>             Fix For: 4.0-alpha
>
>         Attachments: feedback_15725.patch
>
>
> It should be possible to safely add custom/internal Verbs - without risking 
> conflicts when new  ones are added.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to