mirror of
https://github.com/hanzoai/s3.git
synced 2026-11-03 03:07:41 +00:00
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.
- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
"Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
(replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
keep their upstream import paths with zero churn. Internal identifiers and
import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
help/usage/flag strings, shell autocomplete program name, and the product name
in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
(e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
`cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
updated to ignore the `s3` build output.
75 lines
2.7 KiB
Go
75 lines
2.7 KiB
Go
package mount
|
|
|
|
import (
|
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
|
)
|
|
|
|
// Forget is called when the kernel discards entries from its
|
|
// dentry cache. This happens on unmount, and when the kernel
|
|
// is short on memory. Since it is not guaranteed to occur at
|
|
// any moment, and since there is no return value, Forget
|
|
// should not do I/O, as there is no channel to report back
|
|
// I/O errors.
|
|
// from https://github.com/libfuse/libfuse/blob/master/include/fuse_lowlevel.h
|
|
/**
|
|
* Forget about an inode
|
|
*
|
|
* This function is called when the kernel removes an inode
|
|
* from its internal caches.
|
|
*
|
|
* The inode's lookup count increases by one for every call to
|
|
* fuse_reply_entry and fuse_reply_create. The nlookup parameter
|
|
* indicates by how much the lookup count should be decreased.
|
|
*
|
|
* Inodes with a non-zero lookup count may receive request from
|
|
* the kernel even after calls to unlink, rmdir or (when
|
|
* overwriting an existing file) rename. Filesystems must handle
|
|
* such requests properly and it is recommended to defer removal
|
|
* of the inode until the lookup count reaches zero. Calls to
|
|
* unlink, rmdir or rename will be followed closely by forget
|
|
* unless the file or directory is open, in which case the
|
|
* kernel issues forget only after the release or releasedir
|
|
* calls.
|
|
*
|
|
* Note that if a file system will be exported over NFS the
|
|
* inodes lifetime must extend even beyond forget. See the
|
|
* generation field in struct fuse_entry_param above.
|
|
*
|
|
* On unmount the lookup count for all inodes implicitly drops
|
|
* to zero. It is not guaranteed that the file system will
|
|
* receive corresponding forget messages for the affected
|
|
* inodes.
|
|
*
|
|
* Valid replies:
|
|
* fuse_reply_none
|
|
*
|
|
* @param req request handle
|
|
* @param ino the inode number
|
|
* @param nlookup the number of lookups to forget
|
|
*/
|
|
/*
|
|
https://libfuse.github.io/doxygen/include_2fuse__lowlevel_8h.html
|
|
|
|
int fuse_reply_entry ( fuse_req_t req,
|
|
const struct fuse_entry_param * e
|
|
)
|
|
Reply with a directory entry
|
|
|
|
Possible requests: lookup, mknod, mkdir, symlink, link
|
|
|
|
Side effects: increments the lookup count on success
|
|
|
|
*/
|
|
func (wfs *WFS) Forget(nodeid, nlookup uint64) {
|
|
// Forget only decrements the kernel's inode lookup count. File handle
|
|
// lifecycle is driven independently by FUSE Open/Release — touching the
|
|
// fhMap here would couple two unrelated refcounts and could tear down a
|
|
// still-live handle if Forget ever raced ahead of Release.
|
|
wfs.inodeToPath.Forget(nodeid, nlookup, func(dir util.FullPath) {
|
|
// Runs after Forget releases its lock; a concurrent lookup+rebuild can
|
|
// re-cache the directory in that window, so purge through the apply loop
|
|
// rather than wiping the store directly.
|
|
wfs.purgeDirectoryCache(dir)
|
|
})
|
|
}
|