Update README to reflect current API (FileProgress was already a channel)
This commit is contained in:
parent
1588e1bb9f
commit
a9f0d2abe4
32
README.md
32
README.md
@ -170,35 +170,19 @@ Reading file contents and computing cryptographic hashes for manifest generation
|
|||||||
|
|
||||||
### manifest.go
|
### manifest.go
|
||||||
- **Types**
|
- **Types**
|
||||||
- `ManifestScanOptions struct` - Options for scanning directories
|
- `manifest struct` - Internal representation of a manifest file
|
||||||
- `IncludeDotfiles bool` - Include dot (hidden) files (excluded by default)
|
|
||||||
- `FollowSymLinks bool`
|
|
||||||
- **Functions**
|
|
||||||
- `New() *manifest` - Creates a new empty manifest
|
|
||||||
- `NewFromPaths(options *ManifestScanOptions, inputPaths ...string) (*manifest, error)` - Creates manifest from filesystem paths
|
|
||||||
- `NewFromFS(options *ManifestScanOptions, fs afero.Fs) (*manifest, error)` - Creates manifest from afero filesystem
|
|
||||||
- **Methods**
|
- **Methods**
|
||||||
- `(*manifest) HasError() bool` - Returns true if manifest has errors
|
|
||||||
- `(*manifest) AddError(e error) *manifest` - Adds an error to the manifest
|
|
||||||
- `(*manifest) WithContext(c context.Context) *manifest` - Sets context for cancellation
|
|
||||||
- `(*manifest) GetFileCount() int64` - Returns number of files in manifest
|
|
||||||
- `(*manifest) GetTotalFileSize() int64` - Returns total size of all files
|
|
||||||
- `(*manifest) Files() []*MFFilePath` - Returns all file entries from a loaded manifest
|
- `(*manifest) Files() []*MFFilePath` - Returns all file entries from a loaded manifest
|
||||||
- `(*manifest) Scan() error` - Scans source filesystems and populates file list
|
|
||||||
|
|
||||||
### output.go
|
|
||||||
- **Methods**
|
|
||||||
- `(*manifest) WriteToFile(path string) error` - Writes manifest to file path
|
|
||||||
- `(*manifest) WriteTo(output io.Writer) error` - Writes manifest to io.Writer
|
|
||||||
|
|
||||||
### builder.go
|
### builder.go
|
||||||
- **Types**
|
- **Types**
|
||||||
- `FileProgress func(bytesRead int64)` - Callback for file processing progress
|
- `FileHashProgress struct` - Progress info during file hashing (BytesRead int64)
|
||||||
- `Builder struct` - Constructs manifests by adding files one at a time
|
- `Builder struct` - Constructs manifests by adding files one at a time
|
||||||
- **Functions**
|
- **Functions**
|
||||||
- `NewBuilder() *Builder` - Creates a new Builder
|
- `NewBuilder() *Builder` - Creates a new Builder
|
||||||
- **Methods**
|
- **Methods**
|
||||||
- `(*Builder) AddFile(path string, size int64, mtime time.Time, reader io.Reader, progress FileProgress) (int64, error)` - Reads file, computes hash, adds to manifest
|
- `(*Builder) AddFile(path string, size int64, mtime time.Time, reader io.Reader, progress chan<- FileHashProgress) (int64, error)` - Reads file, computes hash, adds to manifest
|
||||||
|
- `(*Builder) AddFileWithHash(path string, size int64, mtime time.Time, hash []byte)` - Adds file with pre-computed hash
|
||||||
- `(*Builder) FileCount() int` - Returns number of files added
|
- `(*Builder) FileCount() int` - Returns number of files added
|
||||||
- `(*Builder) Build(w io.Writer) error` - Finalizes and writes manifest
|
- `(*Builder) Build(w io.Writer) error` - Finalizes and writes manifest
|
||||||
|
|
||||||
@ -208,9 +192,8 @@ Reading file contents and computing cryptographic hashes for manifest generation
|
|||||||
|
|
||||||
### deserialize.go
|
### deserialize.go
|
||||||
- **Functions**
|
- **Functions**
|
||||||
- `NewFromProto(input io.Reader) (*manifest, error)` - Deserializes manifest from protobuf
|
|
||||||
- `NewManifestFromReader(input io.Reader) (*manifest, error)` - Reads and parses manifest from io.Reader
|
- `NewManifestFromReader(input io.Reader) (*manifest, error)` - Reads and parses manifest from io.Reader
|
||||||
- `NewManifestFromFile(path string) (*manifest, error)` - Reads and parses manifest from file path
|
- `NewManifestFromFile(fs afero.Fs, path string) (*manifest, error)` - Reads and parses manifest from file path
|
||||||
|
|
||||||
### mf.pb.go (generated from mf.proto)
|
### mf.pb.go (generated from mf.proto)
|
||||||
- **Enum Types**
|
- **Enum Types**
|
||||||
@ -352,11 +335,6 @@ The manifest file would do several important things:
|
|||||||
|
|
||||||
- **Manifest size:** Manifests must fit entirely in system memory during reading and writing.
|
- **Manifest size:** Manifests must fit entirely in system memory during reading and writing.
|
||||||
|
|
||||||
# TODO
|
|
||||||
|
|
||||||
- [ ] **Change FileProgress callback to channel** - `mfer/builder.go` uses a callback for progress reporting; should use channels like `EnumerateStatus` and `ScanStatus` for consistency.
|
|
||||||
- [ ] **Consolidate legacy manifest code** - `mfer/manifest.go` has old scanning code (`Scan()`, `addFile()`) that duplicates the new `internal/scanner` + `mfer/builder.go` pattern.
|
|
||||||
|
|
||||||
# Open Questions
|
# Open Questions
|
||||||
|
|
||||||
- Should the manifest file include checksums of individual file chunks, or just for the whole assembled file?
|
- Should the manifest file include checksums of individual file chunks, or just for the whole assembled file?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user