Skip to content

Commit

Permalink
Added Project.toml to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peremato committed May 29, 2024
1 parent 5df7aa5 commit 5855d63
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
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 provide a set of simple but pythonic bindings for XRootD.
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. In the case of Julia we have used the same function names if there was an equivalent in the `Base` module.

## 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.
Expand All @@ -20,21 +20,47 @@ 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 FileSystem

st = ping(fs) # is server alive?
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
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")
```

3 changes: 3 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

0 comments on commit 5855d63

Please sign in to comment.