FSTEventManager.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #include <memory>
  18. #include "Firestore/core/src/firebase/firestore/core/query_listener.h"
  19. #include "Firestore/core/src/firebase/firestore/core/view_snapshot.h"
  20. #include "Firestore/core/src/firebase/firestore/model/types.h"
  21. #include "Firestore/core/src/firebase/firestore/util/status.h"
  22. @class FSTQuery;
  23. @class FSTSyncEngine;
  24. NS_ASSUME_NONNULL_BEGIN
  25. using firebase::firestore::core::QueryListener;
  26. #pragma mark - FSTEventManager
  27. /**
  28. * EventManager is responsible for mapping queries to query event emitters. It handles "fan-out."
  29. * (Identical queries will re-use the same watch on the backend.)
  30. */
  31. @interface FSTEventManager : NSObject
  32. + (instancetype)eventManagerWithSyncEngine:(FSTSyncEngine *)syncEngine;
  33. - (instancetype)init __attribute__((unavailable("Use static constructor method.")));
  34. - (firebase::firestore::model::TargetId)addListener:(std::shared_ptr<QueryListener>)listener;
  35. - (void)removeListener:(const std::shared_ptr<QueryListener> &)listener;
  36. - (void)applyChangedOnlineState:(firebase::firestore::model::OnlineState)onlineState;
  37. @end
  38. NS_ASSUME_NONNULL_END