Skip to content

Commit 4184a5e

Browse files
committed
docs: fileserver directory listing example
1 parent b1162e5 commit 4184a5e

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ RUN export PATH=$PATH:/usr/local/go/bin && \
1515
env ${MAKE_ENV} make && \
1616
make install
1717
RUN rm -rf \
18+
/usr/local/bin/__pycache__ \
1819
/usr/local/bin/dpdk-dumpcap \
1920
/usr/local/bin/dpdk-pdump \
2021
/usr/local/bin/dpdk-proc-info \
2122
/usr/local/bin/dpdk-test* \
22-
/usr/local/bin/ninja \
23+
/usr/local/bin/meson \
2324
/usr/local/bin/pip* \
2425
/usr/local/bin/spdk_* \
2526
/usr/local/bin/wheel \
@@ -31,7 +32,11 @@ RUN rm -rf \
3132
/usr/local/lib/python* \
3233
/usr/local/lib/systemd \
3334
/usr/local/man \
35+
/usr/local/sbin \
3436
/usr/local/share/dpdk \
37+
/usr/local/share/man \
38+
/usr/local/share/polkit-1 \
39+
/usr/local/share/xdp-tools \
3540
/usr/local/src && \
3641
for F in /usr/local/lib/*.so /usr/local/bin/*; do \
3742
ldd "$F" 2>/dev/null | awk 'NF==4 && $2=="=>" && $3~"^/" {print $3}'; \

docs/fileserver.md

+38-5
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,16 @@ sudo ndndpdk-ctrl --gqlserver http://127.0.0.1:3031 systemd start
115115
```
116116

117117
If you are running [NDN-DPDK in Docker container](Docker.md), start another container from the same NDN-DPDK image.
118-
The `/run/ndn` directory should be mounted into both containers in order to establish memif connection.
119-
In this case, you should change `--gqlserver` flag to target the container.
118+
The `/run/ndn` directory should be mounted into both containers in order to establish memif connection; you also need to change `--gqlserver` flag and `NDNTS_NDNDPDK_GQLSERVER` environment variable to target the container.
119+
Moreover, any folders that you want to serve from the NDN-DPDK file server should be mounted into the container; however, this isn't necessary in this example.
120120

121121
The sample activation parameters given in [NDN-DPDK activation sample](../sample/activate) may be used in this scenario.
122-
Follow the instructions in the sample, then run `corepack pnpm start -s fileserver-args.ts | ndndpdk-ctrl --gqlserver http://127.0.0.1:3031 activate-fileserver` to send a file server activation command.
122+
Follow the instructions in the sample, then send a file server activation command with this command:
123+
124+
```bash
125+
corepack pnpm -s start fileserver-args.ts | ndndpdk-ctrl --gqlserver http://127.0.0.1:3031 activate-fileserver
126+
```
127+
123128
Notice the `--gqlserver` flag, targeting the second NDN-DPDK service instance.
124129

125130
### Retrieve the File
@@ -142,10 +147,38 @@ Example command and output:
142147
```shell
143148
$ export NDNTS_UPLINK=ndndpdk-udp:
144149
$ export NDNTS_NDNDPDK_GQLSERVER=http://127.0.0.1:3030
145-
$ npx -y -p https://ndnts-nightly.ndn.today/cat.tgz ndncat get-segmented \
146-
--ver=rdr /fileserver/usr-local-bin/ndndpdk-svc > /tmp/ndndpdk-svc.retrieved
150+
$ alias ndncat='npx -y -p https://ndnts-nightly.ndn.today/cat.tgz ndncat'
151+
152+
$ ndncat get-segmented --ver=rdr /fileserver/usr-local-bin/ndndpdk-svc > /tmp/ndndpdk-svc.retrieved
147153

148154
$ sha256sum /usr/local/bin/ndndpdk-svc /tmp/ndndpdk-svc.retrieved
149155
d7d68600dd33a2e344bb4e4895e10302d4f9781930b601241d5ec5aaacab6392 /usr/local/bin/ndndpdk-svc
150156
d7d68600dd33a2e344bb4e4895e10302d4f9781930b601241d5ec5aaacab6392 /tmp/ndndpdk-svc.retrieved
157+
158+
$ ndncat file-client /fileserver/usr-local-bin /tmp/usr-local-bin-retrieved
159+
```
160+
161+
### Retrieve a Directory
162+
163+
NDN-DPDK file server also supports directory listing as defined in the [ndn6-file-server protocol](https://github.com/yoursunny/ndn6-tools/blob/main/file-server.md).
164+
You can use the [ndncat command](https://ndnts-docs.ndn.today/typedoc/modules/cat.html) to view the directory listing or recursively retrieve a directory.
165+
166+
Example command and (partial) output:
167+
168+
```shell
169+
$ $ ndncat get-segmented --ver=rdr /fileserver/usr-local-share/32=ls | tr '\0' '\n'
170+
ca-certificates/
171+
bash-completion/
172+
ndn-dpdk/
173+
174+
$ ndncat get-segmented --ver=rdr /fileserver/usr-local-share/ndn-dpdk/32=ls | tr '\0' '\n'
175+
locator.schema.json
176+
ndn-dpdk.npm.tgz
177+
fileserver.schema.json
178+
179+
$ ndncat file-client /fileserver/usr-local-share/ndn-dpdk /tmp/usr-local-share/ndn-dpdk
180+
FOLDER /tmp/usr-local-share/ndn-dpdk folders=0 files=7
181+
FILE /tmp/usr-local-share/ndn-dpdk/locator.schema.json size=8210
182+
FILE /tmp/usr-local-share/ndn-dpdk/ndn-dpdk.npm.tgz size=10980
183+
FILE /tmp/usr-local-share/ndn-dpdk/fileserver.schema.json size=22270
151184
```

docs/trafficgen.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ You may use `ndndpdk-ctrl stop-trafficgen` command or GraphQL `delete` mutation
106106
Sample commands:
107107

108108
```bash
109-
TGID=$(corepack pnpm start -s gen-config.ts | ndndpdk-ctrl start-trafficgen | tee /dev/stderr | jq -r '.id')
109+
TGID=$(corepack pnpm -s start gen-config.ts | ndndpdk-ctrl start-trafficgen | tee /dev/stderr | jq -r '.id')
110110
ndndpdk-ctrl watch-trafficgen --id $TGID
111111
ndndpdk-ctrl stop-trafficgen --id $TGID
112112
```

sample/activate/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ This is a Node.js application that generates activation parameters for NDN-DPDK
1616
4. Open a `.ts` file in the editor, and make changes.
1717
The editor can provide hints on available options.
1818
5. Run `corepack pnpm typecheck` to verify your arguments conform to the TypeScript definitions.
19-
6. Run `corepack pnpm start -s [filename] | jq` to see the JSON document.
20-
7. Run `corepack pnpm start -s [filename] | ndndpdk-ctrl [subcommand]` to send the activation command to NDN-DPDK.
19+
6. Run `corepack pnpm -s start [filename] | jq` to see the JSON document.
20+
7. Run `corepack pnpm -s start [filename] | ndndpdk-ctrl [subcommand]` to send the activation command to NDN-DPDK.
2121

2222
## Available Samples
2323

2424
[Forwarder](../docs/forwarder.md): activate with `fw-args.ts`
2525

2626
```bash
27-
corepack pnpm start -s fw-args.ts | ndndpdk-ctrl activate-forwarder
27+
corepack pnpm -s start fw-args.ts | ndndpdk-ctrl activate-forwarder
2828
```
2929

3030
[Traffic generator](../docs/trafficgen.md): activate with `gen-args.ts`, use traffic pattern in `gen-config.ts`
3131

3232
```bash
33-
corepack pnpm start -s gen-args.ts | ndndpdk-ctrl activate-trafficgen
34-
corepack pnpm start -s gen-config.ts | ndndpdk-ctrl start-trafficgen
33+
corepack pnpm -s start gen-args.ts | ndndpdk-ctrl activate-trafficgen
34+
corepack pnpm -s start gen-config.ts | ndndpdk-ctrl start-trafficgen
3535
```
3636

3737
[File server](../docs/fileserver.md): activate with `fileserver-args.ts`
3838

3939
```bash
40-
corepack pnpm start -s fileserver-args.ts | ndndpdk-ctrl activate-fileserver
40+
corepack pnpm -s start fileserver-args.ts | ndndpdk-ctrl activate-fileserver
4141
```

sample/activate/fileserver-args.ts

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const args: ActivateFileServerArgs = {
2424
mounts: [
2525
{ prefix: "/fileserver/usr-local-bin", path: "/usr/local/bin" },
2626
{ prefix: "/fileserver/usr-local-lib", path: "/usr/local/lib" },
27+
{ prefix: "/fileserver/usr-local-share", path: "/usr/local/share" },
2728
],
2829
segmentLen: 6 * 1024,
2930
uringCapacity: 4096,

0 commit comments

Comments
 (0)