aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTDocumentReference.h
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2017-10-03 08:55:22 -0700
committerGravatar GitHub <noreply@github.com>2017-10-03 08:55:22 -0700
commitbde743ed25166a0b320ae157bfb1d68064f531c9 (patch)
tree4dd7525d9df32fa5dbdb721d4b0d4f9b87f5e884 /Firestore/Source/Local/FSTDocumentReference.h
parentbf550507ffa8beee149383a5bf1e2363bccefbb4 (diff)
Release 4.3.0 (#327)
Initial release of Firestore at 0.8.0 Bump FirebaseCommunity to 0.1.3
Diffstat (limited to 'Firestore/Source/Local/FSTDocumentReference.h')
-rw-r--r--Firestore/Source/Local/FSTDocumentReference.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/Firestore/Source/Local/FSTDocumentReference.h b/Firestore/Source/Local/FSTDocumentReference.h
new file mode 100644
index 0000000..eff60e4
--- /dev/null
+++ b/Firestore/Source/Local/FSTDocumentReference.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2017 Google
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+@class FSTDocumentKey;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * An immutable value used to keep track of an association between some referencing target or batch
+ * and a document key that the target or batch references.
+ *
+ * A reference can be from either listen targets (identified by their FSTTargetID) or mutation
+ * batches (identified by their FSTBatchID). See FSTGarbageCollector for more details.
+ *
+ * Not to be confused with FIRDocumentReference.
+ */
+@interface FSTDocumentReference : NSObject <NSCopying>
+
+/** Initializes the document reference with the given key and ID. */
+- (instancetype)initWithKey:(FSTDocumentKey *)key ID:(int)ID NS_DESIGNATED_INITIALIZER;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+/** The document key that's the target of this reference. */
+@property(nonatomic, strong, readonly) FSTDocumentKey *key;
+
+/**
+ * The targetID of a referring target or the batchID of a referring mutation batch. (Which this
+ * is depends upon which FSTReferenceSet this reference is a part of.)
+ */
+@property(nonatomic, assign, readonly) int ID;
+
+@end
+
+#pragma mark Comparators
+
+/** Sorts document references by key then ID. */
+extern const NSComparator FSTDocumentReferenceComparatorByKey;
+
+/** Sorts document references by ID then key. */
+extern const NSComparator FSTDocumentReferenceComparatorByID;
+
+/** A callback for use when enumerating an FSTImmutableSortedSet of FSTDocumentReferences. */
+typedef void (^FSTDocumentReferenceBlock)(FSTDocumentReference *reference, BOOL *stop);
+
+NS_ASSUME_NONNULL_END