The main interface to the replica catatlog session module.
It is mainly a proxy class for the replicaManagementc module session functions. It provides a higher
level interface designed to simplify usage. Exceptions are used to indicate
all error conditions.
Methods
|
|
|
|
__del__
|
__del__ ( self )
Destroys an instance.
It will destroy the handle, and deactivate the globus_replica_management
module when the object is destroyed.
Raises:
A SessionException is thrown if unable to destroy the module. This
exception can't be caught, and should never happend. It's there mainly
for debugging if it does happen. :-)
|
|
__init__
|
__init__ ( self, attr=None )
Initialize a session.
This will activate the globus_replica_management_module, and initialize the session
handle.
Arguments
Raises:
A SessionException is thrown if unable to activate the module, or
init the handle.
|
|
collection_create
|
collection_create (
self,
url,
colAttr,
)
Create an empty collection.
The collection is created with no filenames and default access
control rights as defined by the administrator of the replica catalog.
The caller must be authorized to create the collection entry in the
replica catalog.
Arguments
Raises
A SessionException is thrown if unable to create the
collection.
|
|
collection_delete
|
collection_delete (
self,
url,
colAttr,
)
Delete a collection with no filenames.
The caller must be authorized to delete the collection
entry in the replica catalog.
Arguments
Raises
A SessionException is thrown if unable to delete the
collection.
|
|
file_copy
|
file_copy (
self,
url,
srcLocationName,
destLocationName,
filename,
behavior,
colAttr=None,
srcAttr=None,
destAttr=None,
preregFunc=None,
cbArg=None,
)
Copy a file from one replica catalog location's storage system to another.
Updates the replica catalog collection and location information..
Throughout, the replica catalog remains consistent: any files listed in a replica catalog
location are complete and uncorrupt (barring spontaneous corruption by a storage system).
Pending operations on files are locked and their state is checkpointed to the replica
catalog so that, in the event of failure, rollback and restart information is available.
The caller must have authorization to add a filename to the replica catalog collection and
location, to write the file to the destination storage system, and to read from the source
storage system.
Arguments
url A string LDAP URL of an existing replica catalog collection to copy the file in.
srcLocationName A string name of an existing replica catalog location in the replica
catalog collection to copy the file from.
destLocationName A string name of an existing replica catalog location in the replica
catalog collection to add the file to.
filename The string filename of the file to add, which must exist in the storage system
directory referred to by the replica catalog locations's URL constructor and must match
the file specification for this replica catalog location
behavior The overwrite behavior if the file already exists on the destination storage
system, if an error occurs when specifying:
GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_DISALLOW
then neither the file nor the replica catalog are modified;
GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_SAFE
then the original file is left intact (and is available via the replica catalog
throughout the transfer); or
* GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_UNSAFE
then the original file is corrupted and a rollback would attempt to remove the original file
(which is unavailable via the replica catalog throughout the copying operation)
colAttr A CollectionAttr containing the replica catalog
collection attribute, if None, default attributes are used.
srcAttr A FtpClientOperationAttr object containg the
attributes for the source url, if None, default attributes are used.
destAttr A FtpClientOperationAttr object containing the
attributes for the destination url, if None, default attributes are used.
preregFunc a user-supplied function called between copying
the file and registering the file in the replica catalog, the function
must not alter the file or the replica catalog and must be able to be
called multiple times as there may be multiple restart attempts. The
callback has the following form:
function(arg, url) where arg is hte arg passed into this funcion,
and url is the destination url of the just completed copy. Returns
0, or a globus_result_t error object.
This function must not
This function must
No attempt is made to roll back any effects of this function.
Raises
A SessionException is thrown if unable to copy the file.
|
|
file_delete
|
file_delete (
self,
url,
locationName,
filename,
delete,
colAttr=None,
ftpAttr=None,
)
Remove a filename from the replica catalog location.
Also removes the file from the replica catalog location's storage system.
If delete is not true then don't also delete the file from the replica catalog
location's storage system.
The caller must have authorization to remove a filename from the replica catalog
location and to delete the file from the source storage system.
Arguments
url A string LDAP URL of an existing replica catalog collection to
remove the file from.
locationName A string name of an existing replica catalog location in the
replica catalog collection to remove the file from.
filename A string filename of the file to remove, which must exist in the
storage system directory referred to by the replica catalog locations's
URL constructor.
delete Whether to delete the file from the replica catalog
location's storage system.
colAttr A CollectionAttr containing the replica catalog
collection attribute, if None, default attributes are used.
srcAttr A FtpClientOperationAttr object containg the
attributes for the source url, if None, default attributes are used.
Raises
A SessionException is thrown if unable to delete the file.
|
|
file_publish
|
file_publish (
self,
srcUrl,
destUrl,
locationName,
filename,
behavior,
srcAttr=None,
colAttr=None,
destAttr=None,
preregFunc=None,
cbArg=None,
)
Publish a file into a replica catalog collection and location.
Copies the file from its source into the replica catalog location's storage system.
Throughout, the replica catalog remains consistent: any files listed in a replica catalog
location are complete and uncorrupt (barring spontaneous corruption by a storage system).
Pending operations on files are locked and their state is checkpointed to the replica catalog
so that, in the event of failure, rollback and restart information is available.
The caller must have authorization to add a filename to the replica catalog collection and
location, to write the file to the storage system, and to read the source file using their own
credentials.
Arguments
srcUrl A string URL of the file to be published into the replica catalog and copied
to the replica catalog location's storage system, the URL can have the protocol
schemes file: , ftp: , gsiftp: .
destUrl A string LDAP URL of an existing replica catalog collection to add the file to.
locationName A string name of an existing replica catalog location in the replica
catalog collection to add the file to
filename A string containg logical file name of the file to add.
behavior The overwrite behavior if the file already exists on the destination
storage system, if an error occurs when specifying:
GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_DISALLOW
then neither the file nor the replica catalog are modified;
GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_SAFE
then the original file is left intact (and is available via the replica catalog throughout the transfer); or
* GLOBUS_REPLICA_MANAGEMENT_OVERWRITE_UNSAFE
then the original file is corrupted and a rollback would attempt to remove the original file
(which is unavailable via the replica catalog throughout the copying operation)
srcAttr A FtpClientOperationAttr object containg the
attributes for the source url, if None, default attributes are used.
colAttr A CollectionAttr containing the replica catalog
collection attribute, if None, default attributes are used.
destAttr A FtpClientOperationAttr object containing the
attributes for the destination url, if None, default attributes are used.
preregFunc a user-supplied function called between copying
the file and registering the file in the replica catalog, the function
must not alter the file or the replica catalog and must be able to be
called multiple times as there may be multiple restart attempts. The
callback has the following form:
function(arg, url) where arg is hte arg passed into this funcion,
and url is the destination url of the just completed copy. Returns
0, or a globus_result_t error object.
This function must not
This function must
No attempt is made to roll back any effects of this function.
Raises
A SessionException is thrown if unable to publish the file.
|
|
file_register
|
file_register (
self,
url,
locationName,
filename,
colAttr=None,
ftpAttr=None,
)
Register a file into a collection and location.
Registers an existing file in a storage system into an existing
replica catalog collection and a location.
The file already exists in a storage system referred to by a replica
catalog location, no copying is done.
The caller must have authorization to add a filename to the replica
catalog collection and location, and to read the file from the storage system.
Arguments
url A string LDAP URL of an existing replica catalog
collection to add the file to.
locationName A string name of an existing replica catalog
location within the replica catalog collection to add the file to.
filename A string logical file name of the file to add must exist in
the storage system directory referred to by the replica catalog
location's URL constructor
colAttr A CollectionAttr object containg the attributes
for the collection. If None, default attributes are used.
ftpAttr A FtpClientOperationAttr containg the attributes
associated with the location. If None, default attributes
are used.
Raises
A SessionException is thrown if unable to register the
file.
|
|
free_callback
|
free_callback ( self, cbHandle )
Free a callback.
Free's the underlying memory allocated for a callback structure.
Arguments:
|
|
get_handle
|
get_handle ( self )
Return the underlying replica management handle.
XXX This handle is only valid as long as this object exists. When
the object is destroyed, the memory this handle points to is freed.
Returns:
A string containing the pointer.
|
|
get_rollback_contact
|
get_rollback_contact ( self )
Get rollback string.
Obtain the rollback and restart information contact string from the
result of a replica management operation.
he operations that support rollback or restart are
file_publish(), file_copy(), and file_delete().
Returns
The rollback and restart information contact string
associated with the operation.
Raises
A SessionException is thrown if unable to get the rollback
contact.
|
|
location_create
|
location_create (
self,
url,
name,
rootURL,
colAttr=None,
ftpAttr=None,
)
Create a storage system location in the replica catalog,
The location is created without any associated filenames.
The caller must be authorized to create the storage system directory
and to add a location entry to the collection in the replica catalog.
Arguments
url The string URL of the collection to add the location
to.
name A string unique name of a location to add within the
replica catalog collection.
rootURL A string URL of the root directory in the directory
system where the files of this collection will reside, for
example, "gsiftp://host:port/dir".
colAttr A CollectionAttr object containg the attributes
for the collection. If None, default attributes are used.
ftpAttr A FtpClientOperationAttr containg the attributes
associated with the location. If None, default attributes
are used.
Raises
A SessionException is thrown if unable to create the
location.
|
|
location_delete
|
location_delete (
self,
url,
name,
colAttr=None,
)
Delete a storage system location from the replica catalog.
The caller must be authorized to remove the location entry from the
collection in the replica catalog. Note that this call will fail if there
are any files associated with the location and that the associated
storage system will not be affected.
Arguments
url A string ldap url of the collection to remove the
location from.
name The name of a location to remove from the
replica catalog collection.
colAttr A CollectionAttr object containg the attributes
for the collection. If None, default attributes are used.
Raises
A SessionException is thrown if unable to delete the location.
|
|
restart
|
restart (
self,
rollbackInfo,
colAttr=None,
srcFtpAt=None,
destFtpAttr=None,
preregFunc=None,
cbArg=None,
)
Restart the operation described by the given lock.
Arguments
rollbackInfo an opaque contact string containing a pointer to
rollback and restart information for the operation to be restarted.
colAttr A CollectionAttr containing the replica catalog
collection attribute, if None, default attributes are used.
srcFtpAttr A FtpClientOperationAttr object containg the
attributes for the source url, if None, default attributes are used.
destFtpAttr A FtpClientOperationAttr object containing teh
attributes for the destination url, if None, default attributes are used.
preregFunc a user-supplied function called between copying
the file and registering the file in the replica catalog, the function
must not alter the file or the replica catalog and must be able to be
called multiple times as there may be multiple restart attempts. The
callback has the following form:
function(arg, url) where arg is hte arg passed into this funcion,
and url is the destination url of the just completed copy. Returns
0, or a globus_result_t error object.
This function must not
This function must
No attempt is made to roll back any effects of this function.
Raises
A SessionException is thrown if unable to restart the operation.
|
|
rollback
|
rollback (
self,
rollbackInfo,
colAttr=None,
ftpAttr=None,
)
Rollback the operation described by the given lock.
Arguments
rollbackInfo an opaque string containing a
contact string for rollback and restart information
for an operation to be rolled back
colAttr A CollectionAttr containing the replica catalog
collection attribute, if None, default attributes are used.
ftpAttr A FtpClientOperationAttr object containg the
attributes for the destination url, if None, default attributes are used.
Raises
A SessionException is thrown if unable rollback the
operation.
|
|