WIP: clean up persistent store setup

This commit is contained in:
John Estropia
2016-03-10 20:19:52 +09:00
parent a89dd76906
commit 6822a4579e
8 changed files with 359 additions and 257 deletions

View File

@@ -34,8 +34,6 @@ public protocol StorageInterface: class {
var configuration: String? { get }
var storeOptions: [String: AnyObject]? { get }
var internalStore: NSPersistentStore? { get set }
}
@@ -57,3 +55,16 @@ public protocol LocalStorage: StorageInterface {
func eraseStorageAndWait(soureModel soureModel: NSManagedObjectModel) throws
}
// MARK: Internal
internal extension LocalStorage {
internal func matchesPersistentStore(persistentStore: NSPersistentStore) -> Bool {
return persistentStore.type == self.dynamicType.storeType
&& persistentStore.configurationName == (self.configuration ?? Into.defaultConfigurationName)
&& persistentStore.URL == self.fileURL
}
}