Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 66 lines (47 sloc) 1.418 kB
66a3760 @fileability Pushing latest progress
fileability authored
1 /* We use core data for three things:
2 Persistence
3 Querying
4 A persistent object graph of the light-index
5 A throwaway object graph between full-index and html-generation
6
7 We can switch to basic sqlite for persistence. All that is required is modifying IGKScraper to execute SQL rather than create NSManagedObjects.
8
9 Likewise we can switch over querying to sqlite by rewriting all NSPredicates as SQL.
10
11 To replace the object graph, we can write a generalised NSObject graph library based on KVC. This would be a KVC-based and entirely in-memory multi-key object graph.
12 */
13
14 @interface GGNode : NSObject
15 {
16 NSDictionary *keyvalues;
17 }
18
19 - (id)valueForKey:(id)key;
20 - (id)setValue:(id)value forKey:(id)key;
21
22 @end
23
24 @implementation GGNode
25
26 - (id)valueForKey:(id)key
27 {
28 id value = [keyvalues objectForKey:key];
29
30 if (value)
31 return value;
32 else
33 return [self valueForUndefinedKey:key];
34 }
35 - (id)setValue:(id)value forKey:(id)key
36 {
37 if (value && key)
38 [keyvalues setValue:value forKey:key];
39 }
40
41 @end
42
43
44 @interface IGKRecord : GGNode
45 {
46 NSString *tableName;
47 uint64_t ident;
48 }
49
50 + (id)reverseKeyForToMany:(id)key;
51
52 @end
53
54 @implementation IGKRecord
55
56 - (id)valueForUndefinedKey:(id)undef
57 {
58 NSString *reverseKey = [IGKRecord reverseKeyForToMany:key];
59 if (!reverseKey)
60 return nil;
61
62 NSString *query = [NSString stringWithFormat:@"SELECT id FROM %@ WHERE %@=%llu", tableName, reverseKey, ident];
63 }
64
65 @end
Something went wrong with that request. Please try again.