XMPPRosterCoreDataStorage.h
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "XMPPRoster.h"
#import "XMPPCoreDataStorage.h"
#import "XMPPUserCoreDataStorageObject.h"
#import "XMPPGroupCoreDataStorageObject.h"
#import "XMPPResourceCoreDataStorageObject.h"
/**
* This class is an example implementation of XMPPRosterStorage using core data.
* You are free to substitute your own roster storage class.
**/
@interface XMPPRosterCoreDataStorage : XMPPCoreDataStorage <XMPPRosterStorage>
{
// Inherits protected variables from XMPPCoreDataStorage
#if __has_feature(objc_arc_weak)
__weak XMPPRoster *parent;
#else
__unsafe_unretained XMPPRoster *parent;
#endif
dispatch_queue_t parentQueue;
void *parentQueueTag;
NSMutableSet *rosterPopulationSet;
}
/**
* Convenience method to get an instance with the default database name.
*
* IMPORTANT:
* You are NOT required to use the sharedInstance.
*
* If your application uses multiple xmppStreams, and you use a sharedInstance of this class,
* then all of your streams share the same database store. You might get better performance if you create
* multiple instances of this class instead (using different database filenames), as this way you can have
* concurrent writes to multiple databases.
**/
+ (instancetype)sharedInstance;
/* Inherited from XMPPCoreDataStorage
* Please see the XMPPCoreDataStorage header file for extensive documentation.
- (id)initWithDatabaseFilename:(NSString *)databaseFileName storeOptions:(NSDictionary *)storeOptions;
- (id)initWithInMemoryStore;
@property (readonly) NSString *databaseFileName;
@property (readwrite) NSUInteger saveThreshold;
@property (readonly) NSManagedObjectModel *managedObjectModel;
@property (readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property (readonly) NSManagedObjectContext *mainThreadManagedObjectContext;
*/
- (XMPPUserCoreDataStorageObject *)myUserForXMPPStream:(XMPPStream *)stream
managedObjectContext:(NSManagedObjectContext *)moc;
- (XMPPResourceCoreDataStorageObject *)myResourceForXMPPStream:(XMPPStream *)stream
managedObjectContext:(NSManagedObjectContext *)moc;
- (XMPPUserCoreDataStorageObject *)userForJID:(XMPPJID *)jid
xmppStream:(XMPPStream *)stream
managedObjectContext:(NSManagedObjectContext *)moc;
- (XMPPResourceCoreDataStorageObject *)resourceForJID:(XMPPJID *)jid
xmppStream:(XMPPStream *)stream
managedObjectContext:(NSManagedObjectContext *)moc;
@end