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 
74  static bool compare_by_uuid(const BcacheCset* lhs, const BcacheCset* rhs);
75 
76  public:
77 
78  class Impl;
79 
80  Impl& get_impl();
81  const Impl& get_impl() const;
82 
83  virtual BcacheCset* clone() const override;
84 
85  protected:
86 
87  BcacheCset(Impl* impl);
88 
89  };
90 
91 
92  bool is_bcache_cset(const Device* device);
93 
100  BcacheCset* to_bcache_cset(Device* device);
101 
105  const BcacheCset* to_bcache_cset(const Device* device);
106 
107 }
108 
109 #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:153
BcacheCset * to_bcache_cset(Device *device)
Converts pointer to Device to pointer to BcacheCset.
std::vector< const Bcache * > get_bcaches() const
Returns the Bcaches using this BcacheCset.
static std::vector< BcacheCset * > get_all(Devicegraph *devicegraph)
Get all BcacheCsets.
An abstract base class of storage devices, and a vertex in the Devicegraph.
Definition: Device.h:75
A bcache cache set.
Definition: BcacheCset.h:41
static bool compare_by_uuid(const BcacheCset *lhs, const BcacheCset *rhs)
Compare (less than) two BcacheCsets by UUID.
The storage namespace.
Definition: Actiongraph.h:37