A class to wrap the ftp client functions.
It provides blocking and non-blocking transfers and access to the other ftp
operations.
Methods
|
|
|
|
__del__
|
__del__ ( self )
Destroy an instance.
Free's any remaining callbacks, destroyes the underlying handle, and deactivates
the module.
Raises:
A FtpClientException is thrown if unable to destroy the handle or deactivate
the module.
|
|
__init__
|
__init__ (
self,
handleAttr,
handle=None,
)
Constructs an instance.
Create a new FtpClient instance. This will init the ftp client module and
create a new ftp client handle if none is passed in.
Arguments:
handleAttr A HandleAttr object with the attributes set for
this object.
handle If a SWIG'ized pointer to a globus ftp client handle object
is passed in, create a new instance around this handle. The class
then owns the underlying pointer, and will delete it when the instance
is destroyed.
Raises:
A FtpClientException is thrown if unable to init the module or create
the underlying handle.
|
|
delete
|
delete (
self,
url,
attr,
callback,
arg,
)
Delete a file from a ftp server.
The callback will be called with the final status of the delete.
Arguments:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initi ate the delete.
|
|
exists
|
exists (
self,
url,
callback,
arg,
attr=None,
)
|
|
extended_get
|
extended_get (
self,
url,
eret_alg_str,
callback,
arg,
attr=None,
marker=None,
)
Get a file from an ftp server with server-side processing..
After calling this method, register_read can be called to begin retrieving
the data. When all of the data associated with this URL is retrieved, and all
of the data callbacks have completed, or if the get request is aborted, the
complete callback will be called with the final status of the get.
This method differs from the get method by allowing the user to invoke
server-side data processing algorithms. GridFTP servers may support
support algorithms for data reduction or other customized data storage
requirements. There is no client-side verification done on the algorithm
string provided by the user. If the server does not understand the
requested algorithm, the transfer will fail.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this get.
marker A RestartMarker object.
eret_alg_str The ERET algorithm string. This string contains
information needed to invoke a server-specific data reduction
algorithm on the file being retrieved.
callback The function to be called when the get is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the extended_get.
|
|
extended_put
|
extended_put (
self,
url,
esto_alg_str,
callback,
arg,
attr=None,
marker=None,
)
Store a file on an ftp server with server-side processing.
After calling this method, register_write can be called to begin writing
the data. When all of the data associated with this URL is sent, and all
of the data callbacks have completed, or if the put request is aborted, the
complete callback will be called with the final status of the put.
This method differs from the put method by allowing the user to invoke
server-side data processing algorithms. GridFTP servers may support
algorithms for data reduction or other customized data storage requirements.
There is no client-side verification done on the alogirhtm string provided by
the user. if the server does not understand * the requested algorithm, the transfer
will fail.
Arguments:
url The url to store the data to.
attr An OperationAttr object containing the attributes for
this put.
marker A RestartMarker object.
esto_alg_str The algorith string. This string contains
information needed to invoke a server-specific data reduction
algorithm on the file being put.
callback The function to be called when the put is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the put.
|
|
extended_third_party_transfer
|
extended_third_party_transfer (
self,
srcUrl,
eret_alg_str,
destUrl,
esto_alg_str,
callback,
arg,
srcAttr=None,
destAttr=None,
marker=None,
)
Transfer a file between two ftp servers with server-side processing.
When the transfer is complete, the complete callback will be called with the
final status of the transfer.
This method differs from the third_party_transfer method by allowing the user
to invoke server-side data processing algorithms. GridFTP servers may
support algorithms for data reduction or other customized data storage
requirements. There is no client-side verification done on the alogirhtm
string provided by the user. if the server does not understand
the requested algorithm, the transfer will fail.
Arguments:
srcUrl The url to transfer.
srcAttr An OperationAttr object containing the attributes
for the source.
eret_alg_str The algorithm string for the source server. This
string contains information needed to invoke a server-specific
data reduction algorithm on the file being retrieved.
destUrl The url to store the data to.
esto_alg_str The algorithm string for the dest server. This string contains
information needed to invoke a server-specific data reduction
algorithm on the file being placed.
destAttr An OperationAttr object containing the attributes
for the destination.
marker A RestartMarker object.
callback The function to be called when the transfer is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the transfer.
|
|
free_callback
|
free_callback ( self, cbHandle )
Free a callback.
Free's the underlying memory allocated for a callback structure.
Arguments:
|
|
get
|
get (
self,
url,
callback,
arg,
attr=None,
marker=None,
)
Get a file from an ftp server.
After calling this method, register_read can be called to begin retrieving
the data. When all of the data associated with this URL is retrieved, and all
of the data callbacks have completed, or if the get request is aborted, the
complete callback will be called with the final status of the get.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this get.
marker A RestartMarker object.
callback The function to be called when the get is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the get.
|
|
list
|
list (
self,
url,
attr,
callback,
arg,
)
Get a file listing from an ftp server.
This method starts a NLIST transfer from an ftp server. The client may begin
calling register_read to retrieve the listing, after this method returns. When all
of the data associated with the listing is returned, and all of the data callbacks
executed, the callback will be called with the final status of the list.
Arguments:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the list.
|
|
mkdir
|
mkdir (
self,
url,
attr,
callback,
arg,
)
Make a directory on a ftp server.
The callback will be called with the final status of the mkdir.
Arguments:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initi ate the mkdir.
|
|
modification_time
|
modification_time (
self,
url,
callback,
arg,
attr=None,
)
Retrieves the size of a file on a ftp server
When the modification time is retrieved the complete callback is called
Arguements
* url, the location of the file
* attr, An OperationAttr object, if none is given then
the default OperationAttr is created and used
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
WARNING the Abstime object's underlying timeval struct will not be filled with any
meaningful data until the callback function has been called
Raises
An FtpClientException if the modification time cannot be retrieved
|
|
move
|
move (
self,
srcUrl,
destUrl,
attr,
callback,
arg,
)
Move a file on a ftp server.
The complete callback will be called when the move is completed.
Arguments:
srcUrl The url to move.
destUrl The url to move to.
attr An OperationAttr object containing the attributes
for the listing.
callback The function to be called when the move is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the move.
|
|
partial_get
|
partial_get (
self,
url,
attr,
marker,
offset,
endOffset,
callback,
arg,
)
Get part of a file from a ftp server.
After calling this method, register_read can be called to begin retrieving
the data. When all of the data associated with this URL is retrieved, and all
of the data callbacks have completed, or if the get request is aborted, the
complete callback will be called with the final status of the get.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this get.
marker A RestartMarker object.
offset An int or long offset to begin the transfer at.
endOffset An int or long offset to end the transfer at.
callback The function to be called when the partial get is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the partial get.
|
|
partial_put
|
partial_put (
self,
url,
attr,
marker,
offset,
endOffset,
callback,
arg,
)
Put part of a file onto a ftp server.
After calling this method, register_write can be called to begin writing
the data. When all of the data associated with this URL is sent, and all
of the data callbacks have completed, or if the partial_put request is aborted, the
complete callback will be called with the final status of the partial_put.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this partial_put.
marker A RestartMarker object.
offset An int or long offset to begin the transfer at.
endOffset An int or long offset to end the transfer at.
callback The function to be called when the partial put is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the partial put.
|
|
partial_third_party_transfer
|
partial_third_party_transfer (
self,
srcUrl,
srcAttr,
destUrl,
destAttr,
marker,
offset,
endOffset,
callback,
arg,
)
Transfer part of a file between two ftp servers.
When the transfer is complete, the complete callback will be called with the
final status of the transfer.
Arguments:
srcUrl The url to transfer.
srcAttr An OperationAttr object containing the attributes
for the source.
destUrl The url to store the data to.
destAttr An OperationAttr object containing the attributes
for the destination.
marker A RestartMarker object.
offset An int or long offset to start the transfer from.
endOffset An int or long offset to end the transfer at.
callback The function to be called when the transfer is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the transfer.
|
|
put
|
put (
self,
url,
callback,
arg,
attr=None,
marker=None,
)
Store a file on an ftp server.
After calling this method, register_write can be called to begin writing
the data. When all of the data associated with this URL is sent, and all
of the data callbacks have completed, or if the put request is aborted, the
complete callback will be called with the final status of the put.
Arguments:
url The url to store the data to.
attr An OperationAttr object containing the attributes for
this put.
marker A RestartMarker object.
callback The function to be called when the put is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the put.
|
|
register_read
|
register_read (
self,
buffer,
callback,
arg,
)
Register a data buffer to handle part of the ftp data transfer.
This can only be called after get or partial get has been called.
Arguments:
buffer A pyGlobus.util.Buffer.Buffer object.. This hides the
internal globus_byte_t data buffer.
callback The function to be called after the data has been
read. It has the following signature:
function(arg, handle, buffer, bufHandle, bufLen, offset, eof, error)
where arg is the user argument passed into this call, handle is the
underlying ftp_client handle, buffer is a Python buffer object, bufHandle
is a SWIG'ized pointer to the underlying globus_byte_t array, bufLen
is the length of the underlying globus_byte_t array, offset is the offset
into the file this dta block contains, eof is a bool that is true if
the end of the data transfer has been reached, and error is a string
containing either NONE or an error message.
arg A user argument to be passed through to the callback.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the read.
|
|
register_write
|
register_write (
self,
buffer,
size,
offset,
eof,
callback,
arg,
)
Register a data buffer to handle part of the ftp data transfer.
This can only be called after put or partial put has been called.
Arguments:
buffer A pyGlobus.util.Buffer.Buffer object.. This hides the
internal globus_byte_t data buffer.
size The length of the buffer.
offset The offset of the buffer to be written. In extended block
mode the data doesn't need to be sent in order.
eof True if this buffer contains the end of the data.
callback The function to be called after the data has been
written. It has the following signature:
function(arg, handle, buffer, bufHandle, bufLen, offset, eof, error)
where arg is the user argument passed into this call, handle is the
underlying ftp_client handle, buffer is a Python buffer object, bufHandle
is a SWIG'ized pointer to the underlying globus_byte_t array, bufLen
is the length of the underlying globus_byte_t array, offset is the offset
into the file this dta block contains, eof is a bool that is true if
the end of the data transfer has been reached, and error is a string
containing either NONE or an error message.
arg A user argument to be passed through to the callback.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the write.
|
|
rmdir
|
rmdir (
self,
url,
attr,
callback,
arg,
)
Remove a directory on a ftp server.
The callback will be called with the final status of the rmdir.
Arguments:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initi ate the rmdir.
|
|
size
|
size (
self,
url,
callback,
arg,
attr=None,
)
Retrieves the size of a file on a ftp server
When the size is retrieved the complete callback is called
Arguements
* url, the location of the file
* attr, An OperationAttr object, if none is given then
the default OperationAttr is created and used
callback The function to be called when the file size has been retrieved. It
has the following signature: function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns
An util.Off_t object,
WARNING the object underlying globus_off_t pointer will not be filled with any
meaningful data until the callback function has been called Raises
An FtpClientException if the size cannont be retrieved
|
|
third_party_transfer
|
third_party_transfer (
self,
srcUrl,
destUrl,
callback,
arg,
srcAttr=None,
destAttr=None,
marker=None,
)
Transfer a file between two ftp servers.
When the transfer is complete, the complete callback will be called with the
final status of the transfer.
Arguments:
srcUrl The url to transfer.
srcAttr An OperationAttr object containing the attributes
for the source.
destUrl The url to store the data to.
destAttr An OperationAttr object containing the attributes
for the destination.
marker A RestartMarker object.
callback The function to be called when the transfer is completed. It
has the following signature:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the transfer.
|
|
verbose_list
|
verbose_list (
self,
url,
attr,
callback,
arg,
)
Get a file listing from an ftp server.
This method starts a LIST transfer from an ftp server. The client may begin
calling register_read to retrieve the listing, after this method returns. When all
of the data associated with the listing is returned, and all of the data callbacks
executed, the callback will be called with the final status of the list.
Arguments:
function(arg, handle, error) where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message.
Returns:
A SWIG'ized pointer to the callback handle is returned. After the callback
completes, this may be free'd with the free_callback method, or it will be
free'd when the instance is destroyed.
Raises:
A FtpClientException is thrown if unable to initiate the list.
|
|