ZDCCloudLocator

@interface ZDCCloudLocator : NSObject <NSCoding, NSCopying>

Encapsulates all the information required to locate a file in the cloud:

  • AWS region (e.g. us-west-2)
  • AWS S3 bucket name
  • AWS s3 keypath (in standardized/parsed form)

Instances of this class are immutable.

  • Creates an (immutable) locator instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithRegion:(AWSRegion)region
                                    bucket:(nonnull NSString *)bucket
                                 cloudPath:(nonnull ZDCCloudPath *)cloudPath;

    Swift

    init(region: AWSRegion, bucket: String, cloudPath: ZDCCloudPath)

    Parameters

    region

    The AWS region where the bucket is located.

    bucket

    The name of the AWS S3 bucket.

    cloudPath

    The keypath to the file within the S3 bucket.

  • The AWS region where the S3 bucket is located.

    Declaration

    Objective-C

    @property (readonly, assign, nonatomic) AWSRegion region;

    Swift

    var region: AWSRegion { get }
  • The name of the AWS S3 bucket.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) NSString *_Nonnull bucket;

    Swift

    var bucket: String { get }
  • Extracts the userID component from the bucket name.

    Declaration

    Objective-C

    @property (readonly, nonatomic, nullable) NSString *bucketOwner;

    Swift

    var bucketOwner: String? { get }
  • Represents the keypath to the file within the S3 bucket.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic) ZDCCloudPath *_Nonnull cloudPath;

    Swift

    @NSCopying var cloudPath: ZDCCloudPath { get }
  • Returns a copy with a new cloudPath. I.e. same region, same bucket, new S3 keypath.

    Declaration

    Objective-C

    - (nonnull instancetype)copyWithCloudPath:(nonnull ZDCCloudPath *)newCloudPath;

    Swift

    func copy(with newCloudPath: ZDCCloudPath) -> Self
  • Returns a copy with an alternative filename extension. Pass nil to strip the filename extension.

    Declaration

    Objective-C

    - (nonnull instancetype)copyWithFileNameExt:(nullable NSString *)newFileNameExt;

    Swift

    func copy(withFileNameExt newFileNameExt: String?) -> Self
  • Returns YES if the two cloudLocator’s are an exact match.

    Declaration

    Objective-C

    - (BOOL)isEqualToCloudLocator:(nonnull ZDCCloudLocator *)another;

    Swift

    func isEqual(to another: ZDCCloudLocator) -> Bool
  • Returns YES if the two cloudLocator’s refer to the same node. That is, everything matches except the filename extension.

    Declaration

    Objective-C

    - (BOOL)isEqualToCloudLocatorIgnoringExt:(nonnull ZDCCloudLocator *)another;

    Swift

    func isEqual(toCloudLocatorIgnoringExt another: ZDCCloudLocator) -> Bool
  • Performs a detailed comparison between two cloudLocator’s. For example, you could check to see if they belong to the same treeID, or the same dirPrefix (same folder).

    Declaration

    Objective-C

    - (BOOL)isEqualToCloudLocator:(nonnull ZDCCloudLocator *)another
                       components:(ZDCCloudPathComponents)components;

    Swift

    func isEqual(to another: ZDCCloudLocator, components: ZDCCloudPathComponents) -> Bool