YapDatabaseCloudCore

@interface YapDatabaseCloudCore : YapDatabaseExtension

- (instancetype)initWithVersionTag:(nullable NSString *)versionTag
                           options:(nullable YapDatabaseCloudCoreOptions *)options;

@property (nonatomic, copy, readonly) NSString *versionTag;

@property (nonatomic, copy, readonly) YapDatabaseCloudCoreOptions *options;

#pragma mark General Configuration

+ (YDBCloudCoreOperationSerializer)defaultOperationSerializer;
+ (YDBCloudCoreOperationDeserializer)defaultOperationDeserializer;

- (BOOL)setOperationSerializer:(YDBCloudCoreOperationSerializer)serializer
                  deserializer:(YDBCloudCoreOperationDeserializer)deserializer;

@property (nonatomic, strong, readonly) YDBCloudCoreOperationSerializer operationSerializer;
@property (nonatomic, strong, readonly) YDBCloudCoreOperationDeserializer operationDeserializer;


#pragma mark Pipelines

/**
 * Returns the default pipeline.
 * That is, the pipeline that operations are automatically added to if the `operation.pipeline` value
 * is nil, or doesn't match any registered pipelines.
 *
 * Note that every YDBCloudCore instance MUST have a defaultPipeline.
 * Without a defaultPipeline, attempts to register the extension (with YapDatabase) will fail.
 * So this value is safely nonnull after the extension is registered.
 */
- (nullable YapDatabaseCloudCorePipeline *)defaultPipeline;

/**
 * Returns the registered pipeline with the given name.
 * If no pipeline is registered under the given name, returns nil.
 */
- (nullable YapDatabaseCloudCorePipeline *)pipelineWithName:(NSString *)name;

/**
 * Attempts to register the given pipeline.
 * 
 * All pipelines MUST be registered BEFORE the extension itself is registered with the database.
 * 
 * The given pipeline may be in a suspended or non-suspended state.
 * Pipelines are fully capable of queueing work until they are resumed, or until network access is restored.
 *
 * During registration, the given pipeline will automatically have its suspendCount incremented in accordance
 * with the suspendCount of this instance. That is, YapDatabaseCloudCore has suspend/resume methods that automatically
 * invoke the corresponding suspend/resume methods of every registered pipeline. Thus if you have invoked
 * [YapDatabaseCloudCore suspend] twice (and thus it currently has a suspendCount of 2), then during registration
 * of the pipeline, the pipeline's suspendCount will be incremented by 2. This means you can separate your
 * management of suspending/resuming the extension with setting up & installing your pipeline(s). And you need not
 * worry about suspendCount mismanagement concerning this particlar situation.
 *
 * @return YES if the registration was successful, NO otherwise.
 */
- (BOOL)registerPipeline:(YapDatabaseCloudCorePipeline *)pipeline;

/**
 * Returns all the registered pipelines.
 */
- (NSArray<YapDatabaseCloudCorePipeline *> *)registeredPipelines;

/**
 * Returns all the registered pipeline names.
 */
- (NSArray<NSString *> *)registeredPipelineNames;


#pragma mark Suspend & Resume

/**
 * Each pipeline has its own suspendCount, and suspend/resume methods.
 * The methods of this class allow you to invoke the suspend/resume method of every registered pipeline.
 */

/**
 * Returns whether or not the suspendCount is non-zero.
 *
 * Remember that each pipeline has its own suspendCount, and suspend/resume methods.
 * So even if the extension isn't suspended as a whole, an individual pipeline may be.
 */
@property (atomic, readonly) BOOL isSuspended;

/**
 * Returns whether or not the suspendCount is non-zero.
 *
 * Remember that each pipeline has its own suspendCount, and suspend/resume methods.
 * So even if the extension isn't suspended as a whole, an individual pipeline may be.
 */
@property (atomic, readonly) NSUInteger suspendCount;

/**
 * Invokes the suspend method of every registerd pipeline, and also increments the local suspendCount.
 */
- (NSUInteger)suspend;
- (NSUInteger)suspendWithCount:(NSUInteger)suspendCountIncrement;

/**
 * Invokes the resume method of every registerd pipeline, and also decrements the local suspendCount.
 */
- (NSUInteger)resume;

@end

Undocumented

  • Returns the default pipeline. That is, the pipeline that operations are automatically added to if the operation.pipeline value is nil, or doesn’t match any registered pipelines.

    Note that every YDBCloudCore instance MUST have a defaultPipeline. Without a defaultPipeline, attempts to register the extension (with YapDatabase) will fail. So this value is safely nonnull after the extension is registered.

    Declaration

    Objective-C

    - (nullable YapDatabaseCloudCorePipeline *)defaultPipeline;

    Swift

    func defaultPipeline() -> YapDatabaseCloudCorePipeline?
  • Returns the registered pipeline with the given name. If no pipeline is registered under the given name, returns nil.

    Declaration

    Objective-C

    - (nullable YapDatabaseCloudCorePipeline *)pipelineWithName:
        (nonnull NSString *)name;

    Swift

    func pipeline(withName name: String) -> YapDatabaseCloudCorePipeline?
  • Attempts to register the given pipeline.

    All pipelines MUST be registered BEFORE the extension itself is registered with the database.

    The given pipeline may be in a suspended or non-suspended state. Pipelines are fully capable of queueing work until they are resumed, or until network access is restored.

    During registration, the given pipeline will automatically have its suspendCount incremented in accordance with the suspendCount of this instance. That is, YapDatabaseCloudCore has suspend/resume methods that automatically invoke the corresponding suspend/resume methods of every registered pipeline. Thus if you have invoked [YapDatabaseCloudCore suspend] twice (and thus it currently has a suspendCount of 2), then during registration of the pipeline, the pipeline’s suspendCount will be incremented by 2. This means you can separate your management of suspending/resuming the extension with setting up & installing your pipeline(s). And you need not worry about suspendCount mismanagement concerning this particlar situation.

    Declaration

    Objective-C

    - (BOOL)registerPipeline:(nonnull YapDatabaseCloudCorePipeline *)pipeline;

    Swift

    func register(_ pipeline: YapDatabaseCloudCorePipeline) -> Bool

    Return Value

    YES if the registration was successful, NO otherwise.

  • Returns all the registered pipelines.

    Declaration

    Objective-C

    - (nonnull NSArray<YapDatabaseCloudCorePipeline *> *)registeredPipelines;

    Swift

    func registeredPipelines() -> [YapDatabaseCloudCorePipeline]
  • Returns all the registered pipeline names.

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)registeredPipelineNames;

    Swift

    func registeredPipelineNames() -> [String]
  • Returns whether or not the suspendCount is non-zero.

    Remember that each pipeline has its own suspendCount, and suspend/resume methods. So even if the extension isn’t suspended as a whole, an individual pipeline may be.

    Declaration

    Objective-C

    @property (readonly, atomic) BOOL isSuspended;

    Swift

    var isSuspended: Bool { get }
  • Returns whether or not the suspendCount is non-zero.

    Remember that each pipeline has its own suspendCount, and suspend/resume methods. So even if the extension isn’t suspended as a whole, an individual pipeline may be.

    Declaration

    Objective-C

    @property (readonly, atomic) NSUInteger suspendCount;

    Swift

    var suspendCount: UInt { get }
  • Invokes the suspend method of every registerd pipeline, and also increments the local suspendCount.

    Declaration

    Objective-C

    - (NSUInteger)suspend;

    Swift

    func suspend() -> UInt
  • Undocumented

    Declaration

    Objective-C

    - (NSUInteger)suspendWithCount:(NSUInteger)suspendCountIncrement;

    Swift

    func suspend(withCount suspendCountIncrement: UInt) -> UInt
  • Invokes the resume method of every registerd pipeline, and also decrements the local suspendCount.

    Declaration

    Objective-C

    - (NSUInteger)resume;

    Swift

    func resume() -> UInt