Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 1.69 KB

backend.md

File metadata and controls

30 lines (25 loc) · 1.69 KB

##Backend

Next: Function Invoker

Backend is the interface defined to interact with data stores(ex: Redis) which acts storage of reports, it's composed of two parts:

###Reporter

refer to GoDoc for its definition

Worker relies on this interface to send reports to data stores(ex: Redis). Instead of being synchronous, Worker and this interface work in parellel by providing an output channel of []byte. Two things to note:

  • Dingo would make sure that all reports from one task would be sent through the same channel.
  • Dingo would acquire mulitple report channels by calling this method multiple times.
  • Dingo each report channel would only receive one kind(name) of reports.
Report(name string, reports <-chan *ReportEnvelope) (id int, err error)

The evenlope contains two parts:

  • meta info(ID, name of reports) of this byte stream, so you can rely on it to send this byte stream to correct table.
  • payload: the byte stream to be sent

###Store

refer to GoDoc for its definition

Caller relies on this interface to poll reports from data stores(ex: Redis). Instead of being synchronous, Caller and this interface work in parellel by getting channels.

Poll(meta Meta) (reports <-chan []byte, err error)
Done(meta Meta) error

All reports matching the info provided by Meta should be sent through this channel. Once more reports would be sent, Dingo would notify this component by call its Done method.