6.6.3 Receiving files
The second part of the process is a group of functions and generators that will fetch
log filenames from the group chat. After receiving each name, it’ll process the log
files directly from Redis, and will update the keys that the copy process is waiting on.
This will also call our callback on each incoming line, updating our aggregates. The
next listing shows the code for the first of these functions.
Receiving information about log files is straightforward, though we do defer a lot of
the hard work of actually reading the file from Redis to helper functions that generate
sequences of log lines. We also need to be careful to notify the file sender by incrementing
the counter for the log file; otherwise the file sending process won’t know to
clean up finished log files.