-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
225 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: CI | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
tags: '*' | ||
jobs: | ||
test: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.9' | ||
- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia. | ||
os: | ||
- ubuntu-latest | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.version }} | ||
arch: ${{ matrix.arch }} | ||
- uses: actions/cache@v1 | ||
env: | ||
cache-name: cache-artifacts | ||
with: | ||
path: ~/.julia/artifacts | ||
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} | ||
restore-keys: | | ||
${{ runner.os }}-test-${{ env.cache-name }}- | ||
${{ runner.os }}-test- | ||
${{ runner.os }}- | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
env: | ||
JULIA_NUM_THREADS: "3" | ||
with: | ||
prefix: xvfb-run | ||
- uses: julia-actions/julia-processcoverage@v1 | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
with: | ||
file: lcov.info | ||
docs: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- run: | | ||
julia --project=docs -e ' | ||
using Pkg | ||
Pkg.develop(PackageSpec(path=pwd())) | ||
Pkg.instantiate()' | ||
- run: | | ||
julia --project=docs -e ' | ||
using Documenter: DocMeta, doctest | ||
using XRootD | ||
DocMeta.setdocmeta!(XRootD, :DocTestSetup, :(using XRootD); recursive=true) | ||
doctest(XRootD)' | ||
- run: julia --project=docs docs/make.jl | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using Documenter | ||
using XRootD | ||
using XRootD.XrdCl | ||
|
||
makedocs(; | ||
modules=[XRootD, XRootD.XrdCl], | ||
format = Documenter.HTML( | ||
prettyurls = Base.get(ENV, "CI", nothing) == "true", | ||
repolink="https://github.com/JuliaHEP/XRootD.jl", | ||
), | ||
pages=[ | ||
"Introduction" => "index.md", | ||
"Public APIs" => "api.md", | ||
"Release Notes" => "release_notes.md", | ||
], | ||
checkdocs=:exports, | ||
repo="https://github.com/JuliaHEP/XRootD.jl/blob/{commit}{path}#L{line}", | ||
sitename="XRootD.jl", | ||
authors="Pere Mato", | ||
) | ||
|
||
deploydocs(; | ||
repo="github.com/JuliaHEP/XRootD.jl", | ||
push_preview = true | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Public Documentation | ||
|
||
Documentation for `XRootD.jl` public interface. | ||
|
||
## Index - Types | ||
```@index | ||
Pages = ["api.md"] | ||
Modules = [XRootD, XRootD.XrdCl] | ||
Order = [:type] | ||
``` | ||
## Index - Functions | ||
```@index | ||
Pages = ["api.md"] | ||
Modules = [XRootD, XRootD.XrdCl] | ||
Order = [:function] | ||
``` | ||
|
||
## Modules | ||
```@autodocs | ||
Modules = [XRootD, XRootD.XrdCl] | ||
Order = [:module] | ||
``` | ||
## Types | ||
This is the list of all types and functions defined for XRootD | ||
|
||
```@autodocs | ||
Modules = [XRootD, XRootD.XrdCl] | ||
Order = [:type] | ||
``` | ||
## Functions | ||
```@autodocs | ||
Modules = [XRootD, XRootD.XrdCl] | ||
Order = [:function] | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Julia binding for XRootD | ||
|
||
## 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++ code. | ||
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 provide a set of simple but pythonic bindings for XRootD. | ||
|
||
## 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") | ||
``` | ||
## API Guidelines | ||
Besides de constructors for `XrdCl.File` and `XrdCl.FileSystem` all the other functions returns a Tuple `(status, response)`, where `status` is an instance of `XRootDStatus` and response is the returned object or `nothing` if the function does not return a value. | ||
|
||
The returned `status` can be directly printed with `println(status)` or similar functions. It can also be checked with `isOK(status)` or `isError(status)` helper functions returning a `Bool`value. | ||
|
||
## Getting Started | ||
|
||
```Julia | ||
using XRootD.XrdCl | ||
|
||
#---FileSystem interface--------------------------------------- | ||
fs = FileSystem("root://localhost:1094") # create a FileSystem | ||
|
||
st, _ = 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") | ||
``` | ||
|
||
## Roadmap | ||
There are a number of issues and problems still to be resolved. We keep track of them in this list: | ||
- Is is necessary to have the async interface? | ||
|
||
|
||
## Tests | ||
Unit tests can be run with `julia --project=. test/runtests.jl` | ||
|
||
## Examples |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
# Release Notes | ||
|
||
## 0.1.0 | ||
- First release. It provide similar functionality as for the python bindings of the client library of XRootD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters