Input is an interface representing an object that produces (fetches) datas for the filter.
| 56 | // Input is an interface representing an object that produces |
| 57 | // (fetches) datas for the filter. |
| 58 | type Input interface { |
| 59 | // Start fetching data and pushing it into the channel. |
| 60 | // If this call blocks forever, the topology is permanent and |
| 61 | // acts like a long-running daemon; if this calls exits after |
| 62 | // it has finished, the topology is meant to be run as a task |
| 63 | // to process a fixed-size input, and baker will cleanly shutdown |
| 64 | // after all inputs have been fully processed. |
| 65 | Run(output chan<- *Data) error |
| 66 | |
| 67 | // Force the input to stop as clean as possible, at a good boundary. |
| 68 | // This is usually issued at the user's request of exiting the process. |
| 69 | // For instance, it might make sense to finish processing the current |
| 70 | // batch of data or the current file, and then save in stable storage |
| 71 | // the checkpoint to resume it later. |
| 72 | Stop() |
| 73 | |
| 74 | // Return stats about the input |
| 75 | Stats() InputStats |
| 76 | |
| 77 | // This function is called when the filter is finished with |
| 78 | // the memory received through the input channel. Since the |
| 79 | // memory was allocated by Input, it is returned to it |
| 80 | // so that it might be recycled. |
| 81 | FreeMem(data *Data) |
| 82 | } |
| 83 | |
| 84 | // Filter represents a data filter; a filter is a function that processes |
| 85 | // records. A filter can discard, transform, forward and even create records. |
no outgoing calls
no test coverage detected