dmlite
0.6
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
include
dmlite
cpp
poolmanager.h
Go to the documentation of this file.
1
/// @file include/dmlite/cpp/poolmanager.h
2
/// @brief Pool API.
3
/// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
4
#ifndef DMLITE_CPP_POOLMANAGER_H
5
#define DMLITE_CPP_POOLMANAGER_H
6
7
#include "
dmlite/common/config.h
"
8
#include "
base.h
"
9
#include "
exceptions.h
"
10
#include "
pooldriver.h
"
11
#include "
utils/extensible.h
"
12
13
#include <string>
14
#include <vector>
15
16
namespace
dmlite {
17
18
// Forward declarations.
19
class
StackInstance;
20
21
/// Internal interface for handling pool metadata.
22
struct
Pool
:
public
Extensible
{
23
std::string
name
;
24
std::string
type
;
25
26
bool
operator ==
(
const
Pool
&)
const
;
27
bool
operator !=
(
const
Pool
&)
const
;
28
bool
operator <
(
const
Pool
&)
const
;
29
bool
operator >
(
const
Pool
&)
const
;
30
};
31
32
/// Interface for pool types.
33
class
PoolManager
:
public
virtual
BaseInterface
{
34
public
:
35
enum
PoolAvailability
{
kAny
,
kNone
,
kForRead
,
kForWrite
,
kForBoth
};
36
37
/// Destructor.
38
virtual
~PoolManager
();
39
40
/// Get the list of pools.
41
/// @param availability Filter by availability.
42
virtual
std::vector<Pool>
getPools
(
PoolAvailability
availability =
kAny
) throw (
DmException
);
43
44
/// Get a specific pool.
45
virtual
Pool
getPool
(const std::
string
& poolname) throw (DmException);
46
47
/// Create a new pool.
48
virtual
void
newPool
(const
Pool
& pool) throw (DmException);
49
50
/// Update pool metadata.
51
virtual
void
updatePool
(const
Pool
& pool) throw (DmException);
52
53
/// Remove a pool.
54
virtual
void
deletePool
(const
Pool
& pool) throw (DmException);
55
56
/// Get a location for a logical name.
57
/// @param path The path to get.
58
virtual
Location
whereToRead
(const std::
string
& path) throw (DmException);
59
60
/// Get a location for an inode
61
/// @param inode The file inode.
62
virtual
Location
whereToRead
(ino_t inode) throw (DmException);
63
64
/// Start the PUT of a file.
65
/// @param path The path of the file to create.
66
/// @return The physical location where to write.
67
virtual
Location
whereToWrite
(const std::
string
& path) throw (DmException);
68
69
/// Cancel a write.
70
/// @param path The logical file name.
71
/// @param loc As returned by whereToWrite
72
virtual
void
cancelWrite
(const
Location
& loc) throw (DmException);
73
};
74
75
/// Plug-ins must implement a concrete factory to be instantiated.
76
class
PoolManagerFactory
: public virtual
BaseFactory
{
77
public
:
78
/// Virtual destructor
79
virtual
~
PoolManagerFactory
();
80
81
protected
:
82
// Stack instance is allowed to instantiate PoolManager
83
friend
class
StackInstance
;
84
85
/// Children of PoolManagerFactory are allowed to instantiate too (decorator)
86
static
PoolManager
* createPoolManager(
PoolManagerFactory
* factory,
87
PluginManager
* pm)
throw
(DmException);
88
89
/// Instantiate a implementation of Pool
90
virtual
PoolManager
* createPoolManager(
PluginManager
* pm)
throw
(DmException);
91
};
92
93
};
94
95
#endif // DMLITE_CPP_POOLMANAGER_H
Generated on Thu May 8 2014 08:04:54 for dmlite by
1.8.3.1