WIP: CSSetupResult

This commit is contained in:
John Rommel Estropia
2016-03-30 01:55:06 +09:00
parent e25e198bf8
commit 09d844f5df
9 changed files with 287 additions and 43 deletions

View File

@@ -2,11 +2,32 @@
// CSStorageInterface.swift
// CoreStore
//
// Created by John Rommel Estropia on 2016/03/18.
// Copyright © 2016 John Rommel Estropia. All rights reserved.
// Copyright © 2016 John Rommel Estropia
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import UIKit
import Foundation
import CoreData
// MARK: - CSStorageInterface
/**
The `CSStorageInterface` serves as the Objective-C bridging type for `StorageInterface`.
@@ -40,39 +61,27 @@ public protocol CSStorageInterface {
The `CSLocalStorageOptions` provides settings that tells the `CSDataStack` how to setup the persistent store for `CSLocalStorage` implementers.
*/
@objc
public final class CSLocalStorageOptions: NSObject {
public enum CSLocalStorageOptions: Int {
/**
Tells the `DataStack` that the store should not be migrated or recreated, and should simply fail on model mismatch
*/
@objc
public static let none = 0
case None = 0
/**
Tells the `DataStack` to delete and recreate the store on model mismatch, otherwise exceptions will be thrown on failure instead
*/
@objc
public static let recreateStoreOnModelMismatch = 1
case RecreateStoreOnModelMismatch = 1
/**
Tells the `DataStack` to prevent progressive migrations for the store
*/
@objc
public static let preventProgressiveMigration = 2
case PreventProgressiveMigration = 2
/**
Tells the `DataStack` to allow lightweight migration for the store when added synchronously
*/
@objc
public static let allowSynchronousLightweightMigration = 4
// MARK: Private
private override init() {
fatalError()
}
case AllowSynchronousLightweightMigration = 4
}