https://github.com/juliahep/xrootd.jl
Julia wrapper for XRootD project
https://github.com/juliahep/xrootd.jl
cern hep hep-ex
Last synced: 3 months ago
JSON representation
Julia wrapper for XRootD project
- Host: GitHub
- URL: https://github.com/juliahep/xrootd.jl
- Owner: JuliaHEP
- License: lgpl-3.0
- Created: 2024-05-21T14:19:24.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T15:02:02.000Z (5 months ago)
- Last Synced: 2025-02-23T14:15:58.235Z (3 months ago)
- Topics: cern, hep, hep-ex
- Language: Julia
- Homepage: https://juliahep.github.io/XRootD.jl/
- Size: 356 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://xrootd.slac.stanford.edu)
[](https:///JuliaHEP.github.io/XRootD.jl/dev/)
[](https://github.com/JuliaHEP/XRootD.jl/actions)
[](https://codecov.io/gh/JuliaHEP/XRootD.jl)
[](LICENSE)## Description
Julia bindings for the [XRootD](https://xrootd.slac.stanford.edu) high performance, scalable, and fault tolerant access to data repositories. It facilitates the interface with the XRootD client, by writing Julia code instead of having to write C++.
This package is developed using the [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl) package to wrap C++ types and functions to Julia. Wrapper C++ code is generated with the help of [WrapIt](https://github.com/grasph/wrapit) tool that uses of the clang library.The Julia interface has been inspired by the functionality provided by [pyxrootd](https://xrootd.slac.stanford.edu/doc/doxygen/5.6.4/python/), which implements a set of simple but pythonic bindings for XRootD. In the case of Julia, we have used the same function names if there was an equivalent in the `Base` module.
### [Release History](docs/src/release_notes.md)
### Installation
The XRootD.jl package does no require any special installation. Stable releases are registered into the Julia general registry, and therefore can be deployed with the standard `Pkg` Julia package manager.
```julia
julia> using Pkg
julia> Pkg.add("XRootD")
```## Getting Started
The client module `XRootD.XrdCl` provides the two main types to interact with the XRootD server: the `FileSystem` to do operations on the file system and `File` to read and write files. Here is an example session.```Julia
using XRootD.XrdCl#---FileSystem interface---------------------------------------
fs = FileSystem("root://localhost:1094") # create a FileSystemst, _ = ping(fs) # is server alive?
isError(st) && error(st)st, statinfo = stat(fs, "/tmp") # get statinfo
if isOK(st) && isdir(statinfo)
st, entries = readdir(fs, "/tmp") # ls the directory
isError(st) && error(st)
for f in entries
println(f)
end
end#---File interface--------------------------------------------
f = File()# create file and write
st, _ = open(f, "root://localhost:1094//tmp/testfile.txt", OpenFlags.New|OpenFlags.Write)
isError(st) && error(st)
write(f, "Hello\nWorld\nFolks!")
close(f)# re-open file and read
st, _ = open(f, "root://localhost:1094//tmp/testfile.txt", OpenFlags.Read)
isError(st) && error(st)
st, lines = readlines(f)
isError(st) && error(st)
for line in lines
print(line)
end
close(f)# delete file (using FileSystem)
st, _ = rm(fs, "/tmp/testfile.txt")
```