nano-store 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/.gitignore +3 -0
  2. data/.gitmodules +3 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE +25 -0
  6. data/README.md +193 -0
  7. data/Rakefile +1 -0
  8. data/app/app_delegate.rb +5 -0
  9. data/lib/nano-store.rb +1 -0
  10. data/lib/nano_store/bag.rb +98 -0
  11. data/lib/nano_store/model.rb +142 -0
  12. data/lib/nano_store/nano_store.rb +36 -0
  13. data/lib/nano_store/store_extension.rb +150 -0
  14. data/lib/nano_store/version.rb +3 -0
  15. data/lib/nano_store.rb +14 -0
  16. data/nano-store.gemspec +17 -0
  17. data/resources/.gitignore +0 -0
  18. data/spec/bag_spec.rb +66 -0
  19. data/spec/model_spec.rb +130 -0
  20. data/spec/nano_store_spec.rb +48 -0
  21. data/spec/store_extension_spec.rb +110 -0
  22. data/vendor/NanoStore/Classes/Advanced/NSFNanoEngine.h +542 -0
  23. data/vendor/NanoStore/Classes/Advanced/NSFNanoEngine.m +1781 -0
  24. data/vendor/NanoStore/Classes/Advanced/NSFNanoResult.h +137 -0
  25. data/vendor/NanoStore/Classes/Advanced/NSFNanoResult.m +265 -0
  26. data/vendor/NanoStore/Classes/Private/NSFNanoBag_Private.h +37 -0
  27. data/vendor/NanoStore/Classes/Private/NSFNanoEngine_Private.h +69 -0
  28. data/vendor/NanoStore/Classes/Private/NSFNanoExpression_Private.h +35 -0
  29. data/vendor/NanoStore/Classes/Private/NSFNanoGlobals_Private.h +99 -0
  30. data/vendor/NanoStore/Classes/Private/NSFNanoObject_Private.h +35 -0
  31. data/vendor/NanoStore/Classes/Private/NSFNanoPredicate_Private.h +35 -0
  32. data/vendor/NanoStore/Classes/Private/NSFNanoResult_Private.h +43 -0
  33. data/vendor/NanoStore/Classes/Private/NSFNanoSearch_Private.h +48 -0
  34. data/vendor/NanoStore/Classes/Private/NSFNanoStore_Private.h +57 -0
  35. data/vendor/NanoStore/Classes/Private/NanoStore_Private.h +37 -0
  36. data/vendor/NanoStore/Classes/Public/NSFNanoBag.h +306 -0
  37. data/vendor/NanoStore/Classes/Public/NSFNanoBag.m +485 -0
  38. data/vendor/NanoStore/Classes/Public/NSFNanoExpression.h +125 -0
  39. data/vendor/NanoStore/Classes/Public/NSFNanoExpression.m +103 -0
  40. data/vendor/NanoStore/Classes/Public/NSFNanoGlobals.h +323 -0
  41. data/vendor/NanoStore/Classes/Public/NSFNanoGlobals.m +145 -0
  42. data/vendor/NanoStore/Classes/Public/NSFNanoObject.h +298 -0
  43. data/vendor/NanoStore/Classes/Public/NSFNanoObject.m +187 -0
  44. data/vendor/NanoStore/Classes/Public/NSFNanoObjectProtocol.h +119 -0
  45. data/vendor/NanoStore/Classes/Public/NSFNanoPredicate.h +123 -0
  46. data/vendor/NanoStore/Classes/Public/NSFNanoPredicate.m +130 -0
  47. data/vendor/NanoStore/Classes/Public/NSFNanoSearch.h +381 -0
  48. data/vendor/NanoStore/Classes/Public/NSFNanoSearch.m +835 -0
  49. data/vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.h +124 -0
  50. data/vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.m +79 -0
  51. data/vendor/NanoStore/Classes/Public/NSFNanoStore.h +475 -0
  52. data/vendor/NanoStore/Classes/Public/NSFNanoStore.m +1375 -0
  53. data/vendor/NanoStore/Classes/Public/NanoStore.h +463 -0
  54. data/vendor/NanoStore/LICENSE +25 -0
  55. data/vendor/NanoStore/NanoStore.bridgesupport +1215 -0
  56. data/vendor/NanoStore/README.md +411 -0
  57. metadata +118 -0
@@ -0,0 +1,411 @@
1
+ # Welcome To NanoStore
2
+
3
+ **What is NanoStore?**
4
+
5
+ NanoStore is an open source, lightweight schema-less local key-value document store written in Objective-C for Mac OS X and iOS.
6
+
7
+ Relational databases tend to have a rich understanding of the structure of your data, but requires some planing beforehand and some level of maintenance as well. NanoStore provides the flexibility that comes with key-value document stores, but still understands something about your data. Because the data is key-value based, it can be accessed quickly and can grow as much as needed... all without ever worrying about the schema.
8
+
9
+ **Main advantages**
10
+
11
+ * No SQL knowledge required
12
+ * Schema-less
13
+ * Key-value based storage
14
+ * Store your own custom objects
15
+ * Bags, a free-form relational system
16
+ * Fast, direct object manipulation
17
+ * Dynamic queries
18
+ * Full index support, inner-objects, embedded arrays and dictionaries
19
+ * Convenience methods to access, manipulate and maintain SQLite databases
20
+ * Full SQLite access available
21
+ * Mac OS X Lion 10.7 and iOS 5 ready
22
+ * iOS library runs on the device and simulator
23
+ * ARC compliant
24
+
25
+ # Installation
26
+
27
+ Building NanoStore is very easy. Just follow these steps:
28
+
29
+ 1) Download NanoStore
30
+ 2) Open the NanoStore.xcodeproj file
31
+ 3) Select Universal > My Mac 64-bit or 32-bit from the Scheme popup
32
+ 4) Build (Command-B)
33
+
34
+ Now you should have a new ***Distribution*** directory within the NanoStore project directory which contains the Universal static library (armv6/armv7/i386) as well as the header files. To add it in your project, do the following:
35
+
36
+ 1) Drag the Distribution directory to the Project Navigator panel
37
+ 2) Include #import "NanoStore.h" in your code
38
+
39
+ Example:
40
+
41
+ #import "NanoStore.h"
42
+
43
+ @implementation MyDemoAppDelegate
44
+
45
+ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
46
+ {
47
+ // Override point for customization after application launch.
48
+ // Instantiate a NanoStore and open it
49
+
50
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
51
+ ...
52
+
53
+ ### Note
54
+ If you want to add a dependency between your project and NanoStore so that it gets automatically rebuilt when
55
+ you update NanoStore, do the following (we'll assume your app is called "MyDemoApp"):
56
+
57
+ 1) Select the MyDemoApp project in the Project Navigator
58
+ 2) Select the MyDemoApp target
59
+ 3) Expand the Target Dependencies box
60
+ 4) Click "+" and add NanoStore
61
+
62
+ # How does NanoStore work?
63
+
64
+ The basic unit of data in NanoStore is called NanoObject. A NanoObject is any object which conforms to the `NSFNanoObjectProtocol` protocol.
65
+
66
+ At its core, a NanoObject is nothing more than a wrapper around two properties:
67
+
68
+ * A dictionary which contains the metadata (provided by the developer)
69
+ * A key (UUID) that identifies the object (provided by NanoStore)
70
+
71
+ The dictionary must be serializable, which means that only the following data types are allowed:
72
+
73
+ * NSArray
74
+ * NSDictionary
75
+ * NSString
76
+ * NSData (*)
77
+ * NSDate
78
+ * NSNumber
79
+
80
+ ### Note
81
+ (*) The data type NSData is allowed, but it will be excluded from the indexing process.
82
+
83
+ To save and retrieve objects from the document store, NanoStore moves the data around by encapsulating it in NanoObjects. In order to store the objects in NanoStore the developer has three options:
84
+
85
+ * Use the `NSFNanoObject` class directly
86
+ * Expand your custom classes by inheriting from `NSFNanoObject`
87
+ * Expand your custom classes by implementing the `NSFNanoObjectProtocol` protocol
88
+
89
+ Regardless of the route you decide to take, NanoStore will be able to store and retrieve objects from the document store seamlessly. The beauty of this system is that NanoStore returns the object as it was stored, that is, instantiating an object of the class that was originally stored.
90
+
91
+ ### Note
92
+ If the document store is opened by another application that doesn't implement the object that was stored, NanoStore
93
+ will instantiate a NSFNanoObject instead, thus allowing the app to retrieve the data seamlessly. If the object is then
94
+ updated by this application, the original class name will be honored.
95
+
96
+ ### Example
97
+ App A stores an object of class Car.
98
+ App B retrieves the object, but since it doesn't know anything about the class Car, NanoStore returns a NSFNanoObject.
99
+ App B updates the object, with additional information. NanoStore saves it as a Car, not as a NSFNanoObject.
100
+ App A retrieves the updated object as a Car object, in exactly the same format as it was originally stored.
101
+
102
+ # Types of Document Stores
103
+
104
+ There are three types of document stores available in NanoStore: in-memory, temporary and file-based. These document stores are defined by the `NSFNanoStoreType` type:
105
+
106
+ `NSFMemoryStoreType`
107
+
108
+ Create the transient backing store in RAM. Its contents are lost when the process exits. Fastest, uses more RAM (*).
109
+
110
+ `NSFTemporaryStoreType`
111
+
112
+ Create a transient temporary backing store on disk. Its contents are lost when the process exits. Slower, uses less
113
+ RAM than NSFMemoryStoreType.
114
+
115
+ `NSFPersistentStoreType`
116
+
117
+ Create a persistent backing store on disk. Slower, uses less RAM than NSFMemoryStoreType (*).
118
+
119
+ ### Note
120
+ Until the limit set by NSFNanoEngine's - (NSUInteger)cacheSize has been reached, memory usage would be the same for
121
+ in-memory and on-disk stores. When the size of the store grows beyond - (NSUInteger)cacheSize in-memory stores start to
122
+ consume more memory than on-disk ones, because it has nowhere to push pages out of the cache.
123
+
124
+ Typically, most developers may want to create and open the document store. To do that, use the following method:
125
+
126
+ + (NSFNanoStore *)createAndOpenStoreWithType:(NSFNanoStoreType)aType path:(NSString *)aPath error:(out NSError **)outError
127
+
128
+ ### Example
129
+ // Instantiate an in-memory document store and open it. The path parameter is unused.
130
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
131
+
132
+ // Instantiate a temporary document store and open it. The path parameter is unused.
133
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFTemporaryStoreType path:nil error:nil];
134
+
135
+ // Instantiate a file-based document store and open it. The path parameter must be specified.
136
+ NSString *thePath = @"~/Desktop/myDatabase.database";
137
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFPersistentStoreType path:thePath error:nil];
138
+
139
+ ### Note
140
+ In the case of file-based document stores, the file gets created automatically if it doesn't exist and then opened. If
141
+ it already exists, it gets opened and made available for use right away. There are instances where you may want to
142
+ fine-tune the engine. Tuning the engine has to be performed before the document store is opened. Another method is
143
+ available in NSFNanoStore for this purpose:
144
+
145
+ + (NSFNanoStore *)createStoreWithType:(NSFNanoStoreType)theType path:(NSString *)thePath.
146
+
147
+ ### Example
148
+ // Instantiate a file-based document store but don't open it right away. The path parameter must be specified.
149
+ NSString *thePath = @"~/Desktop/myDatabase.database";
150
+ NSFNanoStore *nanoStore = [NSFNanoStore createStoreWithType:NSFPersistentStoreType path:thePath error:nil];
151
+
152
+ // Obtain the engine
153
+ NSFNanoEngine *nanoStoreEngine = [nanoStore nanoStoreEngine];
154
+
155
+ // Set the synchronous mode setting
156
+ [nanoStoreEngine setSynchronousMode:SynchronousModeOff];
157
+ [nanoStoreEngine setEncodingType:NSFEncodingUTF16];
158
+
159
+ // Open the document store
160
+ [nanoStore openWithError:nil];
161
+
162
+ ### Note
163
+ Check the section Performance Tips below for important information about how to get the most out of NanoStore.
164
+
165
+ # Working with a NanoObject
166
+
167
+ There are three basic operations that NanoStore can perform with a NanoObject:
168
+
169
+ * Add it to the document store
170
+ * Update an existing object in the document store
171
+ * Remove it from the document store
172
+
173
+ To add an object, instantiate a `NSFNanoObject`, populate it and add it to the document store.
174
+
175
+ ### Example
176
+ // Instantiate a NanoStore and open it
177
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
178
+
179
+ // Generate an empty NanoObject
180
+ NSFNanoObject *object = [NSFNanoObject nanoObject];
181
+
182
+ // Add some data
183
+ [object setObject:@"Doe" forKey:@"kLastName"];
184
+ [object setObject:@"John" forKey:@"kFirstName"];
185
+ [object setObject:[NSArray arrayWithObjects:@"jdoe@foo.com", @"jdoe@bar.com", nil] forKey:@"kEmails"];
186
+
187
+ // Add it to the document store
188
+ [nanoStore addObject:object error:nil];
189
+
190
+ // Close the document store
191
+ [nanoStore closeWithError:nil];
192
+
193
+ Alternatively, you can instantiate a NanoObject providing a dictionary via:
194
+
195
+ + (NSFNanoObject*)nanoObjectWithDictionary:(NSDictionary *)theDictionary
196
+
197
+ NanoStore will assign a UUID automatically when the NanoObject is instantiated. This means that requesting the key from the NanoObject will return a valid UUID. The same holds true for objects that inherit from `NSFNanoObject`. However, classes that implement the `NSFNanoObjectProtocol` protocol should make sure they return a valid key via:
198
+
199
+ - (NSString *)nanoObjectKey
200
+
201
+ ### Warning
202
+ If an attempt is made to add or remove an object without a valid key, an exception of type NSFNanoObjectBehaviorException
203
+ will be raised. To update an object, simply modify the object and add it to the document store. NanoStore will replace
204
+ the existing object with the one being added.
205
+
206
+ ### Example
207
+ // Instantiate and open a NanoStore
208
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
209
+
210
+ // Assuming the dictionary exists, instantiate a NanoObject
211
+ NSDictionary *info = ...;
212
+ NSFNanoObject *object = [NSFNanoObject nanoObjectWithDictionary:info];
213
+
214
+ // Add the NanoObject to the document store
215
+ [nanoStore addObject:object error:nil];
216
+
217
+ // Update the NanoObject with new data
218
+ [object setObject:@"foo" forKey:@"SomeKey"];
219
+
220
+ // Update the NanoObject in the document store
221
+ [nanoStore addObject:object error:nil];
222
+
223
+ To remove an object, there are several options available. The most common methods are found in NSFNanoStore:
224
+
225
+ - (BOOL)removeObject:(id <NSFNanoObjectProtocol>)theObject error:(out NSError **)outError
226
+ - (BOOL)removeObjectsWithKeysInArray:(NSArray *)theKeys error:(out NSError **)outError
227
+ - (BOOL)removeObjectsInArray:(NSArray *)theObjects error:(out NSError **)outError
228
+
229
+ ### Example
230
+ // Instantiate and open a NanoStore
231
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
232
+
233
+ // Assuming the dictionary exists, instantiate a NanoObject
234
+ NSDictionary *info = ...;
235
+ NSFNanoObject *object = [NSFNanoObject nanoObjectWithDictionary:info];
236
+
237
+ // Add the NanoObject to the document store
238
+ [nanoStore addObject:object error:nil];
239
+
240
+ // Remove the object
241
+ [nanoStore removeObject:object error:nil];
242
+
243
+ // ... or you could pass the key instead
244
+ [nanoStore removeObjectsWithKeysInArray:[NSArray arrayWithObject:[object nanoObjectKey]] error:nil];
245
+
246
+ # It's not a flat World
247
+
248
+ Most database solutions force the developer to think in a two-dimensional space (rows and columns), forcing the developer to plan the schema ahead of time. This situation is not ideal because in most cases schema refinements could be required, oftentimes impacting the code as well.
249
+
250
+ NanoStore goes beyond that allowing the developer to store objects in their natural form. These objects must conform to the `NSFNanoObjectProtocol` protocol, providing NanoStore with the NSDictionary that will be stored. By using a dictionary data can be inspected very quickly, and it also allows the structure to be defined in a hierarchical fashion as well, due to the fact that it includes support for nested collections (of type NSDictionary and NSArray.) Each inner-object is indexed automatically, thus allowing to quickly find objects which contain a specific key and/or value.
251
+
252
+ By default, NanoStore allows objects to be stored without any sense of relationship to other objects. This simple format, while powerful, is limited because the developer has to keep track of the relationships among objects. Some applications may need to relate objects, some of them perhaps of different nature or class type. This is exactly what NanoBag (represented by the `NSFNanoBag` class) does: it allows any object conforming to the `NSFNanoObjectProtocol` protocol to be added to the bag. By saving the bag with one single call, the new and/or modified NanoObjects are taken care of seamlessly.
253
+
254
+ The `NSFNanoBag` API is rich, allowing the developer to add, remove, reload and undo its changes, deflate it (thus saving memory) and inflate it whenever it's required. In addition, it provides methods to obtain all bags, specific bags matching some keys, and bags containing a specific object (see `NSFNanoStore` for more information).
255
+
256
+ # Where are my objects?
257
+
258
+ While `NSFNanoStore` provides some convenience methods to obtain standard objects such as bags, the bulk of the search mechanism is handled by `NSFNanoSearch`. The steps involved to perform a search are quite simple:
259
+
260
+ 1) Instantiate a search object
261
+ 2) Configure the search via its accessors
262
+ 3) Obtain the results specifying whether objects or keys should be returned (*)
263
+
264
+ ### Note
265
+ (*) If introspecting the data is needed, request objects. You should request keys if you need to feed the result to
266
+ another method, such as the following method in NSFNanoStore:
267
+
268
+ -(BOOL)removeObjectsWithKeysInArray:(NSArray *)theKeys error:(out NSError **)outError
269
+
270
+ ### Example: finding all objects with the attribute 'LastName' and value 'Doe'
271
+
272
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
273
+
274
+ search.attribute = @"LastName";
275
+ search.match = NSFEqualTo;
276
+ search.value = @"Doe";
277
+
278
+ // Returns a dictionary with the UUID of the object (key) and the NanoObject (value).
279
+ NSDictionary *searchResults = [search searchObjectsWithReturnType:NSFReturnObjects error:nil];
280
+
281
+ ### Example: removing all objects with the attribute 'LastName' and value 'Doe'
282
+
283
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
284
+
285
+ search.attribute = @"LastName";
286
+ search.match = NSFEqualTo;
287
+ search.value = @"Doe";
288
+
289
+ // Returns an array of matching UUIDs
290
+ NSArray *matchingKeys = [search searchObjectsWithReturnType:NSFReturnKeys error:nil];
291
+
292
+ // Remove the NanoObjects matching the selected UUIDs
293
+ NSError *outError = nil;
294
+ if (YES == [nanoStore removeObjectsWithKeysInArray:matchingKeys error:&outError]) {
295
+ NSLog(@"The matching objects have been removed.");
296
+ } else {
297
+ NSLog(@"An error has occurred while removing the matching objects. Reason: %@", [outError localizedDescription]);
298
+ }
299
+
300
+ ### Example: calculating the average salary of all objects with the attribute 'LastName' and value 'Doe'
301
+
302
+ Another cool feature is the possibility to invoke aggregated functions (count, avg, min, max and total) on the search results. Using the search snippet above, calculating the average salary of all people with last name equal to 'Doe' is very easy.
303
+
304
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
305
+
306
+ search.attribute = @"LastName";
307
+ search.match = NSFEqualTo;
308
+ search.value = @"Doe";
309
+
310
+ float averageSalary = [[search aggregateOperation:NSFAverage onAttribute:@"Salary"]floatValue];
311
+
312
+ # Sorting
313
+
314
+ Combining search and sort is an extremely easy operation. There are two simple parts:
315
+
316
+ 1) Preparing your classes for sorting
317
+ 2) Setup a search operation and set its sort descriptors
318
+
319
+ ### Preparing your classes for sorting
320
+
321
+ Since NanoStore relies on KVC to perform the sorts, a hint of the location where the data lives within the object is required. Since KVC uses a key path to reach the element being sorted, we need a way to "point" to it. Most custom classes will return *self*, as is the case for NSFNanoBag:
322
+
323
+ - (id)rootObject
324
+ {
325
+ return self;
326
+ }
327
+
328
+ *Self* in this case represents the top level, the location where the variables *name*, *key* and *hasUnsavedChanges* are located:
329
+
330
+ @interface NSFNanoBag : NSObject <NSFNanoObjectProtocol, NSCopying>
331
+ {
332
+ NSFNanoStore *store;
333
+ NSString *name;
334
+ NSString *key;
335
+ BOOL hasUnsavedChanges;
336
+ }
337
+
338
+ Assume we have an object that represents a person and its root object is set to <i>self</i>, just as demonstrated above:
339
+
340
+ @interface Person : NSFNanoObject
341
+ {
342
+ NSString *firstName;
343
+ NSString *lastName;
344
+ NSString *email;
345
+ }
346
+
347
+ If we wanted to retrieve all the existing people with <i>firstName</i> equal to <i>John</i> sorted by <i>lastName</i> we would do the following:
348
+
349
+ // Assume NanoStore has been opened elsewhere
350
+ NSFNanoStore *nanoStore = ...;
351
+
352
+ // Prepare the search
353
+ NSFNanoSearch *search = [NSFNanoSearch searchWithStore:nanoStore];
354
+ search.attribute = @"firstName";
355
+ search.match = NSFEqualTo;
356
+ search.value = @"John";
357
+
358
+ // Prepare and set the sort descriptor
359
+ NSFNanoSortDescriptor *sortByLastName = [[NSFNanoSortDescriptor alloc]initWithAttribute:@"lastName" ascending:YES];
360
+ search.sort = [NSArray arrayWithObject:sortByLastName];
361
+
362
+ // Perform the search
363
+ NSArray *searchResults = [search searchObjectsWithReturnType:NSFReturnObjects error:nil];
364
+
365
+ // Cleanup
366
+ [sortByLastName release];
367
+
368
+ # Performance Tips
369
+
370
+ NanoStore by defaults saves every object to disk one by one. To speed up inserts and edited objects, increase NSFNanoStore's `saveInterval` property.
371
+
372
+ ### Example
373
+
374
+ // Instantiate and open a NanoStore
375
+ NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
376
+
377
+ // Increase the save interval
378
+ [nanoStore setSaveInterval:1000];
379
+
380
+ // Do a bunch of inserts and/or edits
381
+
382
+ // Don't forget that some objects could be lingering in memory. Force a save.
383
+ [nanoStore saveStoreAndReturnError:nil];
384
+
385
+ ### Note
386
+ If you set the saveInterval value to anything other one, keep in mind that some objects may still be left unsaved after
387
+ being added or modified. To make sure they're saved properly, call:
388
+
389
+ - (BOOL)saveStoreAndReturnError:(out NSError **)outError .
390
+
391
+ Choosing a good saveInterval value is more art than science. While testing NanoStore using a medium-sized dictionary
392
+ (iTunes MP3 dictionary) setting saveInterval to 1000 resulted in the best performance. You may want to test with
393
+ different numbers and fine-tune it for your data set.
394
+
395
+ ### Warning
396
+ Setting saveInterval to a large number could result in decreased performance because SQLite's would have to spend more
397
+ time reading the journal file and writing the changes to the store.
398
+
399
+ # Need more help?
400
+
401
+ There are two quick ways to find answers: reading the documentation and browsing the Unit tests.
402
+
403
+ While several attempts have been made to make the documentation easy to read and understand, it's far from perfect. If you find that the documentation is incomplete, incorrect or needs some clarification, please file a bug. I'll appreciate it and correct it as soon as possible:
404
+
405
+ * NanoStore Documentation: http://dl.dropbox.com/u/2601212/NanoStore%202.0/html/index.html
406
+ * NanoStore Bug Tracker: https://github.com/tciuro/NanoStore/issues
407
+ * Twitter: http://twitter.com/nanostoredev
408
+
409
+ # Official Source Repository
410
+
411
+ The official repository for NanoStore is hosted on GitHub: https://github.com/tciuro/NanoStore
metadata ADDED
@@ -0,0 +1,118 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nano-store
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Francis Chong
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bubble-wrap
16
+ requirement: &70225605252720 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.1.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70225605252720
25
+ description: Wrapper for NanoStore, a lightweight schema-less key-value document database
26
+ based on sqlite, for RubyMotion.
27
+ email:
28
+ - francis@ignition.hk
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - .gitmodules
35
+ - .rvmrc
36
+ - Gemfile
37
+ - LICENSE
38
+ - README.md
39
+ - Rakefile
40
+ - app/app_delegate.rb
41
+ - lib/nano-store.rb
42
+ - lib/nano_store.rb
43
+ - lib/nano_store/bag.rb
44
+ - lib/nano_store/model.rb
45
+ - lib/nano_store/nano_store.rb
46
+ - lib/nano_store/store_extension.rb
47
+ - lib/nano_store/version.rb
48
+ - nano-store.gemspec
49
+ - resources/.gitignore
50
+ - spec/bag_spec.rb
51
+ - spec/model_spec.rb
52
+ - spec/nano_store_spec.rb
53
+ - spec/store_extension_spec.rb
54
+ - vendor/NanoStore/Classes/Advanced/NSFNanoEngine.h
55
+ - vendor/NanoStore/Classes/Advanced/NSFNanoEngine.m
56
+ - vendor/NanoStore/Classes/Advanced/NSFNanoResult.h
57
+ - vendor/NanoStore/Classes/Advanced/NSFNanoResult.m
58
+ - vendor/NanoStore/Classes/Private/NSFNanoBag_Private.h
59
+ - vendor/NanoStore/Classes/Private/NSFNanoEngine_Private.h
60
+ - vendor/NanoStore/Classes/Private/NSFNanoExpression_Private.h
61
+ - vendor/NanoStore/Classes/Private/NSFNanoGlobals_Private.h
62
+ - vendor/NanoStore/Classes/Private/NSFNanoObject_Private.h
63
+ - vendor/NanoStore/Classes/Private/NSFNanoPredicate_Private.h
64
+ - vendor/NanoStore/Classes/Private/NSFNanoResult_Private.h
65
+ - vendor/NanoStore/Classes/Private/NSFNanoSearch_Private.h
66
+ - vendor/NanoStore/Classes/Private/NSFNanoStore_Private.h
67
+ - vendor/NanoStore/Classes/Private/NanoStore_Private.h
68
+ - vendor/NanoStore/Classes/Public/NSFNanoBag.h
69
+ - vendor/NanoStore/Classes/Public/NSFNanoBag.m
70
+ - vendor/NanoStore/Classes/Public/NSFNanoExpression.h
71
+ - vendor/NanoStore/Classes/Public/NSFNanoExpression.m
72
+ - vendor/NanoStore/Classes/Public/NSFNanoGlobals.h
73
+ - vendor/NanoStore/Classes/Public/NSFNanoGlobals.m
74
+ - vendor/NanoStore/Classes/Public/NSFNanoObject.h
75
+ - vendor/NanoStore/Classes/Public/NSFNanoObject.m
76
+ - vendor/NanoStore/Classes/Public/NSFNanoObjectProtocol.h
77
+ - vendor/NanoStore/Classes/Public/NSFNanoPredicate.h
78
+ - vendor/NanoStore/Classes/Public/NSFNanoPredicate.m
79
+ - vendor/NanoStore/Classes/Public/NSFNanoSearch.h
80
+ - vendor/NanoStore/Classes/Public/NSFNanoSearch.m
81
+ - vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.h
82
+ - vendor/NanoStore/Classes/Public/NSFNanoSortDescriptor.m
83
+ - vendor/NanoStore/Classes/Public/NSFNanoStore.h
84
+ - vendor/NanoStore/Classes/Public/NSFNanoStore.m
85
+ - vendor/NanoStore/Classes/Public/NanoStore.h
86
+ - vendor/NanoStore/LICENSE
87
+ - vendor/NanoStore/NanoStore.bridgesupport
88
+ - vendor/NanoStore/README.md
89
+ homepage: https://github.com/siuying/NanoStoreInMotion
90
+ licenses: []
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 1.8.15
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Wrapper for NanoStore, a lightweight schema-less key-value document database
113
+ based on sqlite, for RubyMotion.
114
+ test_files:
115
+ - spec/bag_spec.rb
116
+ - spec/model_spec.rb
117
+ - spec/nano_store_spec.rb
118
+ - spec/store_extension_spec.rb