dmlite
0.6
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 "
dmlite.h
"
9
#include "
any.h
"
10
#include "
inode.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
off_t
offset
;
31
size_t
size
;
32
dmlite_url
url
;
33
}
dmlite_chunk
;
34
35
/** @brief Collection of chunks that form a replica
36
* @details On read, there may be duplicated chunks.
37
*/
38
typedef
struct
dmlite_location
{
39
dmlite_chunk
*
chunks
;
40
unsigned
nchunks
;
41
}
dmlite_location
;
42
43
/**
44
* @brief Gets the list of pools.
45
* @param context The DM context.
46
* @param nPools The number of pools.
47
* @param pools An array with the pools. <b>Use dmlite_freepools to free</b>.
48
* @return 0 on success, error code otherwise.
49
*/
50
int
dmlite_getpools
(
dmlite_context
* context,
unsigned
* nPools,
dmlite_pool
** pools);
51
52
/**
53
* @brief Frees an array of pools.
54
* @param nPools The number of pools in the array.
55
* @param pools The array to free.
56
* @return 0 on success, error code otherwise.
57
*/
58
int
dmlite_pools_free
(
unsigned
nPools,
dmlite_pool
* pools);
59
60
/**
61
* @brief Gets a single replica (synchronous).
62
* @param context The DM context.
63
* @param path The logical file name.
64
* @return A pointer to a dmlite_location struct, or NULL on error.
65
*/
66
dmlite_location
*
dmlite_get
(
dmlite_context
* context,
const
char
* path);
67
68
/**
69
* @brief Gets a single replica (synchronous).
70
* @param context The DM context.
71
* @param inode The file inode.
72
* @return A pointer to a dmlite_location struct, or NULL on error.
73
*/
74
dmlite_location
*
dmlite_iget
(
dmlite_context
* context, ino_t inode);
75
76
/**
77
* @brief Gets the location of a replica.
78
* @param context The DM context.
79
* @param replica The replica to translate.
80
* @return A pointer to a dmlite_location struct, or NULL on error.
81
*/
82
dmlite_location
*
dmlite_getlocation
(
dmlite_context
* context,
const
dmlite_replica
* replica);
83
84
/**
85
* @brief Puts a file (synchronous).
86
* @param context The DM context.
87
* @param path The logical file name to put.
88
* @return A pointer to a dmlite_location struct, or NULL on error.
89
*/
90
dmlite_location
*
dmlite_put
(
dmlite_context
* context,
const
char
* path);
91
92
/**
93
* @brief Aborts a put request.
94
* @param context The DM context.
95
* @param loc As returned by dmlite_put.
96
* @return 0 on success, error code otherwise.
97
*/
98
int
dmlite_put_abort
(
dmlite_context
* context,
const
dmlite_location
* loc);
99
100
/**
101
* @brief Frees a location struct.
102
* @param loc The struct to free.
103
* @return 0 on success, error code otherwise.
104
*/
105
int
dmlite_location_free
(
dmlite_location
* loc);
106
107
#ifdef __cplusplus
108
}
109
#endif
110
111
#endif
/* DMLITE_POOL_H */
Generated on Thu Feb 28 2013 22:06:36 for dmlite by
1.8.3.1