mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
26 lines
956 B
Objective-C
26 lines
956 B
Objective-C
#import <Foundation/Foundation.h>
|
|
|
|
/**
|
|
*
|
|
* A bloom filter allows a set of items to be represented compactly, at the cost of false-positives when checking membership.
|
|
* When contains returns true, the given item may be in the set.
|
|
* When contains returns false, the given item is definitely not in the set.
|
|
*
|
|
* Bloom filters are used to opportunistically avoid starting an expensive operation that always fails for items not in a set.
|
|
* In the specific case of RedPhone, it is used to determine if a phone number can be called (i.e. is in the RedPhone directory).
|
|
*
|
|
*/
|
|
@interface BloomFilter : NSObject
|
|
|
|
@property (nonatomic,readonly) NSUInteger hashCount;
|
|
@property (nonatomic,readonly) NSData* data;
|
|
|
|
+(BloomFilter*) bloomFilterWithHashCount:(NSUInteger)hashCount
|
|
andData:(NSData*)data;
|
|
+(BloomFilter*) bloomFilterWithNothing;
|
|
+(BloomFilter*) bloomFilterWithEverything;
|
|
|
|
-(bool) contains:(NSString*)entity;
|
|
|
|
@end
|