@@ -58,6 +58,18 @@ default SelfT withCDC(boolean enabled) {
58
58
return withOption ("cdc" , enabled );
59
59
}
60
60
61
+ /**
62
+ * Defines the crc check chance.
63
+ *
64
+ * <p>Note that using this option with a version of Apache Cassandra less than 3.0 will raise a
65
+ * syntax error.
66
+ */
67
+ @ NonNull
68
+ @ CheckReturnValue
69
+ default SelfT withCRCCheckChance (double crcCheckChance ) {
70
+ return withOption ("crc_check_chance" , crcCheckChance );
71
+ }
72
+
61
73
/**
62
74
* Defines the caching criteria.
63
75
*
@@ -97,22 +109,32 @@ default SelfT withCompaction(@NonNull CompactionStrategy<?> compactionStrategy)
97
109
}
98
110
99
111
/**
100
- * Configures compression using the LZ4 algorithm with the given chunk length and crc check
101
- * chance.
102
- *
103
- * @see #withCompression(String, int, double)
112
+ * @deprecated This method only exists for backward compatibility. Will not work with Apache
113
+ * Cassandra 5.0 or later. Use {@link #withLZ4Compression(int)} instead.
104
114
*/
115
+ @ Deprecated
105
116
@ NonNull
106
117
@ CheckReturnValue
107
118
default SelfT withLZ4Compression (int chunkLengthKB , double crcCheckChance ) {
108
119
return withCompression ("LZ4Compressor" , chunkLengthKB , crcCheckChance );
109
120
}
110
121
122
+ /**
123
+ * Configures compression using the LZ4 algorithm with the given chunk length.
124
+ *
125
+ * @see #withCompression(String, int)
126
+ */
127
+ @ NonNull
128
+ @ CheckReturnValue
129
+ default SelfT withLZ4Compression (int chunkLengthKB ) {
130
+ return withCompression ("LZ4Compressor" , chunkLengthKB );
131
+ }
132
+
111
133
/**
112
134
* Configures compression using the LZ4 algorithm using the default configuration (64kb
113
- * chunk_length, and 1.0 crc_check_chance ).
135
+ * chunk_length).
114
136
*
115
- * @see #withCompression(String, int, double )
137
+ * @see #withCompression(String, int)
116
138
*/
117
139
@ NonNull
118
140
@ CheckReturnValue
@@ -121,22 +143,57 @@ default SelfT withLZ4Compression() {
121
143
}
122
144
123
145
/**
124
- * Configures compression using the Snappy algorithm with the given chunk length and crc check
125
- * chance.
146
+ * Configures compression using the Zstd algorithm with the given chunk length.
126
147
*
127
- * @see #withCompression(String, int, double )
148
+ * @see #withCompression(String, int)
128
149
*/
129
150
@ NonNull
130
151
@ CheckReturnValue
152
+ default SelfT withZstdCompression (int chunkLengthKB ) {
153
+ return withCompression ("ZstdCompressor" , chunkLengthKB );
154
+ }
155
+
156
+ /**
157
+ * Configures compression using the Zstd algorithm using the default configuration (64kb
158
+ * chunk_length).
159
+ *
160
+ * @see #withCompression(String, int)
161
+ */
162
+ @ NonNull
163
+ @ CheckReturnValue
164
+ default SelfT withZstdCompression () {
165
+ return withCompression ("ZstdCompressor" );
166
+ }
167
+
168
+ /**
169
+ * @deprecated This method only exists for backward compatibility. Will not work with Apache
170
+ * Cassandra 5.0 or later due to removal of deprecated table properties (<a
171
+ * href="https://issues.apache.org/jira/browse/CASSANDRA-18742">CASSANDRA-18742</a>). Use
172
+ * {@link #withSnappyCompression(int)} instead.
173
+ */
174
+ @ Deprecated
175
+ @ NonNull
176
+ @ CheckReturnValue
131
177
default SelfT withSnappyCompression (int chunkLengthKB , double crcCheckChance ) {
132
178
return withCompression ("SnappyCompressor" , chunkLengthKB , crcCheckChance );
133
179
}
134
180
181
+ /**
182
+ * Configures compression using the Snappy algorithm with the given chunk length.
183
+ *
184
+ * @see #withCompression(String, int)
185
+ */
186
+ @ NonNull
187
+ @ CheckReturnValue
188
+ default SelfT withSnappyCompression (int chunkLengthKB ) {
189
+ return withCompression ("SnappyCompressor" , chunkLengthKB );
190
+ }
191
+
135
192
/**
136
193
* Configures compression using the Snappy algorithm using the default configuration (64kb
137
- * chunk_length, and 1.0 crc_check_chance ).
194
+ * chunk_length).
138
195
*
139
- * @see #withCompression(String, int, double )
196
+ * @see #withCompression(String, int)
140
197
*/
141
198
@ NonNull
142
199
@ CheckReturnValue
@@ -145,22 +202,34 @@ default SelfT withSnappyCompression() {
145
202
}
146
203
147
204
/**
148
- * Configures compression using the Deflate algorithm with the given chunk length and crc check
149
- * chance.
150
- *
151
- * @see #withCompression(String, int, double)
205
+ * @deprecated This method only exists for backward compatibility. Will not work with Apache
206
+ * Cassandra 5.0 or later due to removal of deprecated table properties (<a
207
+ * href="https://issues.apache.org/jira/browse/CASSANDRA-18742">CASSANDRA-18742</a>). Use
208
+ * {@link #withDeflateCompression( int)} instead.
152
209
*/
210
+ @ Deprecated
153
211
@ NonNull
154
212
@ CheckReturnValue
155
213
default SelfT withDeflateCompression (int chunkLengthKB , double crcCheckChance ) {
156
214
return withCompression ("DeflateCompressor" , chunkLengthKB , crcCheckChance );
157
215
}
158
216
217
+ /**
218
+ * Configures compression using the Deflate algorithm with the given chunk length.
219
+ *
220
+ * @see #withCompression(String, int)
221
+ */
222
+ @ NonNull
223
+ @ CheckReturnValue
224
+ default SelfT withDeflateCompression (int chunkLengthKB ) {
225
+ return withCompression ("DeflateCompressor" , chunkLengthKB );
226
+ }
227
+
159
228
/**
160
229
* Configures compression using the Deflate algorithm using the default configuration (64kb
161
- * chunk_length, and 1.0 crc_check_chance ).
230
+ * chunk_length).
162
231
*
163
- * @see #withCompression(String, int, double )
232
+ * @see #withCompression(String, int)
164
233
*/
165
234
@ NonNull
166
235
@ CheckReturnValue
@@ -170,13 +239,13 @@ default SelfT withDeflateCompression() {
170
239
171
240
/**
172
241
* Configures compression using the given algorithm using the default configuration (64kb
173
- * chunk_length, and 1.0 crc_check_chance ).
242
+ * chunk_length).
174
243
*
175
244
* <p>Unless specifying a custom compression algorithm implementation, it is recommended to use
176
245
* {@link #withLZ4Compression()}, {@link #withSnappyCompression()}, or {@link
177
246
* #withDeflateCompression()}.
178
247
*
179
- * @see #withCompression(String, int, double )
248
+ * @see #withCompression(String, int)
180
249
*/
181
250
@ NonNull
182
251
@ CheckReturnValue
@@ -185,19 +254,32 @@ default SelfT withCompression(@NonNull String compressionAlgorithmName) {
185
254
}
186
255
187
256
/**
188
- * Configures compression using the given algorithm, chunk length and crc check chance .
257
+ * Configures compression using the given algorithm, chunk length.
189
258
*
190
259
* <p>Unless specifying a custom compression algorithm implementation, it is recommended to use
191
260
* {@link #withLZ4Compression()}, {@link #withSnappyCompression()}, or {@link
192
261
* #withDeflateCompression()}.
193
262
*
194
263
* @param compressionAlgorithmName The class name of the compression algorithm.
195
264
* @param chunkLengthKB The chunk length in KB of compression blocks. Defaults to 64.
196
- * @param crcCheckChance The probability (0.0 to 1.0) that checksum will be checked on each read.
197
- * Defaults to 1.0.
198
265
*/
199
266
@ NonNull
200
267
@ CheckReturnValue
268
+ default SelfT withCompression (@ NonNull String compressionAlgorithmName , int chunkLengthKB ) {
269
+ return withOption (
270
+ "compression" ,
271
+ ImmutableMap .of ("class" , compressionAlgorithmName , "chunk_length_in_kb" , chunkLengthKB ));
272
+ }
273
+
274
+ /**
275
+ * @deprecated This method only exists for backward compatibility. Will not work with Apache
276
+ * Cassandra 5.0 or later due to removal of deprecated table properties (<a
277
+ * href="https://issues.apache.org/jira/browse/CASSANDRA-18742">CASSANDRA-18742</a>). Use
278
+ * {@link #withCompression(String, int)} instead.
279
+ */
280
+ @ NonNull
281
+ @ CheckReturnValue
282
+ @ Deprecated
201
283
default SelfT withCompression (
202
284
@ NonNull String compressionAlgorithmName , int chunkLengthKB , double crcCheckChance ) {
203
285
return withOption (
0 commit comments