/** * Updates the dirty state of documents passed to clean. If the document was marked for removal it is permanently deleted. */ public int markDocumentsClean(JArray documents) { JSONStoreSQLLite store = JSONStoreSQLLite.sharedManager(); if (store == null) { throw new JSONStoreException(JSONStoreConstants.JSON_STORE_DATABASE_NOT_OPEN); } int numWorked = 0; JArray failedDocs = new JArray(); lock (JSONStore.lockThis) { foreach (JObject doc in documents) { string docId = doc.GetValue(JSONStoreConstants.JSON_STORE_FIELD_ID).ToString(); string operation = doc.GetValue(JSONStoreConstants.JSON_STORE_FIELD_OPERATION).ToString(); bool worked = store.markClean(docId, collectionName, operation); if (worked) { numWorked++; } else { failedDocs.Add(doc); } } if (failedDocs.Count > 0) { //JSONStoreLoggerError(@"Error: JSON_STORE_COULD_NOT_MARK_DOCUMENT_PUSHED, code: %d, collection name: %@, accessor username: %@, failedDocs count: %d, failedDocs: %@, numWorked: %d", JSON_STORE_COULD_NOT_MARK_DOCUMENT_PUSHED, self.collectionName, accessor != nil ? accessor.username : @"nil", [failedDocs count], failedDocs, numWorked); throw new JSONStoreException(JSONStoreConstants.JSON_STORE_COULD_NOT_MARK_DOCUMENT_PUSHED, failedDocs); } return(numWorked); } }