Package pyGlobus :: Module ftpClientPlugin :: Class RestartMarker
[show private | hide private]
[frames | no frames]

Class RestartMarker


A class to wrap the ftp client restart marker attributes.

It provides various get and set methods to control the properties of a transfer that is about to restart.
Method Summary
  __init__(self, handle)
Constructs an instance.
  __del__(self)
Destroy an instance.
  copy(self)
Creates a deep copy of iteself.
  from_string(self, markerStr)
Initialize the marker from a string.
  get_handle(self)
Return the underlying ftp client restart marker handle.
  get_total(self)
Get total bytes accounted for in restart marker.
  insert_range(self, offset, endOffset)
Insert a range into the marker.
  set_ascii_offset(self, offset, asciiOffset)
Set the offset for a restart marker.
  set_offset(self, offset)
Insert the offset to restart at.
  to_string(self)
Return a string represenation of the marker.

Method Details

__init__(self, handle=None)
(Constructor)

Constructs an instance.

Activates the globus ftp client module, and creates the underlying handle.
Parameters:
handle - An optional argument used to construct an instance from an existing handle. The class assumes it then "owns" the handle, and can free it when it is destroyed.
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to initialize the module, or create the handle.

__del__(self)
(Destructor)

Destroy an instance.

Destroys the underlying handle, and deactivates the module.

NOTE: This destructor is sometimes called when the ftpClientc has already been destroyed because of somewhat unpleasant python behavior when this module is imported
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to deactivate the module

copy(self)

Creates a deep copy of iteself.

A RestartMarker is thrown if unable to make the copy.
Returns:
A new RestartMarker object with the same attributes as the old is returned.

from_string(self, markerStr)

Initialize the marker from a string.
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to initialize the marker from the given string.

get_handle(self)

Return the underlying ftp client restart marker handle.
Returns:
A string containing the pointer.

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

get_total(self)

Get total bytes accounted for in restart marker.

This funtion will return the sum of all bytes accounted for in a restart marker. If this restart marker contains a stream offset then this value is the same as the offset (not the ascii offset) that it was set with. If it is a range list, it a sum of all the bytes in the ranges.
Raises:
RestartMarkerException -

A RestartMarkerException is thrown if unable to get the total bytes.

*Returns:**

The total bytes in the marker..

insert_range(self, offset, endOffset)

Insert a range into the marker.

This method updates the marker with a new byte range, suitable for using to restart an extended block mode transfer. Adjacent ranges within the marker will be combined into a single entry in the marker.

A marker can only hold a range list or a stream offset. Calling this method after calling set_offset() will result in a marker suitable only for use restarting an extended block mode transfer.
Parameters:
offset - The beginning offset to start at. This may be an int or a python long, if your platform supports 64 bit files.
endOffset - The offset to end at.
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to insert the restart range.

set_ascii_offset(self, offset, asciiOffset)

Set the offset for a restart marker.

This method modifies the marker to contain a stream offset, suitable for using to restart a steam mode transfer.

A marker can only hold a range list or a stream offset. Calling this method after calling insert_range() will delete the ranges associated with the marker, and replace it with a marker suitable only for use restarting a stream mode transfer.

When restarting an ASCII type transfer, use this method to set both the offset used in the local representation of an ACSII file, and the network representation of the ASCII file. For UNIX systems, the former includes counts newlines as one character towards the file offset, and the latter counts them as 2 characters (CRLF).
Parameters:
offset - The local stream offset.
  • *asciiOffset:** The networks ASCII representation of the offset.
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to set the ASCII offset.

set_offset(self, offset)

Insert the offset to restart at.

This method modifies the marker to contain a stream offset, suitable for using to restart a steam mode transfer.

A marker can only hold a range list or a stream offset. Calling this method after calling insert_range() will delete the ranges associated with the marker, and replace it with a marker suitable only for use restarting a stream mode transfer.

When restarting an ASCII type transfer, the offset must take into account the additional carriage return characters added to the data stream.
Parameters:
offset - The offset to begin at. This may be an int, or a python long on platformst that support 64 bit files.
Raises:
RestartMarkerException - A RestartMarkerException is thrown if unable to set the offset.

to_string(self)

Return a string represenation of the marker.

Returns a string suitable for sending to the FTP REST command, or for a later call to from_string().
Raises:
RestartMarkerException -

A RestartMarkerException is thrown if unable to get the marker string.

*Returns:**

A string representation of the marker.

Generated by Epydoc 2.0 on Thu Jul 15 16:32:55 2004 http://epydoc.sf.net