Package pyGlobus :: Module gassCopy :: Class GassCopy
[show private | hide private]
[frames | no frames]

Class GassCopy


Provides a simple interface to protocol independent file transfers.

Wraps the globus gass copy module. Supports http, https, ftp, and gsiftp based transfers.
Method Summary
  __init__(self, handleAttr, handle)
Constructs an instance.
  __del__(self)
Destroy an instance.
  cache_url_state(self, url)
Cache a connection to a server.
  copy_handle_to_url(self, srcHandle, destUrl, destAttr)
Transfer data from a io handle to a URL.
  copy_url_to_handle(self, srcUrl, srcAttr, destHandle)
Transfer data from a source URL to a io handle.
  copy_url_to_url(self, srcUrl, srcAttr, destUrl, destAttr)
Transfer data from source url to destination url.
  flush_url_state(self, url)
Remove a cached connection.
  free_callback(self, cbHandle)
Free the callbacks resources.
  get_handle(self)
Return the underlying gass copy handle.
  get_status(self)
Return the current status.
  register_copy_handle_to_url(self, srcHandle, destUrl, destAttr, callback, arg)
Transfer data from a io handle to a URL.
  register_copy_url_to_handle(self, srcUrl, srcAttr, destHandle, callback, arg)
Transfer data from a source URL to a io handle.
  register_copy_url_to_url(self, srcUrl, srcAttr, destUrl, destAttr, callback, arg)
Transfer data from source url to destination url.

Method Details

__init__(self, handleAttr, handle=None)
(Constructor)

Constructs an instance.

Activates the gass copy module, and then creates the underlying gass copy handle.
Parameters:
handleAttr - A HandleAttr object.
handle - An optional argument that if present will be used as the gass copy handle. The class then owns the handle, and will delete it at destruction.
Raises:
GassCopyException - A GassCopyException is thrown if unable to initialize the module or create the handle.

__del__(self)
(Destructor)

Destroy an instance.

Free any outstanding callback handles, destroy the underlying gass copy handle, and deactivate the module.
Raises:
GassCopyException - A GassCopyException is thrown if unable to destroy the handle or deactivate the module.

cache_url_state(self, url)

Cache a connection to a server.

When an URL is cached, the connection to the server will not be closed after a file transfer completes.
Parameters:
url - The URL to be cached.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while caching the url.

copy_handle_to_url(self, srcHandle, destUrl, destAttr)

Transfer data from a io handle to a URL.

Currently the only types of handles implemented are file io handles. This method blocks until the transfer is complete.
Parameters:
srcHandle - A globus_io_handle_t SWIG pointer. Currently these are returned from the io file methods. The data will be read from here.
destUrl - The URL to transfer the data to.
destAttr - A Attr object with the attributes for the destination.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while attempting to copy the data.

copy_url_to_handle(self, srcUrl, srcAttr, destHandle)

Transfer data from a source URL to a io handle.

Currently the only types of handles implemented are file io handles. This method blocks until the transfer is complete.
Parameters:
srcUrl - The URL to transfer data from.
srcAttr - A Attr object with the attributes for the source.
destHandle - A globus_io_handle_t SWIG pointer. Currently these are returned from the io file methods.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while attempting to copy the data.

copy_url_to_url(self, srcUrl, srcAttr, destUrl, destAttr)

Transfer data from source url to destination url.

The url's may be http, https, ftp, and gsiftp. This method blocks until the transfer is complete.
Parameters:
srcUrl - The URL to transfer the data from.
srcAttr - A Attr object with the attributes for the source.
destUrl - The URL to transfer data to.
destAttr - A Attr object with the attributes for the destination.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while attempting to copy the data.

flush_url_state(self, url)

Remove a cached connection.

If an idle connection to an FTP server exists, it will be closed.
Parameters:
url - The URL to be flushed from the cache.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while flushing the url.

free_callback(self, cbHandle)

Free the callbacks resources.

Free's the memory allocated to hold the callback structure.
Parameters:
cbHandle - The SWIG'ized pointer to a cbStruct.

get_handle(self)

Return the underlying gass copy handle.
Returns:
A string containing the pointer.

Warning: This handle is only valid as long as this object exists. When

get_status(self)

Return the current status.

Returns a status code describing the state of the current transfer.
Returns:
A status code. The possible codes are defined above in the module constants
Raises:
GassCopyException - A GassCopyException is thrown if unable to return the status.

register_copy_handle_to_url(self, srcHandle, destUrl, destAttr, callback, arg)

Transfer data from a io handle to a URL.

Asynchronously transfers the data. Currently the only types of handles implemented are file io handles.
Parameters:
srcHandle - A globus_io_handle_t SWIG pointer. Currently these are returned from the io file methods. The data will be read from here.
destUrl - The URL to transfer the data to.
destAttr - A Attr object with the attributes for the destination.
callback - The function to call when the transfer is complete. It has the following form. 'function(arg, handle, error)' where arg is the user argument passed into this call, handle is the gass copy handle, and error is a tuple (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object.
arg - A user argument to be passed to the callback function.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while initiating the copy.

register_copy_url_to_handle(self, srcUrl, srcAttr, destHandle, callback, arg)

Transfer data from a source URL to a io handle.

Currently the only types of handles implemented are file io handles. This method blocks until the transfer is complete.
Parameters:
srcUrl - The URL to transfer data from.
srcAttr - A Attr object with the attributes for the source.
destHandle - A globus_io_handle_t SWIG pointer. Currently these are returned from the io file methods.
callback - The function to call when the transfer is complete. It has the following form. 'function(arg, handle, error)' where arg is the user argument passed into this call, handle is the gass copy handle, and error is a tuple (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object.
arg - A user argument to be passed to the callback function.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while initiating the copy.

register_copy_url_to_url(self, srcUrl, srcAttr, destUrl, destAttr, callback, arg)

Transfer data from source url to destination url.

Asynchronously transfer data between two url's.
Parameters:
srcUrl - The URL to transfer the data from.
srcAttr - A Attr object with the attributes for the source.
destUrl - The URL to transfer data to.
destAttr - A Attr object with the attributes for the destination.
callback - The function to call when the transfer is complete. It has the following form. 'function(arg, handle, error)' where arg is the user argument passed into this call, handle is the gass copy handle, and error is a tuple (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object.
arg - A user argument to be passed to the callback function.
Raises:
GassCopyException - A GassCopyException is thrown if an error occurs while initiating the transfer.

Generated by Epydoc 2.1 on Tue Apr 4 14:32:55 2006 http://epydoc.sf.net