libstorage-ng
BcacheCset.h
1 /*
2  * Copyright (c) 2016 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_BCACHE_CSET_H
24 #define STORAGE_BCACHE_CSET_H
25 
26 
27 #include "storage/Devices/Device.h"
28 
29 
30 namespace storage
31 {
32 
33  class BlkDevice;
34  class Bcache;
35 
36 
41  class BcacheCset : public Device
42  {
43  public:
44 
45  static BcacheCset* create(Devicegraph* devicegraph);
46  static BcacheCset* load(Devicegraph* devicegraph, const xmlNode* node);
47 
48  const std::string& get_uuid() const;
49  void set_uuid(const std::string& uuid);
50 
54  std::vector<const BlkDevice*> get_blk_devices() const;
55 
59  std::vector<const Bcache*> get_bcaches() const;
60 
64  static std::vector<BcacheCset*> get_all(Devicegraph* devicegraph);
65 
69  static std::vector<const BcacheCset*> get_all(const Devicegraph* devicegraph);
70 
71  public:
72 
73  class Impl;
74 
75  Impl& get_impl();
76  const Impl& get_impl() const;
77 
78  virtual BcacheCset* clone() const override;
79 
80  protected:
81 
82  BcacheCset(Impl* impl);
83 
84  };
85 
86 
87  bool is_bcache_cset(const Device* device);
88 
89  BcacheCset* to_bcache_cset(Device* device);
90  const BcacheCset* to_bcache_cset(const Device* device);
91 
92 }
93 
94 #endif
std::vector< const BlkDevice * > get_blk_devices() const
Returns the BlkDevices used by this BcacheCset.
The master container of the libstorage.
Definition: Devicegraph.h:133
std::vector< const Bcache * > get_bcaches() const
Returns the Bcaches using this BcacheCset.
static std::vector< BcacheCset * > get_all(Devicegraph *devicegraph)
Sorted by uuid.
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:73
A bcache cache set.
Definition: BcacheCset.h:41
The storage namespace.
Definition: Actiongraph.h:36