dmlite  0.6
Classes | Macros | Typedefs | Functions
pool.h File Reference

C wrapper for DMLite Pool API. More...

#include "dmlite.h"
#include "any.h"
#include "inode.h"
#include "utils.h"
Include dependency graph for pool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  dmlite_pool
 Pool data. More...
 
struct  dmlite_chunk
 Chunk of data. More...
 
struct  dmlite_location
 Collection of chunks that form a replica. More...
 
struct  dmlite_xferinfo
 Progress markers for file copies. FTS jargon calls these "FTS performance markers". More...
 

Macros

#define POOL_TYPE_MAX   16
 
#define POOL_MAX   16
 
#define CHUNK_ID_MAX   16
 
#define CHUNK_URL_ALT_MAX   512
 

Typedefs

typedef struct dmlite_pool dmlite_pool
 Pool data. More...
 
typedef struct dmlite_chunk dmlite_chunk
 Chunk of data. More...
 
typedef struct dmlite_location dmlite_location
 Collection of chunks that form a replica. More...
 
typedef struct dmlite_xferinfo dmlite_xferinfo
 Progress markers for file copies. FTS jargon calls these "FTS performance markers". More...
 

Functions

int dmlite_getpools (dmlite_context *context, unsigned *nPools, dmlite_pool **pools)
 Gets the list of pools. More...
 
int dmlite_pools_free (unsigned nPools, dmlite_pool *pools)
 Frees an array of pools. More...
 
dmlite_locationdmlite_get (dmlite_context *context, const char *path)
 Gets a single replica (synchronous). More...
 
int dmlite_copypush (dmlite_context *context, const char *path, const char *dest, int cksumcheck, char *cksumtype, dmlite_xferinfo *progressdata)
 Copy a file to a remote location (synchronous). More...
 
int dmlite_copypull (dmlite_context *context, const char *path, const char *source, int cksumcheck, char *cksumtype, dmlite_xferinfo *progressdata)
 Copy a file from a remote location (synchronous). Allows copying to this head node, may add a replica to an existing logical file entry. More...
 
dmlite_locationdmlite_iget (dmlite_context *context, ino_t inode)
 Gets a single replica (synchronous). More...
 
dmlite_locationdmlite_getlocation (dmlite_context *context, const dmlite_replica *replica)
 Gets the location of a replica. More...
 
dmlite_locationdmlite_put (dmlite_context *context, const char *path)
 Puts a file (synchronous). More...
 
dmlite_locationdmlite_chooseserver (dmlite_context *context, const char *path)
 Choose a server where to perform generic actions (e.g. a tunnel) More...
 
int dmlite_put_abort (dmlite_context *context, const dmlite_location *loc)
 Aborts a put request. More...
 
int dmlite_location_free (dmlite_location *loc)
 Frees a location struct. More...
 
int dmlite_getdirspaces (dmlite_context *context, const char *logicaldir, int64_t *freespace, int64_t *used)
 Get the estimation of the free/used space for writing into a directory. More...
 

Detailed Description

C wrapper for DMLite Pool API.

Author
Alejandro Álvarez Ayllon aalva.nosp@m.rez@.nosp@m.cern..nosp@m.ch

Macro Definition Documentation

#define CHUNK_ID_MAX   16
#define CHUNK_URL_ALT_MAX   512
#define POOL_MAX   16
#define POOL_TYPE_MAX   16

Typedef Documentation

typedef struct dmlite_chunk dmlite_chunk

Chunk of data.

Collection of chunks that form a replica.

On read, there may be duplicated chunks.

typedef struct dmlite_pool dmlite_pool

Pool data.

Progress markers for file copies. FTS jargon calls these "FTS performance markers".

Function Documentation

dmlite_location* dmlite_chooseserver ( dmlite_context context,
const char *  path 
)

Choose a server where to perform generic actions (e.g. a tunnel)

Parameters
contextThe DM context.
pathThe logical file name to put.
Returns
A pointer to a dmlite_location struct, or NULL on error.
int dmlite_copypull ( dmlite_context context,
const char *  path,
const char *  source,
int  cksumcheck,
char *  cksumtype,
dmlite_xferinfo progressdata 
)

Copy a file from a remote location (synchronous). Allows copying to this head node, may add a replica to an existing logical file entry.

Parameters
contextThe DM context.
pathThe logical file name.
sourceAn URL, that may be a remote destination
cksumcheckTell the copy process to check the final checksums
cksumtypeType of checksum that must be checked (e.g. adler32)
Returns
0 on success, error code otherwise. EAGAIN means performance marker

Beware, the path to the delegated proxy (if any) is stored in the dmlite context

int dmlite_copypush ( dmlite_context context,
const char *  path,
const char *  dest,
int  cksumcheck,
char *  cksumtype,
dmlite_xferinfo progressdata 
)

Copy a file to a remote location (synchronous).

Parameters
contextThe DM context.
pathThe logical file name.
destAn URL, that must be a remote destination
cksumcheckTell the copy process to check the final checksums
cksumtypeType of checksum that must be checked (e.g. adler32)
Returns
0 on success, error code otherwise. EAGAIN means performance marker

Beware, the path to the delegated proxy (if any) is stored in the dmlite context

dmlite_location* dmlite_get ( dmlite_context context,
const char *  path 
)

Gets a single replica (synchronous).

Parameters
contextThe DM context.
pathThe logical file name.
Returns
A pointer to a dmlite_location struct, or NULL on error.
int dmlite_getdirspaces ( dmlite_context context,
const char *  logicaldir,
int64_t *  freespace,
int64_t *  used 
)

Get the estimation of the free/used space for writing into a directory.

Parameters
pathThe path of the directory to query
totalfreeThe total number of free bytes (may not be contiguous)
usedThe total number of used bytes
Returns
0 on success, error code otherwise.
dmlite_location* dmlite_getlocation ( dmlite_context context,
const dmlite_replica replica 
)

Gets the location of a replica.

Parameters
contextThe DM context.
replicaThe replica to translate.
Returns
A pointer to a dmlite_location struct, or NULL on error.
int dmlite_getpools ( dmlite_context context,
unsigned *  nPools,
dmlite_pool **  pools 
)

Gets the list of pools.

Parameters
contextThe DM context.
nPoolsThe number of pools.
poolsAn array with the pools. Use dmlite_freepools to free.
Returns
0 on success, error code otherwise.
dmlite_location* dmlite_iget ( dmlite_context context,
ino_t  inode 
)

Gets a single replica (synchronous).

Parameters
contextThe DM context.
inodeThe file inode.
Returns
A pointer to a dmlite_location struct, or NULL on error.
int dmlite_location_free ( dmlite_location loc)

Frees a location struct.

Parameters
locThe struct to free.
Returns
0 on success, error code otherwise.
int dmlite_pools_free ( unsigned  nPools,
dmlite_pool pools 
)

Frees an array of pools.

Parameters
nPoolsThe number of pools in the array.
poolsThe array to free.
Returns
0 on success, error code otherwise.
dmlite_location* dmlite_put ( dmlite_context context,
const char *  path 
)

Puts a file (synchronous).

Parameters
contextThe DM context.
pathThe logical file name to put.
Returns
A pointer to a dmlite_location struct, or NULL on error.
int dmlite_put_abort ( dmlite_context context,
const dmlite_location loc 
)

Aborts a put request.

Parameters
contextThe DM context.
locAs returned by dmlite_put.
Returns
0 on success, error code otherwise.