@@ -349,7 +349,7 @@ NS_ASSUME_NONNULL_BEGIN
349
349
/* *
350
350
Returns the object for the given key.
351
351
352
- @peram aKey The key for object.
352
+ @param aKey The key for object.
353
353
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
354
354
@return The object for the given key.
355
355
*/
@@ -358,7 +358,7 @@ NS_ASSUME_NONNULL_BEGIN
358
358
/* *
359
359
Returns the object for the given key.
360
360
361
- @peram aKey The key for object.
361
+ @param aKey The key for object.
362
362
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
363
363
@param readOptions A block with a `RocksDBReadOptions` instance for configuring this read operation.
364
364
@return The object for the given key.
@@ -369,6 +369,35 @@ NS_ASSUME_NONNULL_BEGIN
369
369
readOptions : (nullable void (^)(RocksDBReadOptions *readOptions))readOptions
370
370
error:(NSError * _Nullable *)error;
371
371
372
+ /* *
373
+ If the key definitely does not exist in the database, then this method
374
+ returns false, else true.
375
+
376
+ This check is potentially lighter-weight than invoking dataForKey. One way
377
+ to make this lighter weight is to avoid doing any IOs.
378
+
379
+ @param aKey The key for object to check.
380
+ @param value out parameter if a value is found in block-cache.
381
+ @return The object for the given key.
382
+ */
383
+ - (BOOL )keyMayExist : (NSData *)aKey value : (NSString * _Nullable *_Nullable)value ;
384
+
385
+ /* *
386
+ If the key definitely does not exist in the database, then this method
387
+ returns false, else true.
388
+
389
+ This check is potentially lighter-weight than invoking dataForKey. One way
390
+ to make this lighter weight is to avoid doing any IOs.
391
+
392
+ @param aKey The key for object to check.
393
+ @param readOptions `RocksDBReadOptions` instance for configuring this read operation.
394
+ @param value out parameter if a value is found in block-cache.
395
+ @return The object for the given key.
396
+ */
397
+ - (BOOL )keyMayExist : (NSData *)aKey
398
+ readOptions : (nullable void (^)(RocksDBReadOptions *readOptions))readOptions
399
+ value:(NSString * _Nullable *_Nullable)value;
400
+
372
401
@end
373
402
374
403
#pragma mark - Delete operations
@@ -382,7 +411,7 @@ NS_ASSUME_NONNULL_BEGIN
382
411
/* *
383
412
Deletes the object for the given key.
384
413
385
- @peram aKey The key to delete.
414
+ @param aKey The key to delete.
386
415
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
387
416
@return `YES` if the operation succeeded, `NO` otherwise
388
417
*/
@@ -391,7 +420,7 @@ NS_ASSUME_NONNULL_BEGIN
391
420
/* *
392
421
Deletes the object for the given key.
393
422
394
- @peram aKey The key to delete.
423
+ @param aKey The key to delete.
395
424
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
396
425
@param writeOptions A block with a `RocksDBWriteOptions` instance for configuring this delete operation.
397
426
@return `YES` if the operation succeeded, `NO` otherwise
@@ -571,4 +600,49 @@ NS_ASSUME_NONNULL_BEGIN
571
600
572
601
@end
573
602
603
+ #pragma mark - File Deletions
604
+
605
+ @interface RocksDB (FileDeletion)
606
+
607
+ // /--------------------------------
608
+ // / @name File Deletions
609
+ // /--------------------------------
610
+
611
+ /* *
612
+ Prevent file deletions. Compactions will continue to occur,
613
+ but no obsolete files will be deleted. Calling this multiple
614
+ times have the same effect as calling it once.
615
+ */
616
+ - (void )disableFileDeletions ;
617
+
618
+ /* *
619
+ Allow compactions to delete obsolete files.
620
+ If force == true, the call to EnableFileDeletions()
621
+ will guarantee that file deletions are enabled after
622
+ the call, even if DisableFileDeletions() was called
623
+ multiple times before.
624
+
625
+ If force == false, EnableFileDeletions will only
626
+ enable file deletion after it's been called at least
627
+ as many times as DisableFileDeletions(), enabling
628
+ the two methods to be called by two threads
629
+ concurrently without synchronization
630
+ -- i.e., file deletions will be enabled only after both
631
+ threads call EnableFileDeletions()
632
+
633
+ @param force boolean value described above.
634
+ */
635
+ - (void )enableFileDelections : (BOOL )force ;
636
+
637
+ /* *
638
+ Delete the file name from the db directory and update the internal state to
639
+ reflect that. Supports deletion of sst and log files only. 'name' must be
640
+ path relative to the db directory. eg. 000001.sst, /archive/000003.log
641
+
642
+ @param name the file name
643
+ */
644
+ - (void )deleteFile : (NSString *)name ;
645
+
646
+ @end
647
+
574
648
NS_ASSUME_NONNULL_END
0 commit comments