belliottsmith commented on code in PR #4068: URL: https://github.com/apache/cassandra/pull/4068#discussion_r2036956810
########## src/java/org/apache/cassandra/service/accord/serializers/IVersionedWithKeysSerializer.java: ########## @@ -323,44 +277,132 @@ private void serializeLargeSubset(AbstractRanges serialize, int serializeCount, } } + public Routables<?> deserializeSubsetInternal(Routables<?> superset, DataInputPlus in) throws IOException + { + switch (superset.domain()) + { + default: throw UnhandledEnum.unknown(superset.domain()); + case Key: return deserializeRoutingKeySubset((AbstractUnseekableKeys) superset, in, (ks, s) -> ks == null ? s : RoutingKeys.of(ks)); + case Range: return deserializeRangeSubset((AbstractRanges) superset, in, (rs, s) -> rs == null ? s : Ranges.of(rs)); + } + } + + public void skipSubsetInternal(int supersetCount, DataInputPlus in) throws IOException + { + long encoded = in.readUnsignedVInt(); + if (supersetCount <= 64) + return; + + int deserializeCount = supersetCount - (int)encoded; + int count = 0; + while (count < deserializeCount) + { + count += in.readUnsignedVInt32(); + in.readUnsignedVInt32(); + } + } + + public <T, S extends AbstractUnseekableKeys> T deserializeRoutingKeySubset(S superset, DataInputPlus in, BiFunction<RoutingKey[], S, T> result) throws IOException + { + long encoded = in.readUnsignedVInt(); + int supersetCount = superset.size(); + if (encoded == 0L) + return result.apply(null, superset); + else if (supersetCount >= 64) + return result.apply(deserializeLargeRoutingKeySubset(in, superset, supersetCount, (int) encoded), superset); + else + return result.apply(deserializeSmallRoutingKeySubsetArray(encoded, superset, supersetCount), superset); + } + + public <T, S extends AbstractRanges> T deserializeRangeSubset(S superset, DataInputPlus in, BiFunction<Range[], S, T> result) throws IOException + { + long encoded = in.readUnsignedVInt(); + int supersetCount = superset.size(); + if (encoded == 0L) + return result.apply(null, superset); + else if (supersetCount >= 64) + return result.apply(deserializeLargeRangeSubset(in, superset, supersetCount, (int) encoded), superset); + else + return result.apply(deserializeSmallRangeSubsetArray(encoded, superset, supersetCount), superset); + } + @DontInline - private Unseekables<?> deserializeLargeSubset(DataInputPlus in, Unseekables<?> superset, int supersetCount, int delta) throws IOException + private Routables<?> deserializeLargeSubset(DataInputPlus in, Routables<?> superset, int supersetCount, int delta) throws IOException Review Comment: I don't think this version needs to survive, will delete -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org