Rename ManifestBuilder to Builder
This commit is contained in:
parent
f3be3eba84
commit
48c3c09d85
10
README.md
10
README.md
@ -192,13 +192,13 @@ Reading file contents and computing cryptographic hashes for manifest generation
|
||||
### builder.go
|
||||
- **Types**
|
||||
- `FileProgress func(bytesRead int64)` - Callback for file processing progress
|
||||
- `ManifestBuilder struct` - Constructs manifests by adding files one at a time
|
||||
- `Builder struct` - Constructs manifests by adding files one at a time
|
||||
- **Functions**
|
||||
- `NewBuilder() *ManifestBuilder` - Creates a new ManifestBuilder
|
||||
- `NewBuilder() *Builder` - Creates a new Builder
|
||||
- **Methods**
|
||||
- `(*ManifestBuilder) AddFile(path string, size int64, mtime time.Time, reader io.Reader, progress FileProgress) (int64, error)` - Reads file, computes hash, adds to manifest
|
||||
- `(*ManifestBuilder) FileCount() int` - Returns number of files added
|
||||
- `(*ManifestBuilder) Build(w io.Writer) error` - Finalizes and writes manifest
|
||||
- `(*Builder) AddFile(path string, size int64, mtime time.Time, reader io.Reader, progress FileProgress) (int64, error)` - Reads file, computes hash, adds to manifest
|
||||
- `(*Builder) FileCount() int` - Returns number of files added
|
||||
- `(*Builder) Build(w io.Writer) error` - Finalizes and writes manifest
|
||||
|
||||
### serialize.go
|
||||
- **Constants**
|
||||
|
||||
@ -12,16 +12,16 @@ import (
|
||||
// FileProgress is called during file processing to report bytes read.
|
||||
type FileProgress func(bytesRead int64)
|
||||
|
||||
// ManifestBuilder constructs a manifest by adding files one at a time.
|
||||
type ManifestBuilder struct {
|
||||
// Builder constructs a manifest by adding files one at a time.
|
||||
type Builder struct {
|
||||
mu sync.Mutex
|
||||
files []*MFFilePath
|
||||
createdAt time.Time
|
||||
}
|
||||
|
||||
// NewBuilder creates a new ManifestBuilder.
|
||||
func NewBuilder() *ManifestBuilder {
|
||||
return &ManifestBuilder{
|
||||
// NewBuilder creates a new Builder.
|
||||
func NewBuilder() *Builder {
|
||||
return &Builder{
|
||||
files: make([]*MFFilePath, 0),
|
||||
createdAt: time.Now(),
|
||||
}
|
||||
@ -30,7 +30,7 @@ func NewBuilder() *ManifestBuilder {
|
||||
// AddFile reads file content from reader, computes hashes, and adds to manifest.
|
||||
// The progress callback is called periodically with total bytes read so far.
|
||||
// Returns the number of bytes read.
|
||||
func (b *ManifestBuilder) AddFile(
|
||||
func (b *Builder) AddFile(
|
||||
path string,
|
||||
size int64,
|
||||
mtime time.Time,
|
||||
@ -85,14 +85,14 @@ func (b *ManifestBuilder) AddFile(
|
||||
}
|
||||
|
||||
// FileCount returns the number of files added to the builder.
|
||||
func (b *ManifestBuilder) FileCount() int {
|
||||
func (b *Builder) FileCount() int {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
return len(b.files)
|
||||
}
|
||||
|
||||
// Build finalizes the manifest and writes it to the writer.
|
||||
func (b *ManifestBuilder) Build(w io.Writer) error {
|
||||
func (b *Builder) Build(w io.Writer) error {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user