FSTEventManager.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. namespace core = firebase::firestore::core;
  25. namespace model = firebase::firestore::model;
  26. NS_ASSUME_NONNULL_BEGIN
  27. #pragma mark - FSTEventManager
  28. /**
  29. * EventManager is responsible for mapping queries to query event emitters. It handles "fan-out."
  30. * (Identical queries will re-use the same watch on the backend.)
  31. */
  32. @interface FSTEventManager : NSObject
  33. + (instancetype)eventManagerWithSyncEngine:(FSTSyncEngine *)syncEngine;
  34. - (instancetype)init NS_UNAVAILABLE;
  35. - (model::TargetId)addListener:(std::shared_ptr<core::QueryListener>)listener;
  36. - (void)removeListener:(const std::shared_ptr<core::QueryListener> &)listener;
  37. - (void)applyChangedOnlineState:(model::OnlineState)onlineState;
  38. @end
  39. NS_ASSUME_NONNULL_END