Files
acp/event.go
T
Samuel Cui 3ec7e8efb0 fix: close the release-review findings
A release review of the v0.2.1 branch found one data race and a set of
documentation claims the code does not support.

- Make the feed counters atomic: Submit writes them while the pipeline reads
  them for its terminal event, and a caller may Close from another goroutine.
  The new test reproduces the race on the previous revision under -race.
- Correct the withdrawn-version mapping: WithSignatureCache(true) becomes
  HashCachedOrReadRefresh (HashReadRefresh never reuses a stored hash, so the
  old mapping silently lost every cache hit), and add the SourceWithPath and
  Job.Path string-to-segments rows.
- Correct the targetless-hash promise: an empty Targets slice writes nothing,
  and it only hashes when the policy produces a hash, so the default HashOff
  records none.
- Make the report chapter honest about row keying, the restored shell carrying
  today's additive options, the second deliberate difference from af05f05c
  (the managed signature cache), the rewrite tool's tab indent, the
  duplicate-path rule, and the mmap divergence from upstream.
- Fix TESTING.md: the drain test is portable, and only the FreeBSD build
  compiles mmap_other.go.
- Fix AGENTS.md: only value options are last-wins, a reuse-only hash policy is
  an item error rather than an option error, and the event fan-out is the one
  handoff without a hardStop escape.
- Pin the behaviours the review found uncovered: the interval flush, the
  result handoff's hardStop escape, and an Item.Targets panic.
- Harden the read-buffer pool instrumentation: two collections drop the buffers
  cached in another processor's private slot, which a drain loop cannot reach,
  so the refcount assertions stop being vacuous and stop flaking.
2026-09-19 16:21:07 +08:00

48 lines
983 B
Go

package acp
// EventHandler observes the events of one run. ACP calls it from one goroutine per
// registration and never concurrently, so a handler may keep unguarded state between events.
// WithEventHandler is last-wins, so a run has at most one handler.
type EventHandler func(Event)
type Event interface {
iEvent()
}
type EventUpdateCount struct {
Bytes, Files int64
Finished bool
}
func (*EventUpdateCount) iEvent() {}
type EventUpdateProgress struct {
Bytes, Files int64
Finished bool
}
func (*EventUpdateProgress) iEvent() {}
type EventUpdateJob struct {
Job *Job
}
func (*EventUpdateJob) iEvent() {}
type EventReportError struct {
Error *Error
}
func (*EventReportError) iEvent() {}
// EventSignatureCacheSummary reports aggregate cache behavior for one Copyer.
type EventSignatureCacheSummary struct {
Summary SignatureCacheSummary
}
func (*EventSignatureCacheSummary) iEvent() {}
type EventFinished struct{}
func (*EventFinished) iEvent() {}