daemon_state_interface.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // Copyright (C) 2016 The Android Open Source Project
  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. #ifndef UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_
  17. #define UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_
  18. #include "update_engine/service_observer_interface.h"
  19. #include <memory>
  20. #include <set>
  21. namespace chromeos_update_engine {
  22. class DaemonStateInterface {
  23. public:
  24. virtual ~DaemonStateInterface() = default;
  25. // Start the daemon loop. Should be called only once to start the daemon's
  26. // main functionality.
  27. virtual bool StartUpdater() = 0;
  28. // Add and remove an observer. All the registered observers will be called
  29. // whenever there's a new status to update.
  30. virtual void AddObserver(ServiceObserverInterface* observer) = 0;
  31. virtual void RemoveObserver(ServiceObserverInterface* observer) = 0;
  32. // Return the set of current observers.
  33. virtual const std::set<ServiceObserverInterface*>& service_observers() = 0;
  34. protected:
  35. DaemonStateInterface() = default;
  36. };
  37. } // namespace chromeos_update_engine
  38. #endif // UPDATE_ENGINE_DAEMON_STATE_INTERFACE_H_