cassandra-pr mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From belliottsmith <...@git.apache.org>
Subject [GitHub] cassandra pull request #265: 14705
Date Wed, 12 Sep 2018 06:46:37 GMT
Github user belliottsmith commented on a diff in the pull request:

    https://github.com/apache/cassandra/pull/265#discussion_r216913492
  
    --- Diff: src/java/org/apache/cassandra/locator/ReplicaPlan.java ---
    @@ -249,12 +229,32 @@ public int requiredParticipants()
          * we progressively modify via various forms of speculation (initial speculation,
rr-read and rr-write)
          * @param <P>
          */
    -    public static class Shared<P extends ReplicaPlan<?, ?>>
    +    public interface Shared<E extends Endpoints<E>, P extends ReplicaPlan<E>>
         {
    -        private P replicaPlan;
    -        public Shared(P replicaPlan) { this.replicaPlan = replicaPlan; }
    -        public void set(P newReplicaPlan) { this.replicaPlan = newReplicaPlan; }
    -        public P get() { return replicaPlan; }
    +        public void addToContact(Replica replica);
    +        public P get();
    +        public abstract P getWithContact(E endpoints);
         }
     
    +    public static class SharedForTokenRead implements Shared<EndpointsForToken, ForTokenRead>
    +    {
    +        private ForTokenRead replicaPlan;
    +        public SharedForTokenRead(ForTokenRead replicaPlan) { this.replicaPlan = replicaPlan;
}
    +        public void addToContact(Replica replica) { replicaPlan = replicaPlan.withContact(Endpoints.append(replicaPlan.contact(),
replica)); }
    +        public ForTokenRead get() { return replicaPlan; }
    +        public ForTokenRead getWithContact(EndpointsForToken newContact) { return replicaPlan.withContact(newContact);
}
    +    }
    +
    +    public static class SharedForRangeRead implements Shared<EndpointsForRange, ForRangeRead>
    +    {
    +        private ForRangeRead replicaPlan;
    +        public SharedForRangeRead(ForRangeRead replicaPlan) { this.replicaPlan = replicaPlan;
}
    +        public void addToContact(Replica replica) { replicaPlan = replicaPlan.withContact(Endpoints.append(replicaPlan.contact(),
replica)); }
    --- End diff --
    
    It does; in general the non-pluralised form of contact doesn't work well with the method
names.  Perhaps I should just pluralise and be done with it?  Not sure why I was averse to
this.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Mime
View raw message