maedhroz commented on code in PR #1754:
URL: https://github.com/apache/cassandra/pull/1754#discussion_r932457883


##########
src/java/org/apache/cassandra/config/DatabaseDescriptor.java:
##########
@@ -2016,59 +2055,115 @@ public static int 
getStreamThroughputOutboundMegabitsPerSec()
         return conf.stream_throughput_outbound.toMegabitsPerSecondAsInt();
     }
 
+    public static double getStreamThroughputOutboundMegabitsPerSecAsDouble()
+    {
+        return conf.stream_throughput_outbound.toMegabitsPerSecond();
+    }
+
     public static double getStreamThroughputOutboundMebibytesPerSec()
     {
         return conf.stream_throughput_outbound.toMebibytesPerSecond();
     }
 
-    public static void setStreamThroughputOutboundMegabitsPerSec(int value)
+    public static double getStreamThroughputOutboundBytesPerSec()
     {
-        conf.stream_throughput_outbound = 
DataRateSpec.IntMebibytesPerSecondBound.megabitsPerSecondInMebibytesPerSecond(value);
+        return conf.stream_throughput_outbound.toBytesPerSecond();
     }
 
-    public static int 
getEntireSSTableStreamThroughputOutboundMebibytesPerSecAsInt()
+    public static int getStreamThroughputOutboundMebibytesPerSecAsInt()
     {
-        return 
conf.entire_sstable_stream_throughput_outbound.toMebibytesPerSecondAsInt();
+        return conf.stream_throughput_outbound.toMebibytesPerSecondAsInt();
+    }
+
+    public static void setStreamThroughputOutboundMebibytesPerSecAsInt(int 
value)
+    {
+        if (MEBIBYTES_PER_SECOND.toMegabitsPerSecond(value) >= 
Integer.MAX_VALUE)
+            throw new IllegalArgumentException("Invalid value of 
stream_throughput_outbound: " + value);
+
+        long valueInBytes = value * 1024L * 1024L;
+        conf.stream_throughput_outbound = new 
DataRateSpec.LongBytesPerSecondBound(valueInBytes);
+    }
+
+    public static void setStreamThroughputOutboundMegabitsPerSec(int value)
+    {
+        conf.stream_throughput_outbound = 
DataRateSpec.LongBytesPerSecondBound.megabitsPerSecondInBytesPerSecond(value);
     }
 
     public static double 
getEntireSSTableStreamThroughputOutboundMebibytesPerSec()
     {
         return 
conf.entire_sstable_stream_throughput_outbound.toMebibytesPerSecond();
     }
 
+    public static double getEntireSSTableStreamThroughputOutboundBytesPerSec()
+    {
+        return 
conf.entire_sstable_stream_throughput_outbound.toBytesPerSecond();
+    }
+
     public static void 
setEntireSSTableStreamThroughputOutboundMebibytesPerSec(int value)
     {
-        conf.entire_sstable_stream_throughput_outbound = new 
DataRateSpec.IntMebibytesPerSecondBound(value);
+        if (MEBIBYTES_PER_SECOND.toMebibytesPerSecond(value) >= 
Integer.MAX_VALUE)
+            throw new IllegalArgumentException("Invalid value of 
entire_sstable_stream_throughput_outbound: " + value);
+
+        long valueInBytes = value * 1024L * 1024L;
+        conf.entire_sstable_stream_throughput_outbound = new 
DataRateSpec.LongBytesPerSecondBound(valueInBytes);
     }
 
     public static int getInterDCStreamThroughputOutboundMegabitsPerSec()
     {
         return 
conf.inter_dc_stream_throughput_outbound.toMegabitsPerSecondAsInt();
     }
 
+    public static double 
getInterDCStreamThroughputOutboundMegabitsPerSecAsDouble()
+    {
+        return conf.inter_dc_stream_throughput_outbound.toMegabitsPerSecond();
+    }
+
     public static double getInterDCStreamThroughputOutboundMebibytesPerSec()
     {
         return conf.inter_dc_stream_throughput_outbound.toMebibytesPerSecond();
     }
 
+    public static double getInterDCStreamThroughputOutboundBytesPerSec()
+    {
+        return conf.inter_dc_stream_throughput_outbound.toBytesPerSecond();
+    }
+
+    public static int getInterDCStreamThroughputOutboundMebibytesPerSecAsInt()
+    {
+        return 
conf.inter_dc_stream_throughput_outbound.toMebibytesPerSecondAsInt();
+    }
+
+    public static void 
setInterDCStreamThroughputOutboundMebibytesPerSecAsInt(int value)
+    {
+        if (MEBIBYTES_PER_SECOND.toMegabitsPerSecond(value) >= 
Integer.MAX_VALUE)
+            throw new IllegalArgumentException("Invalid value of 
inter_dc_stream_throughput_outbound: " + value);
+
+        long valueInBytes = value * 1024L * 1024L;
+        conf.inter_dc_stream_throughput_outbound = new 
DataRateSpec.LongBytesPerSecondBound(valueInBytes);
+    }
+
     public static void setInterDCStreamThroughputOutboundMegabitsPerSec(int 
value)
     {
-        conf.inter_dc_stream_throughput_outbound = 
DataRateSpec.IntMebibytesPerSecondBound.megabitsPerSecondInMebibytesPerSecond(value);
+        conf.inter_dc_stream_throughput_outbound = 
DataRateSpec.LongBytesPerSecondBound.megabitsPerSecondInBytesPerSecond(value);
     }
 
-    public static double 
getEntireSSTableInterDCStreamThroughputOutboundMebibytesPerSec()
+    public static double 
getEntireSSTableInterDCStreamThroughputOutboundBytesPerSec()
     {
-        return 
conf.entire_sstable_inter_dc_stream_throughput_outbound.toMebibytesPerSecond();
+        return 
conf.entire_sstable_inter_dc_stream_throughput_outbound.toBytesPerSecond();
     }
 
-    public static int 
getEntireSSTableInterDCStreamThroughputOutboundMebibytesPerSecAsInt()
+    public static double 
getEntireSSTableInterDCStreamThroughputOutboundMebibytesPerSec()
     {
-        return 
conf.entire_sstable_inter_dc_stream_throughput_outbound.toMebibytesPerSecondAsInt();
+        return 
conf.entire_sstable_inter_dc_stream_throughput_outbound.toMebibytesPerSecond();
     }
 
     public static void 
setEntireSSTableInterDCStreamThroughputOutboundMebibytesPerSec(int value)
     {
-        conf.entire_sstable_inter_dc_stream_throughput_outbound = new 
DataRateSpec.IntMebibytesPerSecondBound(value);
+        if (MEBIBYTES_PER_SECOND.toMebibytesPerSecond(value) >= 
Integer.MAX_VALUE)
+            throw new IllegalArgumentException("Invalid value of 
entire_sstable_inter_dc_stream_throughput_outbound: " + value);
+
+        long valueInBytes = value * 1024L * 1024L;

Review Comment:
   See also https://github.com/apache/cassandra/pull/1754#discussion_r931592327



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to