libstorage-ng
Nfs.h
1 /*
2  * Copyright (c) [2017-2020] SUSE LLC
3  *
4  * All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of version 2 of the GNU General Public License as published
8  * by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, contact Novell, Inc.
17  *
18  * To contact Novell about this file by physical or electronic mail, you may
19  * find current contact information at www.novell.com.
20  */
21 
22 
23 #ifndef STORAGE_NFS_H
24 #define STORAGE_NFS_H
25 
26 
27 #include "storage/Filesystems/Filesystem.h"
28 #include "storage/Devicegraph.h"
29 
30 
31 namespace storage
32 {
33 
35  {
36  public:
37 
38  NfsNotFoundByServerAndPath(const std::string& server, const std::string& path);
39  };
40 
41 
55  class Nfs : public Filesystem
56  {
57  public:
58 
64  static Nfs* create(Devicegraph* devicegraph, const std::string& server, const std::string& path);
65 
66  static Nfs* load(Devicegraph* devicegraph, const xmlNode* node);
67 
71  const std::string& get_server() const;
72 
76  const std::string& get_path() const;
77 
81  static std::vector<Nfs*> get_all(Devicegraph* devicegraph);
82 
86  static std::vector<const Nfs*> get_all(const Devicegraph* devicegraph);
87 
94  static Nfs* find_by_server_and_path(Devicegraph* devicegraph, const std::string& server,
95  const std::string& path);
96 
100  static const Nfs* find_by_server_and_path(const Devicegraph* devicegraph,
101  const std::string& server, const std::string& path);
102 
103  public:
104 
105  class Impl;
106 
107  Impl& get_impl();
108  const Impl& get_impl() const;
109 
110  virtual Nfs* clone() const override;
111 
112  protected:
113 
114  Nfs(Impl* impl);
115 
116  };
117 
118 
124  bool is_nfs(const Device* device);
125 
132  Nfs* to_nfs(Device* device);
133 
137  const Nfs* to_nfs(const Device* device);
138 
139 }
140 
141 #endif
const std::string & get_path() const
Get the path of the Nfs.
static Nfs * find_by_server_and_path(Devicegraph *devicegraph, const std::string &server, const std::string &path)
Find a Nfs by its server and path.
Nfs * to_nfs(Device *device)
Converts pointer to Device to pointer to Nfs.
The main container of the libstorage-ng.
Definition: Devicegraph.h:169
static std::vector< Nfs * > get_all(Devicegraph *devicegraph)
Get all Nfses.
static Nfs * create(Devicegraph *devicegraph, const std::string &server, const std::string &path)
Create a device of type Nfs.
An abstract base class for storage devices.
Definition: Device.h:81
Class to represent a NFS mount.
Definition: Nfs.h:55
Definition: Devicegraph.h:49
const std::string & get_server() const
Get the server of the Nfs.
Definition: Filesystem.h:40
The storage namespace.
Definition: Actiongraph.h:39
bool is_nfs(const Device *device)
Checks whether device points to a Nfs.