@@ -217,9 +217,7 @@ MagmaKVStoreConfig::MagmaKVStoreConfig(Configuration& config,
217217 fmt::format (" {}-{}" , config.getCouchBucket (), config.getUuid ()));
218218
219219 magmaCfg.OnBackupCallback = [this ](auto vbid, auto & snapshot) {
220- if (!store) {
221- throw std::logic_error (" OnBackupCallback: MagmaKVStore not set!" );
222- }
220+ Expects (store);
223221 return store->onContinuousBackupCallback (Vbid (vbid), snapshot);
224222 };
225223
@@ -266,17 +264,15 @@ void MagmaKVStoreConfig::setStore(MagmaKVStore* store) {
266264}
267265
268266void MagmaKVStoreConfig::setFusionMigrationRateLimit (size_t value) {
267+ Expects (store);
269268 fusionMigrationRateLimit.store (value);
270- if (store) {
271- store->setMagmaFusionMigrationRateLimit (value);
272- }
269+ store->setMagmaFusionMigrationRateLimit (value);
273270}
274271
275272void MagmaKVStoreConfig::setFusionSyncRateLimit (size_t value) {
273+ Expects (store);
276274 fusionSyncRateLimit.store (value);
277- if (store) {
278- store->setMagmaFusionSyncRateLimit (value);
279- }
275+ store->setMagmaFusionSyncRateLimit (value);
280276}
281277
282278void MagmaKVStoreConfig::setFusionLogstoreURI (std::string_view uri) {
@@ -298,25 +294,22 @@ void MagmaKVStoreConfig::setFusionUploadInterval(std::chrono::seconds value) {
298294}
299295
300296void MagmaKVStoreConfig::setMagmaFragmentationPercentage (size_t value) {
297+ Expects (store);
301298 magmaFragmentationPercentage.store (value);
302- if (store) {
303- store->setMagmaFragmentationPercentage (value);
304- }
299+ store->setMagmaFragmentationPercentage (value);
305300}
306301
307302void MagmaKVStoreConfig::setStorageThreads (
308303 ThreadPoolConfig::StorageThreadCount value) {
304+ Expects (store);
309305 storageThreads.store (value);
310- if (store) {
311- store->calculateAndSetMagmaThreads ();
312- }
306+ store->calculateAndSetMagmaThreads ();
313307}
314308
315309void MagmaKVStoreConfig::setMagmaFlusherThreadPercentage (size_t value) {
310+ Expects (store);
316311 magmaFlusherPercentage.store (value);
317- if (store) {
318- store->calculateAndSetMagmaThreads ();
319- }
312+ store->calculateAndSetMagmaThreads ();
320313}
321314
322315void MagmaKVStoreConfig::setBucketQuota (size_t value) {
@@ -326,60 +319,52 @@ void MagmaKVStoreConfig::setBucketQuota(size_t value) {
326319}
327320
328321void MagmaKVStoreConfig::setMagmaMemQuotaRatio (float value) {
322+ Expects (store);
329323 magmaMemQuotaRatio.store (value);
330- if (store) {
331- store->setMaxDataSize (bucketQuota);
332- }
324+ store->setMaxDataSize (bucketQuota);
333325}
334326
335327void MagmaKVStoreConfig::setMagmaEnableBlockCache (bool enable) {
328+ Expects (store);
336329 magmaEnableBlockCache.store (enable);
337- if (store) {
338- store->setMagmaEnableBlockCache (enable);
339- }
330+ store->setMagmaEnableBlockCache (enable);
340331}
341332
342333void MagmaKVStoreConfig::setMagmaSeqTreeDataBlockSize (size_t value) {
334+ Expects (store);
343335 magmaSeqTreeDataBlockSize.store (value);
344- if (store) {
345- store->setMagmaSeqTreeDataBlockSize (value);
346- }
336+ store->setMagmaSeqTreeDataBlockSize (value);
347337}
348338
349339void MagmaKVStoreConfig::setMagmaMinValueBlockSizeThreshold (size_t value) {
340+ Expects (store);
350341 magmaMinValueBlockSizeThreshold.store (value);
351- if (store) {
352- store->setMagmaMinValueBlockSizeThreshold (value);
353- }
342+ store->setMagmaMinValueBlockSizeThreshold (value);
354343}
355344
356345void MagmaKVStoreConfig::setMagmaSeqTreeIndexBlockSize (size_t value) {
346+ Expects (store);
357347 magmaSeqTreeIndexBlockSize.store (value);
358- if (store) {
359- store->setMagmaSeqTreeIndexBlockSize (value);
360- }
348+ store->setMagmaSeqTreeIndexBlockSize (value);
361349}
362350
363351void MagmaKVStoreConfig::setMagmaKeyTreeDataBlockSize (size_t value) {
352+ Expects (store);
364353 magmaKeyTreeDataBlockSize.store (value);
365- if (store) {
366- store->setMagmaKeyTreeDataBlockSize (value);
367- }
354+ store->setMagmaKeyTreeDataBlockSize (value);
368355}
369356
370357void MagmaKVStoreConfig::setMagmaKeyTreeIndexBlockSize (size_t value) {
358+ Expects (store);
371359 magmaKeyTreeIndexBlockSize.store (value);
372- if (store) {
373- store->setMagmaKeyTreeIndexBlockSize (value);
374- }
360+ store->setMagmaKeyTreeIndexBlockSize (value);
375361}
376362
377363void MagmaKVStoreConfig::setContinousBackupInterval (
378364 std::chrono::seconds interval) {
365+ Expects (store);
379366 continuousBackupInterval = interval;
380- if (store) {
381- store->setContinuousBackupInterval (interval);
382- }
367+ store->setContinuousBackupInterval (interval);
383368}
384369
385370void MagmaKVStoreConfig::setMakeDirectoryFn (magma::DirectoryConstructor fn) {
0 commit comments