blob: 0102d1bc8dfcb2aabe1533f2ab3743260ac2c273 [file] [log] [blame]
Václav Kubernát73109382018-09-14 19:52:03 +02001/*
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át69aabe92020-01-24 16:53:12 +010011#include <optional>
Václav Kubernát73109382018-09-14 19:52:03 +020012#include <memory>
13
14namespace sysrepo {
15class Callback;
16class Connection;
17class Session;
18class Subscribe;
19}
20class YangSchema;
21
22class Recorder {
23public:
24 virtual ~Recorder();
Václav Kubernát69aabe92020-01-24 16:53:12 +010025 virtual void write(const std::string& xpath, const std::optional<std::string>& oldValue, const std::optional<std::string>& newValue) = 0;
Václav Kubernát73109382018-09-14 19:52:03 +020026};
27
28class SysrepoSubscription {
29public:
Václav Kubernátab612e92019-11-26 19:51:31 +010030 SysrepoSubscription(const std::string& moduleName, Recorder* rec = nullptr);
Václav Kubernát73109382018-09-14 19:52:03 +020031
32private:
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};