- Go 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
|
All checks were successful
Suite release / publish (push) Has been skipped
Suite release / deliver-prune (push) Has been skipped
Suite release / module (push) Successful in 22s
Suite release / build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / deploy-image (push) Has been skipped
Suite release / reserve (push) Has been skipped
Suite release / check-build (none, ubuntu-latest) (ubuntu-latest, none) (push) Has been skipped
Suite release / check-package (push) Has been skipped
Suite release / finalize (push) Has been skipped
Suite release / reused-checks (push) Has been skipped
Suite release / scope (push) Successful in 17s
Suite release / deliver (push) Has been skipped
|
||
| errors_other.go | ||
| errors_windows.go | ||
| go.mod | ||
| go.sum | ||
| netfs.go | ||
| netfs_windows_test.go | ||
| README.md | ||
netfs
Reads files on Windows file shares (\\NelsonNAS\files, and a drive mapped to one, such as
S:) under netclient's contract for
slow, lossy links. Over hotel Wi-Fi SMB answers a read with "An unexpected network error
occurred" when the read would work a moment later.
- No total-duration cap: an operation that keeps working is never failed for time.
- A transient network failure (the SMB and network errnos, never not-found or access denied) is retried with netclient's backoff, given up after 10 minutes without progress.
ReadFilereads in chunks and after a failure reopens the file and carries on at the byte it reached, only while the file's size and modification time are those it started with.- Only operations safe to repeat are retried: reading, stat, listing, globbing and walking.
WriteFilewrites once. - Once a server has given up, later operations on it are tried once until one succeeds, so a share that is down costs a run one budget, not one per file.
Local paths go through the same calls and are made once, as os would make them.
It was agent-tools' netfs package until shared packages got repositories of their own
(AGT-85,
AHT-258).
Using it
require forgejo.romaine.life/romaine-life/netfs v0.1.0
import "forgejo.romaine.life/romaine-life/netfs"
share := netfs.New(netfs.Options{Log: logLine}) // a nil Log writes to stderr
data, err := share.ReadFile(`\\NelsonNAS\files\tools\manifest.json`)
Testing
go test ./...; the share tests are Windows-only and use fake errnos, so they need no share.
Shipping
A library: the release-module topic in
pipeline-templates' fleet.json
tags each merge that changes the code, and every fleet repository whose go.mod requires it
gets a take-up. Forgejo pushes it to its public GitHub copy, which proxy.golang.org serves
to builds outside CI.