textileio/go-threads

Collection-level validator functions

sanderpick opened this issue · 1 comments

I've already been POC-ing this idea, but creating an issue now for tracking. Essentially, allow the user to write a function that validates a update event.

The full DB access story is a bit unwieldy... so, breaking it down here:

Collection writes

  • NewCollection: Touches thread via CreateThread (Net.ValidateWrite)
  • DeleteCollection: Touches thread via DeleteThread (Hub context + Net.ValidateWrite)
  • UpdateCollection: Does not touch thread, but will when collection info is persisted to thread records (Hub context + Net.ValidateWrite)

Collection reads

  • GetCollection: Does not and won't ever touch thread (Hub context + Net.ValidateRead)
  • ListCollections: Does not and won't ever touch thread (Hub context + Net.ValidateRead)

Data reads

  • Find: Does not and won't ever touch thread (ReadFilter + Net.ValidateRead)
  • FindByID: Does not and won't ever touch thread (ReadFilter + Net.ValidateRead)
  • Has: Does not and won't ever touch thread (ReadFilter + Net.ValidateRead)
  • Listen: Does not and won't ever touch thread (ReadFilter + Net.ValidateRead)

Data writes

  • Create: Touches thread via CreateRecord (WriteValidator + Net.ValidateWrite)
  • Save: Touches thread via CreateRecord (WriteValidator + Net.ValidateWrite)
  • Delete: Touches thread via CreateRecord (WriteValidator + Net.ValidateWrite)