blob: 1ca813df4e1500400c5577ee35fc7a1340099ae5 [file] [log] [blame]
Václav Kubernát80aacc02018-08-22 17:41:54 +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
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
19class Connection;
20class Session;
Václav Kubernáta6c5fff2018-09-07 15:16:25 +020021class Schema;
22class YangSchema;
Václav Kubernát80aacc02018-08-22 17:41:54 +020023
24class SysrepoAccess : public DatastoreAccess {
25public:
26 ~SysrepoAccess() override;
27 SysrepoAccess(const std::string& appname);
28 std::map<std::string, leaf_data_> getItems(const std::string& path) override;
29 void setLeaf(const std::string& path, leaf_data_ value) override;
30 void createPresenceContainer(const std::string& path) override;
31 void deletePresenceContainer(const std::string& path) override;
Václav Kubernáta6c5fff2018-09-07 15:16:25 +020032 std::string fetchSchema(const char* module, const char* revision, const char* submodule);
33 std::vector<std::string> listImplementedSchemas();
Václav Kubernát80aacc02018-08-22 17:41:54 +020034
Václav Kubernát812ee282018-08-30 17:10:03 +020035 void commitChanges() override;
36
Václav Kubernáta6c5fff2018-09-07 15:16:25 +020037 std::shared_ptr<Schema> schema();
38
Václav Kubernát80aacc02018-08-22 17:41:54 +020039private:
40 std::shared_ptr<Connection> m_connection;
41 std::shared_ptr<Session> m_session;
Václav Kubernáta6c5fff2018-09-07 15:16:25 +020042 std::shared_ptr<YangSchema> m_schema;
Václav Kubernát80aacc02018-08-22 17:41:54 +020043};