         assert(self.mirrored, "Mirroring not activated on this index")
 
         // If already syncing, abort.
-        if self.syncing {
+        if syncing {
             return
         }
-        self.syncing = true
+        syncing = true
 
         // Notify observers.
         dispatch_async(dispatch_get_main_queue()) {

                assert(json != nil)
                // Write results to disk.
                if let data = try? NSJSONSerialization.dataWithJSONObject(json!, options: []) {
                    self.settingsFilePath = "\(self.tmpDir!)/settings.json"
                    data.writeToFile(self.settingsFilePath!, atomically: false)
                    return // all other paths go to error
                } else {
                    self.syncError = NSError(domain: Client.ErrorDomain, code: StatusCode.Unknown.rawValue, userInfo: [NSLocalizedDescriptionKey: "Could not write index settings"])

    }
    
    // ----------------------------------------------------------------------
    // MARK: - Sync
    // ----------------------------------------------------------------------

    /// Syncing indicator.
    /// NOTE: To prevent concurrent access to this variable, we always access it from the build (serial) queue.
    private var syncing: Bool = false
    
    /// Path to the temporary directory for the current sync.
    private var tmpDir : String!
    
    /// The path to the settings file.
    private var settingsFilePath: String!
    
    /// Paths to object files/
    private var objectsFilePaths: [String]!
    
    /// The current object file index. Object files are named `${i}.json`, where `i` is automatically incremented.
    private var objectFileIndex = 0
    
    /// The operation to build the index.
    /// NOTE: We need to store it because its dependencies are modified dynamically.
    private var buildIndexOperation: NSOperation!
    
    /// Path to the persistent mirror settings.
    private var mirrorSettingsFilePath: String {
        get { return "\(self.indexDataDir)/mirror.plist" }
    }
    
    /// Path to this index's offline data.
    private var indexDataDir: String {
        get { return "\(self.offlineClient.rootDataDir)/\(self.client.appID)/\(self.indexName)" }
    }
    
    /// Timeout for data synchronization queries.
    /// There is no need to use a too short timeout in this case: we don't need real-time performance, so failing
    /// too soon would only increase the likeliness of a failure.
