Protocol
This module defines the base class for implementing a transfer protocol, along with some of the default methods for LFN2PFN translations.
Classes¶
RSEProtocol ¶
RSEProtocol(
protocol_attr, rse_settings, logger=logging.log
)
This class is virtual and acts as a base to inherit new protocols from. It further provides some common functionality which applies for the majority of the protocols.
Initializes the object with information about the referred RSE.
PARAMETER | DESCRIPTION |
---|---|
protocol_attr
|
Properties of the requested protocol.
|
rse_settting
|
The RSE settings.
|
logger
|
Optional decorated logger that can be passed from the calling daemons or servers.
DEFAULT:
|
Functions¶
lfns2pfns ¶
lfns2pfns(lfns)
Returns a fully qualified PFN for the file referred by path.
PARAMETER | DESCRIPTION |
---|---|
path
|
The path to the file.
|
RETURNS | DESCRIPTION |
---|---|
Fully qualified PFN. |
__lfns2pfns_client ¶
__lfns2pfns_client(lfns)
Provides the path of a replica for non-deterministic sites. Will be assigned to get path by the init method if necessary.
PARAMETER | DESCRIPTION |
---|---|
scope
|
list of DIDs
|
RETURNS | DESCRIPTION |
---|---|
dict with scope:name as keys and PFN as value (in case of errors the Rucio exception si assigned to the key) |
_get_path ¶
_get_path(scope, name)
Transforms the logical file name into a PFN. Suitable for sites implementing the RUCIO naming convention. This implementation is only invoked if the RSE is deterministic.
PARAMETER | DESCRIPTION |
---|---|
scope
|
scope
|
name
|
filename
|
RETURNS | DESCRIPTION |
---|---|
RSE specific URI of the physical file |
_get_path_nondeterministic_server ¶
_get_path_nondeterministic_server(scope, name)
Provides the path of a replica for non-deterministic sites. Will be assigned to get path by the init method if necessary.
parse_pfns ¶
parse_pfns(pfns)
Splits the given PFN into the parts known by the protocol. It is also checked if the provided protocol supports the given PFNs.
PARAMETER | DESCRIPTION |
---|---|
pfns
|
a list of a fully qualified PFNs
|
RETURNS | DESCRIPTION |
---|---|
dic with PFN as key and a dict with path and name as value |
RAISES | DESCRIPTION |
---|---|
RSEFileNameNotSupported
|
if the provided PFN doesn't match with the protocol settings |
exists ¶
exists(path)
Checks if the requested file is known by the referred RSE.
PARAMETER | DESCRIPTION |
---|---|
path
|
Physical file name
|
RETURNS | DESCRIPTION |
---|---|
True if the file exists, False if it doesn't |
RAISES | DESCRIPTION |
---|---|
SourceNotFound
|
if the source file was not found on the referred storage. |
connect
abstractmethod
¶
connect()
Establishes the actual connection to the referred RSE.
RAISES | DESCRIPTION |
---|---|
RSEAccessDenied
|
if no connection could be established. |
get
abstractmethod
¶
get(path, dest, transfer_timeout=None)
Provides access to files stored inside connected the RSE.
PARAMETER | DESCRIPTION |
---|---|
path
|
Physical file name of requested file
|
dest
|
Name and path of the files when stored at the client
|
transfer_timeout
|
Transfer timeout (in seconds)
DEFAULT:
|
RAISES | DESCRIPTION |
---|---|
DestinationNotAccessible
|
if the destination storage was not accessible. |
ServiceUnavailable
|
if some generic error occurred in the library. |
SourceNotFound
|
if the source file was not found on the referred storage. |
put
abstractmethod
¶
put(source, target, source_dir, transfer_timeout=None)
Allows to store files inside the referred RSE.
PARAMETER | DESCRIPTION |
---|---|
source
|
path to the source file on the client file system
|
target
|
path to the destination file on the storage
|
source_dir
|
Path where the to be transferred files are stored in the local file system
|
transfer_timeout
|
Transfer timeout (in seconds)
DEFAULT:
|
RAISES | DESCRIPTION |
---|---|
DestinationNotAccessible
|
if the destination storage was not accessible. |
ServiceUnavailable
|
if some generic error occurred in the library. |
SourceNotFound
|
if the source file was not found on the referred storage. |
delete
abstractmethod
¶
delete(path)
Deletes a file from the connected RSE.
PARAMETER | DESCRIPTION |
---|---|
path
|
path to the to be deleted file
|
RAISES | DESCRIPTION |
---|---|
ServiceUnavailable
|
if some generic error occurred in the library. |
SourceNotFound
|
if the source file was not found on the referred storage. |
rename
abstractmethod
¶
rename(path, new_path)
Allows to rename a file stored inside the connected RSE.
PARAMETER | DESCRIPTION |
---|---|
path
|
path to the current file on the storage
|
new_path
|
path to the new file on the storage
|
RAISES | DESCRIPTION |
---|---|
DestinationNotAccessible
|
if the destination storage was not accessible. |
ServiceUnavailable
|
if some generic error occurred in the library. |
SourceNotFound
|
if the source file was not found on the referred storage. |
get_space_usage ¶
get_space_usage()
Get RSE space usage information.
RETURNS | DESCRIPTION |
---|---|
a list with dict containing 'totalsize' and 'unusedsize' |
RAISES | DESCRIPTION |
---|---|
ServiceUnavailable
|
if some generic error occurred in the library. |
stat ¶
stat(path)
Returns the stats of a file.
PARAMETER | DESCRIPTION |
---|---|
path
|
path to file
|
RETURNS | DESCRIPTION |
---|---|
a dict with two keys, filesize and adler32 of the file provided in path. |
RAISES | DESCRIPTION |
---|---|
ServiceUnavailable
|
if some generic error occurred in the library. |
SourceNotFound
|
if the source file was not found on the referred storage. |