libstorage-ng
Loading...
Searching...
No Matches
BcacheCset.h
1/*
2 * Copyright (c) [2016-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_BCACHE_CSET_H
24#define STORAGE_BCACHE_CSET_H
25
26
27#include "storage/Devices/Device.h"
28
29
30namespace storage
31{
32
33 class BlkDevice;
34 class Bcache;
35
36
41 class BcacheCset : public Device
42 {
43 public:
44
49 static BcacheCset* create(Devicegraph* devicegraph);
50
51 static BcacheCset* load(Devicegraph* devicegraph, const xmlNode* node);
52
56 const std::string& get_uuid() const;
57
63 void set_uuid(const std::string& uuid);
64
68 std::vector<const BlkDevice*> get_blk_devices() const;
69
73 std::vector<const Bcache*> get_bcaches() const;
74
78 static std::vector<BcacheCset*> get_all(Devicegraph* devicegraph);
79
83 static std::vector<const BcacheCset*> get_all(const Devicegraph* devicegraph);
84
90 static BcacheCset* find_by_uuid(Devicegraph* devicegraph, const std::string& uuid);
91
95 static const BcacheCset* find_by_uuid(const Devicegraph* devicegraph, const std::string& uuid);
96
102 static bool compare_by_uuid(const BcacheCset* lhs, const BcacheCset* rhs);
103
104 public:
105
106 class Impl;
107
108 Impl& get_impl();
109 const Impl& get_impl() const;
110
111 virtual BcacheCset* clone() const override;
112
113 protected:
114
115 BcacheCset(Impl* impl);
116
117 };
118
119
125 bool is_bcache_cset(const Device* device);
126
134
138 const BcacheCset* to_bcache_cset(const Device* device);
139
140}
141
142#endif
A bcache cache set.
Definition: BcacheCset.h:42
void set_uuid(const std::string &uuid)
Set the UUID of the BcacheCset.
static bool compare_by_uuid(const BcacheCset *lhs, const BcacheCset *rhs)
Compare (less than) two BcacheCsets by UUID.
const std::string & get_uuid() const
Return the UUID of the BcacheCset.
static std::vector< const BcacheCset * > get_all(const Devicegraph *devicegraph)
Get all BcacheCsets.
static BcacheCset * find_by_uuid(Devicegraph *devicegraph, const std::string &uuid)
Find a BcacheCset by its UUID.
std::vector< const Bcache * > get_bcaches() const
Returns the Bcaches using this BcacheCset.
std::vector< const BlkDevice * > get_blk_devices() const
Returns the BlkDevices used by this BcacheCset.
static std::vector< BcacheCset * > get_all(Devicegraph *devicegraph)
Get all BcacheCsets.
static BcacheCset * create(Devicegraph *devicegraph)
Create a device of type BcacheCset.
static const BcacheCset * find_by_uuid(const Devicegraph *devicegraph, const std::string &uuid)
Find a BcacheCset by its UUID.
An abstract base class for storage devices.
Definition: Device.h:82
The main container of the libstorage-ng.
Definition: Devicegraph.h:170
The storage namespace.
Definition: Actiongraph.h:40
BcacheCset * to_bcache_cset(Device *device)
Converts pointer to Device to pointer to BcacheCset.
bool is_bcache_cset(const Device *device)
Checks whether device points to a BcacheCset.