1. XRootD.client.FileSystem
: Filesystem-based operations¶
1.1. Class Reference¶
- class XRootD.client.FileSystem(url)[source]¶
Interact with an
xrootd
server to perform filesystem-based operations such as copying files, creating directories, changing file permissions, listing directories, etc.- Parameters
url (string) – The URL of the server to connect with
1.1.1. Attributes¶
- FileSystem.url¶
The server URL object, instance of
XRootD.client.URL
1.1.2. Methods¶
- FileSystem.copy(source, target, force=False)[source]¶
Copy a file.
Note
This method is less configurable than using
XRootD.client.CopyProcess
- it is designed to be as simple as possible by using sensible defaults for the underlying copy job. If you need more configurability, or want to make multiple copy jobs run at once in parallel, useXRootD.client.CopyProcess
.- Parameters
source (string) – Source file path
target (string) – Destination file path
force (boolean) – overwrite target if it exists
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.locate(path, flags, timeout=0, callback=None)[source]¶
Locate a file.
- Parameters
path (string) – path to the file to be located
flags – An ORed combination of
XRootD.client.flags.OpenFlags
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.LocationInfo
object
- FileSystem.deeplocate(path, flags, timeout=0, callback=None)[source]¶
Locate a file, recursively locate all disk servers.
- Parameters
path (string) – path to the file to be located
flags – An ORed combination of
XRootD.client.flags.OpenFlags
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.LocationInfo
object
- FileSystem.mv(source, dest, timeout=0, callback=None)[source]¶
Move a directory or a file.
- Parameters
source (string) – the file or directory to be moved
dest (string) – the new name
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.query(querycode, arg, timeout=0, callback=None)[source]¶
Obtain server information.
- Parameters
querycode – the query code as specified in
XRootD.client.flags.QueryCode
arg (string) – query argument
- Returns
the query response or None if there was an error
- Return type
string
Note
For more information about XRootD query codes and arguments, see the relevant section in the protocol reference.
- FileSystem.truncate(path, size, timeout=0, callback=None)[source]¶
Truncate a file.
- Parameters
path (string) – path to the file to be truncated
size (integer) – file size
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.rm(path, timeout=0, callback=None)[source]¶
Remove a file.
- Parameters
path (string) – path to the file to be removed
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.mkdir(path, flags=0, mode=0, timeout=0, callback=None)[source]¶
Create a directory.
- Parameters
path (string) – path to the directory to create
flags – An ORed combination of
XRootD.client.flags.MkDirFlags
where the default is MkDirFlags.NONEmode – the initial file access mode, an ORed combination of
XRootD.client.flags.AccessMode
where the default is rwxr-x—
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.rmdir(path, timeout=0, callback=None)[source]¶
Remove a directory.
- Parameters
path (string) – path to the directory to remove
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.chmod(path, mode, timeout=0, callback=None)[source]¶
Change access mode on a directory or a file.
- Parameters
path (string) – path to the file/directory to change access mode
mode – An OR`ed combination of
XRootD.client.flags.AccessMode
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.ping(timeout=0, callback=None)[source]¶
Check if the server is alive.
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.stat(path, timeout=0, callback=None)[source]¶
Obtain status information for a path.
- Parameters
path (string) – path to the file/directory to stat
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.StatInfo
object
- FileSystem.statvfs(path, timeout=0, callback=None)[source]¶
Obtain status information for a Virtual File System.
- Parameters
path (string) – path to the file/directory to stat
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.StatInfoVFS
object
- FileSystem.protocol(timeout=0, callback=None)[source]¶
Obtain server protocol information.
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.ProtocolInfo
object
- FileSystem.dirlist(path, flags=0, timeout=0, callback=None)[source]¶
List entries of a directory.
- Parameters
path (string) – path to the directory to list
flags – An ORed combination of
XRootD.client.flags.DirListFlags
where the default is DirListFlags.NONE
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object andXRootD.client.responses.DirectoryList
object
Warning
Currently, passing DirListFlags.STAT with an asynchronous call to
XRootD.client.FileSystem.dirlist()
does not work, due to an xrootd client limitation. So you’ll getNone
instead of theStatInfo
instance. See the GitHub issue for more details.
- FileSystem.sendinfo(info, timeout=0, callback=None)[source]¶
Send info to the server (up to 1024 characters).
- Parameters
info (string) – the info string to be sent
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None
- FileSystem.prepare(files, flags, priority=0, timeout=0, callback=None)[source]¶
Prepare one or more files for access.
- Parameters
files (list) – list of files to be prepared
flags – An ORed combination of
XRootD.client.flags.PrepareFlags
priority (integer) – priority of the request 0 (lowest) - 3 (highest)
- Returns
tuple containing
XRootD.client.responses.XRootDStatus
object and None