Skip to content

Commit

Permalink
YDBCloudCore internal API change - dropping `processOperations:inPipe…
Browse files Browse the repository at this point in the history
…line:withGraphIdx:` in favor of more fine-grained control over modifying operations when they're added/inserted/modified.
  • Loading branch information
robbiehanson committed Jul 3, 2019
1 parent 30aeef9 commit 3b0088b
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 322 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,32 @@ typedef NS_OPTIONS(uint8_t, YDBCloudCore_EnumOps) {
* Subclass hooks
**/

// Allows subclasses to perform post-processing on operations before they are written to disk.
// Examples of tasks a subclass may want to perform:
//
// - sanitization of various property values
// - automatically merging duplicate operations within same commit
// - automatically adding dependencies for operations in earlier commits (if using FlatGraph optimization)
//
- (NSArray<YapDatabaseCloudCoreOperation *> *)processOperations:(NSArray<YapDatabaseCloudCoreOperation *> *)operations
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)operationsGraphIdx;

// Subclasses may override these methods to perform custom tasks as needed.
- (void)validateOperation:(YapDatabaseCloudCoreOperation *)operation;

- (void)willAddOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)didAddOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)willInsertOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)didInsertOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)willModifyOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)didModifyOperation:(YapDatabaseCloudCoreOperation *)operation
inPipeline:(YapDatabaseCloudCorePipeline *)pipeline
withGraphIdx:(NSUInteger)opGraphIdx;

- (void)didCompleteOperation:(YapDatabaseCloudCoreOperation *)operation;
- (void)didSkipOperation:(YapDatabaseCloudCoreOperation *)operation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ typedef NS_ENUM(NSInteger, YDBCloudCorePipelineAlgorithm) {
* - your formal dependency graph must determine if opB should depend on opA
*
* The recommended way of implementing your formal dependency graph is by
* subclassing YapDatabaseCloudCoreTransaction & overriding the method
* `processOperations:inPipeline:withGraphIdx:`.
* subclassing YapDatabaseCloudCoreTransaction & overriding the various subclass hooks, such as:
* - willAddOperation:inPipeline:withGraphIdx:
* - willInsertOperation:inPipeline:withGraphIdx:
* - willModifyOperation:inPipeline:withGraphIdx:
**/
YDBCloudCorePipelineAlgorithm_FlatGraph = 1
};
Expand Down

0 comments on commit 3b0088b

Please sign in to comment.