process.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // process.go is a thin re-export and compatibility shim for the shared
  2. // pipeline (internal/pipeline/). All the actual logic lives in pipeline/.
  3. // This file exists so that existing callers in package main (http.go,
  4. // mqtt.go, ws.go, main.go) that reference types by their package-main
  5. // names don't need to change.
  6. package main
  7. import (
  8. "context"
  9. pipeline "git3.techno-world.net/lrosales/broad-announce/internal/pipeline"
  10. )
  11. // SourceConfig is re-exported from pipeline so callers in package main
  12. // (ws.go, mqtt.go, loadSourcesFromEnv) can use it without an import.
  13. type SourceConfig = pipeline.SourceConfig
  14. // Result is re-exported for backward compatibility.
  15. type Result = pipeline.Result
  16. // Accept is re-exported for backward compatibility.
  17. func Accept(id string, count uint32, isNew bool) Result {
  18. return pipeline.Accept(id, count, isNew)
  19. }
  20. // Reject is re-exported for backward compatibility.
  21. func Reject(reason string, status int, detail string) Result {
  22. return pipeline.Reject(reason, status, detail)
  23. }
  24. // processDeps embeds pipeline.Deps and adds ProcessAlert as a thin
  25. // compatibility wrapper so existing callers (http.go, mqtt.go, ws.go)
  26. // don't need to change their call sites.
  27. type processDeps struct{ pipeline.Deps }
  28. // ProcessAlert is the legacy entry point. It delegates to the embedded
  29. // pipeline.Deps.Process, which has the same signature.
  30. func (d *processDeps) ProcessAlert(ctx context.Context, body []byte, sigHeader string) Result {
  31. return d.Process(ctx, body, sigHeader)
  32. }