diff --git a/CDTDatastore.podspec b/CDTDatastore.podspec index 65fc24001..65a5b2008 100644 --- a/CDTDatastore.podspec +++ b/CDTDatastore.podspec @@ -14,7 +14,7 @@ EOT Pod::Spec.new do |s| s.name = "CDTDatastore" - s.version = "2.0.3" + s.version = "2.1.0" s.summary = "CDTDatastore is a document datastore which syncs." s.description = <<-DESC CDTDatastore is a JSON document datastore which speaks the diff --git a/CDTDatastore/Version.h b/CDTDatastore/Version.h index ff846764e..57f3619ec 100644 --- a/CDTDatastore/Version.h +++ b/CDTDatastore/Version.h @@ -1 +1 @@ -#define CLOUDANT_SYNC_VERSION "2.0.4-SNAPSHOT" +#define CLOUDANT_SYNC_VERSION "2.1.0" diff --git a/CHANGELOG.md b/CHANGELOG.md index 3655d29a2..0d4b7899d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # CDTDatastore CHANGELOG -## Unreleased +## 2.1.0 (2018-07-10) - [NEW] Add method `-closeDatastoreNamed:` on `CDTDatastoreManager`. - [FIXED] Fix issue where repeated calls to `-datastoreNamed:error:` on `CDTDatastoreManager` for the same datastore could cause crashes or failures. diff --git a/doc/crud.md b/doc/crud.md index c36994883..e2e0fb341 100644 --- a/doc/crud.md +++ b/doc/crud.md @@ -68,9 +68,33 @@ let ds2 = try manager.datastoreNamed("other_datastore") These datastores are persisted to disk between application runs. -The `CDTDatabaseManager` handles creating and initialising non-existent +The `CDTDatastoreManager` handles creating and initialising non-existent datastores, so the object returned is ready for reading and writing. +Calling `datastoreNamed` on an already open datastore will return the same reference to that +datastore. + +Datastores are held open for as long as they are needed and are automatically closed when the +`CDTDatastoreManager` is deallocated. This will typically happen at the end of the program or +earlier (for instance if `autoreleasepool`s are used or the manager is explicitly set to `nil`). + +In applications which open large numbers of Datastores it may be necessary to explicitly close +datastores after use to avoid exhaustion of file handles and other native resources. + +To close a datastore: + +Objective-C: + +```objc +[manager closeDatastoreNamed:@"my_datastore"]; +``` + +Swift: + +```swift +manager.closeDatastoreNamed("my_datastore"); +``` + To delete a datastore and all associated data (i.e., attachments and extension data such as indexes (see [query.md](query.md)):