aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTLocalDocumentsView.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/FSTLocalDocumentsView.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/FSTLocalDocumentsView.h')
-rw-r--r--Firestore/Source/Local/FSTLocalDocumentsView.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/Firestore/Source/Local/FSTLocalDocumentsView.h b/Firestore/Source/Local/FSTLocalDocumentsView.h
new file mode 100644
index 0000000..60571c2
--- /dev/null
+++ b/Firestore/Source/Local/FSTLocalDocumentsView.h
@@ -0,0 +1,62 @@
+/*
+ * 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>
+
+#import "FSTDocumentDictionary.h"
+#import "FSTDocumentKeySet.h"
+
+@class FSTDocumentKey;
+@class FSTMaybeDocument;
+@class FSTQuery;
+@protocol FSTMutationQueue;
+@protocol FSTRemoteDocumentCache;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * A readonly view of the local state of all documents we're tracking (i.e. we have a cached
+ * version in remoteDocumentCache or local mutations for the document). The view is computed by
+ * applying the mutations in the FSTMutationQueue to the FSTRemoteDocumentCache.
+ */
+@interface FSTLocalDocumentsView : NSObject
+
++ (instancetype)viewWithRemoteDocumentCache:(id<FSTRemoteDocumentCache>)remoteDocumentCache
+ mutationQueue:(id<FSTMutationQueue>)mutationQueue;
+
+- (instancetype)init __attribute__((unavailable("Use a static constructor")));
+
+/**
+ * Get the local view of the document identified by `key`.
+ *
+ * @return Local view of the document or nil if we don't have any cached state for it.
+ */
+- (nullable FSTMaybeDocument *)documentForKey:(FSTDocumentKey *)key;
+
+/**
+ * Gets the local view of the documents identified by `keys`.
+ *
+ * If we don't have cached state for a document in `keys`, a FSTDeletedDocument will be stored
+ * for that key in the resulting set.
+ */
+- (FSTMaybeDocumentDictionary *)documentsForKeys:(FSTDocumentKeySet *)keys;
+
+/** Performs a query against the local view of all documents. */
+- (FSTDocumentDictionary *)documentsMatchingQuery:(FSTQuery *)query;
+
+@end
+
+NS_ASSUME_NONNULL_END