go icon indicating copy to clipboard operation
go copied to clipboard

Fix separation of concerns in Horizon processors

Open bartekn opened this issue 5 years ago • 0 comments

Currently, many Horizon processors are relying on db2/history package to do parts of ingestion. db2/history methods should be dumb: they should accept struct to insert/update in a DB and do nothing else. Doing this will make code and tests simpler and will allow writing fuzzers with a mocked DBs.

While working on this we can fix existing issues related to using maps instead of structs: https://github.com/stellar/go/issues/2578.

Examples:

  • One striking example is TransactionProcessor that delegates all ingesting code to TransactionBatchInsertBuilder.
  • Example fix (of OffersProcessor): https://github.com/stellar/go/pull/3083.

List of processors to fix:

  • [x] OffersProcessor
  • [x] https://github.com/stellar/go/issues/3935
  • [x] https://github.com/stellar/go/issues/3934
  • [ ] AssetStatsProcessor
  • [x] https://github.com/stellar/go/issues/3936
  • [ ] EffectProcessor
  • [ ] LedgersProcessor
  • [ ] OperationProcessor
  • [ ] ParticipantsProcessor
  • [ ] SignersProcessor
  • [ ] TradeProcessor
  • [ ] TransactionProcessor
  • [x] TrustLinesProcessor
  • [x] LiquidityPoolsProcessor

bartekn avatar Nov 06 '20 13:11 bartekn