-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip ci] Add some utility scripts to
tools/
- Loading branch information
Showing
2 changed files
with
77 additions
and
0 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,55 @@ | ||
#!/bin/bash | ||
# Make a number of test PROPFIND queries to dandidav and save the output | ||
set -eux | ||
|
||
# dandidav server root: | ||
endpoint=http://127.0.0.1:8080 | ||
#endpoint=https://webdav.dandiarchive.org | ||
|
||
# Path to a collection resource to query: | ||
collection=dandisets/000108/draft | ||
#collection=zarrs/0d5/b9b/0d5b9be5-e626-4f6a-96da-b6b602954899/0395d0a3767524377b58da3945b3c063-48379--27115470.zarr | ||
|
||
# Path to a non-collection resource to query: | ||
item=dandisets/000027/draft/sub-RAT123/sub-RAT123.nwb | ||
|
||
# Directory in which to store responses: | ||
outdir=propfind | ||
|
||
mkdir -p "$outdir" | ||
|
||
curl -fsSL -X PROPFIND -H "Depth: 0" "$endpoint" > "$outdir"/root-depth0.xml | ||
curl -fsSL -X PROPFIND -H "Depth: 1" "$endpoint" > "$outdir"/root-depth1.xml | ||
|
||
curl -fsSL -X PROPFIND -H "Depth: 0" "$endpoint/$collection" > "$outdir"/collection-depth0.xml | ||
curl -fsSL -X PROPFIND -H "Depth: 1" "$endpoint/$collection" > "$outdir"/collection-depth1.xml | ||
|
||
curl -fsSL \ | ||
-X PROPFIND \ | ||
-H "Depth: 1" \ | ||
-d '<propfind xmlns="DAV:"><propname/></propfind>' \ | ||
"$endpoint/$collection" > "$outdir"/propname.xml | ||
|
||
curl -fsSL \ | ||
-X PROPFIND \ | ||
-H "Depth: 1" \ | ||
-d '<propfind xmlns="DAV:"><prop><resourcetype/></prop></propfind>' \ | ||
"$endpoint/$collection" > "$outdir"/resourcetype.xml | ||
|
||
curl -fsSL \ | ||
-X PROPFIND \ | ||
-H "Depth: 0" \ | ||
-d ' | ||
<propfind xmlns="DAV:"> | ||
<prop> | ||
<getcontentlength/> | ||
<resourcetype/> | ||
<unknown/> | ||
<extension xmlns="https://dav.example.com"/> | ||
<displayname/> | ||
</prop> | ||
</propfind> | ||
' "$endpoint/$item" > "$outdir"/prop.xml | ||
|
||
# No -f: | ||
curl -sSL -X PROPFIND -H "Depth: 1" "$endpoint/does-not-exist" > "$outdir"/nonexistent.txt |
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,22 @@ | ||
#!/bin/bash | ||
# Produces a listing of the types defined by dandidav (including anonymous | ||
# types like futures returned by async functions) along with their sizes, | ||
# ordered by decreasing size | ||
# | ||
# Requires: | ||
# | ||
# - nightly Rust | ||
# - top-type-sizes <https://crates.io/crates/top-type-sizes> | ||
|
||
set -eux -o pipefail | ||
|
||
outfile="${1:?Usage: $0 outfile}" | ||
|
||
cargo clean -p dandidav | ||
|
||
RUSTFLAGS=-Zprint-type-sizes cargo +nightly build -j 1 | top-type-sizes \ | ||
--sort-fields \ | ||
--filter '@src/|\b(dandi|dav|httputil|paths|s3|streamutil|zarrman)::' \ | ||
--remove-wrappers \ | ||
--hide-less 8 \ | ||
> "$outfile" |