Main README covers quick start, API overview, and links to example READMEs. Each example (paste, filemanager, can-sync, canfs) gets its own README with setup instructions, architecture, and configuration details. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
91 lines
2.5 KiB
Markdown
91 lines
2.5 KiB
Markdown
# CanFS
|
|
|
|
Mount [CAN Service](../../) assets as a read-only Windows drive using [WinFSP](https://winfsp.dev). Browse your assets in Windows Explorer like regular files.
|
|
|
|
## Features
|
|
|
|
- **Drive letter mount** -- assets appear as files under a drive like `X:\`
|
|
- **Virtual folder structure** -- files organized into `CAN\`, `APPLICATION\`, `DATES\`, and `TAGS\` directories
|
|
- **Lazy file loading** -- file content is fetched from CAN Service only when you actually open/read a file
|
|
- **Background refresh** -- the file tree updates periodically to pick up new assets
|
|
|
|
## Requirements
|
|
|
|
- **Windows** (this example uses WinFSP, which is Windows-only)
|
|
- **[WinFSP](https://winfsp.dev/rel/)** must be installed (the filesystem driver)
|
|
|
|
## Running
|
|
|
|
Make sure CAN Service is running on port 3210 first:
|
|
|
|
```bash
|
|
# From the repo root
|
|
cargo run
|
|
```
|
|
|
|
Then mount the filesystem:
|
|
|
|
```bash
|
|
cd examples/canfs
|
|
cargo run
|
|
```
|
|
|
|
By default, it mounts on `X:`. Customize with flags:
|
|
|
|
```bash
|
|
cargo run -- --mount Z: --can-url http://127.0.0.1:3210/api/v1/can/0 --refresh-secs 30
|
|
```
|
|
|
|
Press Ctrl+C to unmount.
|
|
|
|
## Folder Structure
|
|
|
|
When mounted, the drive shows these virtual directories:
|
|
|
|
```
|
|
X:\
|
|
CAN\ All assets by timestamp and hash
|
|
1710000000000_abc123.pdf
|
|
1710000005000_def456.jpg
|
|
|
|
APPLICATION\ Grouped by the "application" field
|
|
paste\
|
|
readme.txt
|
|
my-app\
|
|
report.pdf
|
|
|
|
DATES\ Grouped by year and month
|
|
2025\
|
|
01\
|
|
photo.jpg
|
|
03\
|
|
report.pdf
|
|
|
|
TAGS\ One folder per tag
|
|
vacation\
|
|
photo.jpg
|
|
work\
|
|
report.pdf
|
|
```
|
|
|
|
Files with a `human_filename` show their friendly name in `APPLICATION/`, `DATES/`, and `TAGS/` folders. The `CAN/` folder always shows the raw `{timestamp}_{hash}.{ext}` format.
|
|
|
|
## CLI Options
|
|
|
|
| Flag | Default | Description |
|
|
|------|---------|-------------|
|
|
| `-m, --mount` | `X:` | Drive letter or directory to mount on |
|
|
| `--can-url` | `http://127.0.0.1:3210/api/v1/can/0` | CAN Service API base URL |
|
|
| `--refresh-secs` | `60` | Seconds between cache refreshes |
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
src/
|
|
main.rs Entry point: CLI args, WinFSP host setup, background refresh
|
|
api.rs Blocking HTTP client for CAN Service (list, fetch)
|
|
fs.rs WinFSP filesystem implementation (open, read, readdir, etc.)
|
|
tree.rs Virtual directory tree builder (turns flat asset list into folders)
|
|
util.rs Helpers: MIME-to-extension, timestamp conversion, path sanitization
|
|
```
|