Rename ManifestBuilder to Builder

This commit is contained in:
2025-12-17 11:23:40 -08:00
parent f3be3eba84
commit 48c3c09d85
2 changed files with 13 additions and 13 deletions

View File

@@ -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()