dmlite
0.4
Main Page
Namespaces
Classes
Files
File List
File Members
include
dmlite
c
pool.h
Go to the documentation of this file.
1
/** @file include/dmlite/c/pool.h
2
* @brief C wrapper for DMLite Pool API.
3
* @author Alejandro Álvarez Ayllon <aalvarez@cern.ch>
4
*/
5
#ifndef DMLITE_POOL_H
6
#define DMLITE_POOL_H
7
8
#include "
any.h
"
9
#include "
inode.h
"
10
#include "
dmlite.h
"
11
#include "
utils.h
"
12
13
#define POOL_TYPE_MAX 16
14
#define POOL_MAX 16
15
16
#ifdef __cplusplus
17
extern
"C"
{
18
#endif
19
20
/** @brief Pool data */
21
typedef
struct
dmlite_pool
{
22
char
pool_type
[
POOL_TYPE_MAX
];
23
char
pool_name
[
POOL_MAX
];
24
25
dmlite_any_dict
*
extra
;
26
}
dmlite_pool
;
27
28
/** @brief Chunk of data */
29
typedef
struct
dmlite_chunk
{
30
char
host
[
HOST_NAME_MAX
];
31
char
path
[PATH_MAX];
32
33
off_t
offset
;
34
size_t
size
;
35
36
dmlite_any_dict
*
extra
;
37
}
dmlite_chunk
;
38
39
/** @brief Collection of chunks that form a replica
40
* @details There may be duplicated chunks.
41
*/
42
typedef
struct
dmlite_location
{
43
dmlite_chunk
*
chunks
;
44
unsigned
nchunks
;
45
}
dmlite_location
;
46
47
/**
48
* @brief Gets the list of pools.
49
* @param context The DM context.
50
* @param nPools The number of pools.
51
* @param pools An array with the pools. <b>Use dmlite_freepools to free</b>.
52
* @return 0 on succes, -1 on failure.
53
*/
54
int
dmlite_getpools
(
dmlite_context
* context,
unsigned
* nPools,
dmlite_pool
** pools);
55
56
/**
57
* @brief Frees an array of pools.
58
* @param context The DM context.
59
* @param nPools The number of pools in the array.
60
* @param pools The array to free.
61
* @return 0 on succes, -1 on failure.
62
*/
63
int
dmlite_pools_free
(
dmlite_context
* context,
unsigned
nPools,
dmlite_pool
* pools);
64
65
/**
66
* @brief Gets a single replica (synchronous).
67
* @param context The DM context.
68
* @param path The logical file name.
69
* @return A pointer to a dmlite_location struct, or NULL on error.
70
*/
71
dmlite_location
*
dmlite_get
(
dmlite_context
* context,
const
char
* path);
72
73
/**
74
* @brief Gets a single replica (synchronous).
75
* @param context The DM context.
76
* @param inode The file inode.
77
* @return A pointer to a dmlite_location struct, or NULL on error.
78
*/
79
dmlite_location
*
dmlite_iget
(
dmlite_context
* context, ino_t inode);
80
81
/**
82
* @brief Gets the location of a replica.
83
* @param context The DM context.
84
* @param replica The replica to translate.
85
* @return A pointer to a dmlite_location struct, or NULL on error.
86
*/
87
dmlite_location
*
dmlite_getlocation
(
dmlite_context
* context,
const
dmlite_replica
* replica);
88
89
/**
90
* @brief Puts a file (synchronous).
91
* @param context The DM context.
92
* @param path The logical file name to put.
93
* @return A pointer to a dmlite_location struct, or NULL on error.
94
*/
95
dmlite_location
*
dmlite_put
(
dmlite_context
* context,
const
char
* path);
96
97
/**
98
* @brief Frees a location struct.
99
* @param context The DM context.
100
* @param loc The struct to free.
101
* @return 0 on success, error code otherwise.
102
*/
103
int
dmlite_location_free
(
dmlite_context
* context,
dmlite_location
* loc);
104
105
#ifdef __cplusplus
106
}
107
#endif
108
109
#endif
/* DMLITE_POOL_H */
Generated on Fri Jan 11 2013 10:31:57 for dmlite by
1.8.1.1