lib/cluster: unify collector/publisher factories#1300
Open
bigbes wants to merge 2 commits into
Open
Conversation
sssciel
approved these changes
May 28, 2026
Mockird31
approved these changes
May 29, 2026
Collapse the twin DataCollectorFactory and DataPublisherFactory into a
single Factory type. RawStorage already implements both DataCollector and
DataPublisher, so the two factories were mechanically duplicating each
other; their only real difference was which integrity options
(verifiers vs signer/verifiers) the caller wired up.
Along the way drop a handful of redundant shims now subsumed by the
unified factory and RawStorage:
- CSConnection / ConnectCStorage: a duplicate codec wrapper around
RawStorage. The two failover callers now build a RawStorage
directly via NewStorage with an empty objectLocation.
- IRawStorage: declared but never used as a type.
- CreateDataCollector: a three-line wiring helper with a single
caller; inlined.
- NewConfigStorage: a one-line default-argument helper folded into
Factory.NewRemoteStorage.
Rename FileDataPublisher -> FilePublisher for symmetry with
FileCollector. Helpers in cli/cmd that constructed the two factories
are consolidated into createCollectorFactory /
createPublisherFactory / createCollectorAndPublisherFactories. The
cli/cluster/cmd nil-checking createPublisherAndCollector splits into
openRemoteCollector (show) and openCollectorAndPublisher (publish).
Part of TNTP-7390
Drop redundant indirection across lib/cluster and lib/integrity and wire the cleaned-up API through cli/cmd: - Merge datacollector.go, datapublisher.go, errors.go into types.go; remove unused CollectEmptyError and errWrongRevision. - Inline defaultFileReadFunc and the newFileCollector wrapper. - Collapse RawStorage's collectByKey/publishByKey/collectByRange/ publishByRange into Get/Put/Collect/Publish; inline applyIntegrityBuilderOptions into NewStorage. - Wire optional cleanup into RawStorage.Close via SetCleanup so callers don't need a wrapper; drop failoverStorage. - Expose NewCollectorFactory/NewPublisherFactory in cli/cluster as a single source of truth, inline the cli/cmd/common.go delegation wrappers at the 13 call sites in cli/cmd, and wrap pass-through errors crossing the cli/cluster boundary. - Merge dummy_repository.go into lib/integrity/integrity.go; drop unused AddHash/Add stubs; shrink redundant flag-registrar tests; wrap os.Open's error in dummyRepository.Read with the path. - Annotate three RawStorage internal pass-throughs with //nolint:wrapcheck — the callee already wraps with the storage type. Part of TNTP-7390
471754d to
d336530
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of TNTP-7390