mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-10 22:45:59 +05:45
This simplifies the import process back into google3 and allows us to add additional directories to the project without needing to update the project files for each directory we add. This shows up most clearly in the change to Firestore/Example/Firestore.xcodeproj/project.pbxproj: this no longer needs to list essentially every directory in the project as a header search path. * Clang-format configuration for C++ files * Add support C++-only sources to the podspec * Podspec support for fully qualified imports * xcodeproj changes for fully-qualified imports * Use fully-qualified imports in Firestore sources
96 lines
3.4 KiB
Objective-C
96 lines
3.4 KiB
Objective-C
/*
|
|
* 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 "Firestore/Source/Core/FSTTypes.h"
|
|
|
|
@class FSTDocumentKey;
|
|
@class FSTDocumentReference;
|
|
@protocol FSTGarbageCollector;
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/**
|
|
* A pseudo-collection that maintains references to documents. FSTGarbageSource collections
|
|
* notify the FSTGarbageCollector when references to documents change through the
|
|
* -addPotentialGarbageKey: message.
|
|
*/
|
|
@protocol FSTGarbageSource
|
|
|
|
/**
|
|
* The garbage collector to which this collection should send -addPotentialGarbageKey: messages.
|
|
*/
|
|
@property(nonatomic, weak, readwrite, nullable) id<FSTGarbageCollector> garbageCollector;
|
|
|
|
/**
|
|
* Checks to see if there are any references to a document with the given key. This can be used by
|
|
* garbage collectors to double-check if a key exists in this collection when it was released
|
|
* elsewhere.
|
|
*/
|
|
- (BOOL)containsKey:(FSTDocumentKey *)key;
|
|
|
|
@end
|
|
|
|
/**
|
|
* Tracks different kinds of references to a document, for all the different ways the client
|
|
* needs to retain a document.
|
|
*
|
|
* Usually the local store this means tracking of three different types of references to a
|
|
* document:
|
|
* 1. RemoteTarget reference identified by a target ID.
|
|
* 2. LocalView reference identified also by a target ID.
|
|
* 3. Local mutation reference identified by a batch ID.
|
|
*
|
|
* The idea is that we want to keep a document around at least as long as any remote target or
|
|
* local (latency compensated) view is referencing it, or there's an outstanding local mutation to
|
|
* that document.
|
|
*/
|
|
@protocol FSTGarbageCollector
|
|
|
|
/**
|
|
* A property that describes whether or not the collector wants to eagerly collect keys.
|
|
*
|
|
* TODO(b/33384523) Delegate deleting released queries to the GC.
|
|
* This flag is a temporary workaround for dealing with a persistent query cache. The collector
|
|
* really should have an API for releasing queries that does the right thing for its policy.
|
|
*/
|
|
@property(nonatomic, assign, readonly, getter=isEager) BOOL eager;
|
|
|
|
/** Adds a garbage source to the collector. */
|
|
- (void)addGarbageSource:(id<FSTGarbageSource>)garbageSource;
|
|
|
|
/** Removes a garbage source from the collector. */
|
|
- (void)removeGarbageSource:(id<FSTGarbageSource>)garbageSource;
|
|
|
|
/**
|
|
* Notifies the garbage collector that a document with the given key may have become garbage.
|
|
*
|
|
* This is useful in both when a document has definitely been released (for example when removed
|
|
* from a garbage source) but also when a document has been updated. Documents should be marked in
|
|
* this way because the client accepts updates for documents even after the document no longer
|
|
* matches any active targets. This behavior allows the client to avoid re-showing an old document
|
|
* in the next latency-compensated view.
|
|
*/
|
|
- (void)addPotentialGarbageKey:(FSTDocumentKey *)key;
|
|
|
|
/** Returns the contents of the garbage bin and clears it. */
|
|
- (NSSet<FSTDocumentKey *> *)collectGarbage;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|