 
 import Foundation
 
-internal class JobConstraint {
+internal protocol JobConstraint {
 
-    func schedule(queue: SwiftQueue, operation: SwiftQueueJob) throws {
+    func schedule(queue: SwiftQueue, operation: SwiftQueueJob) throws
 
-    }
-
-    func run(operation: SwiftQueueJob) throws {
-
-    }
+    func run(operation: SwiftQueueJob) throws
 
 }
 

        if exist {
            throw TaskAlreadyExist()
        }
    }
}



    class TaskAlreadyExist: ConstraintError {}

    func schedule(queue: SwiftQueue, operation: SwiftQueueJob) throws {
        let exist = queue.operations.contains {
            if let op = $0 as? SwiftQueueJob {
                return op.uuid == operation.uuid
