Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +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 | |
| 11 | #include <string> |
| 12 | #include "ast_commands.hpp" |
| 13 | #include "datastore_access.hpp" |
| 14 | |
| 15 | /*! \class DatastoreAccess |
| 16 | * \brief Abstract class for accessing a datastore |
| 17 | */ |
| 18 | |
Jan Kundrát | 68d4a2c | 2018-10-01 17:17:09 +0200 | [diff] [blame] | 19 | namespace sysrepo { |
Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +0200 | [diff] [blame] | 20 | class Connection; |
| 21 | class Session; |
Jan Kundrát | 68d4a2c | 2018-10-01 17:17:09 +0200 | [diff] [blame] | 22 | } |
| 23 | |
Václav Kubernát | a6c5fff | 2018-09-07 15:16:25 +0200 | [diff] [blame] | 24 | class Schema; |
| 25 | class YangSchema; |
Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +0200 | [diff] [blame] | 26 | |
| 27 | class SysrepoAccess : public DatastoreAccess { |
| 28 | public: |
| 29 | ~SysrepoAccess() override; |
| 30 | SysrepoAccess(const std::string& appname); |
| 31 | std::map<std::string, leaf_data_> getItems(const std::string& path) override; |
| 32 | void setLeaf(const std::string& path, leaf_data_ value) override; |
| 33 | void createPresenceContainer(const std::string& path) override; |
| 34 | void deletePresenceContainer(const std::string& path) override; |
Václav Kubernát | a6c5fff | 2018-09-07 15:16:25 +0200 | [diff] [blame] | 35 | std::string fetchSchema(const char* module, const char* revision, const char* submodule); |
| 36 | std::vector<std::string> listImplementedSchemas(); |
Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +0200 | [diff] [blame] | 37 | |
Václav Kubernát | 812ee28 | 2018-08-30 17:10:03 +0200 | [diff] [blame] | 38 | void commitChanges() override; |
Václav Kubernát | 6d79143 | 2018-10-25 16:00:35 +0200 | [diff] [blame^] | 39 | void discardChanges() override; |
Václav Kubernát | 812ee28 | 2018-08-30 17:10:03 +0200 | [diff] [blame] | 40 | |
Václav Kubernát | a6c5fff | 2018-09-07 15:16:25 +0200 | [diff] [blame] | 41 | std::shared_ptr<Schema> schema(); |
| 42 | |
Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +0200 | [diff] [blame] | 43 | private: |
Jan Kundrát | 68d4a2c | 2018-10-01 17:17:09 +0200 | [diff] [blame] | 44 | std::shared_ptr<sysrepo::Connection> m_connection; |
| 45 | std::shared_ptr<sysrepo::Session> m_session; |
Václav Kubernát | a6c5fff | 2018-09-07 15:16:25 +0200 | [diff] [blame] | 46 | std::shared_ptr<YangSchema> m_schema; |
Václav Kubernát | 80aacc0 | 2018-08-22 17:41:54 +0200 | [diff] [blame] | 47 | }; |