Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #pragma once |
| 10 | |
Václav Kubernát | 69aabe9 | 2020-01-24 16:53:12 +0100 | [diff] [blame] | 11 | #include <optional> |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 12 | #include <memory> |
| 13 | |
| 14 | namespace sysrepo { |
| 15 | class Callback; |
| 16 | class Connection; |
| 17 | class Session; |
| 18 | class Subscribe; |
| 19 | } |
| 20 | class YangSchema; |
| 21 | |
| 22 | class Recorder { |
| 23 | public: |
| 24 | virtual ~Recorder(); |
Václav Kubernát | 69aabe9 | 2020-01-24 16:53:12 +0100 | [diff] [blame] | 25 | virtual void write(const std::string& xpath, const std::optional<std::string>& oldValue, const std::optional<std::string>& newValue) = 0; |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | class SysrepoSubscription { |
| 29 | public: |
Václav Kubernát | ab612e9 | 2019-11-26 19:51:31 +0100 | [diff] [blame] | 30 | SysrepoSubscription(const std::string& moduleName, Recorder* rec = nullptr); |
Václav Kubernát | 7310938 | 2018-09-14 19:52:03 +0200 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | std::shared_ptr<sysrepo::Connection> m_connection; |
| 34 | std::shared_ptr<sysrepo::Session> m_session; |
| 35 | std::shared_ptr<YangSchema> m_schema; |
| 36 | std::shared_ptr<sysrepo::Callback> m_callback; |
| 37 | std::shared_ptr<sysrepo::Subscribe> m_subscription; |
| 38 | }; |