3 OVERALL STATES, defining interaction with innd:
5 F refers to the main feed file as written by innd
6 D refers to the flushing file <feedfile>_flushing
13 | | <----------------<---------------------------------'|
19 | F: innd writing, duct reading |
22 | | duct decides time to flush |
23 | | duct makes hardlink |
25 | V <------------------------'|
27 | F == D: innd writing, duct reading both exist |
30 | | <-----------<-------------<--'|
34 | V <---------------------. |
37 | D: innd writing, duct reading; or ENOENT | |
39 | | duct requests flush of feed | |
40 | | (others can too, harmlessly) | |
44 | D: innd flushing, duct; or ENOENT | |
46 | | inndcomm flush fails | |
47 | |`-------------------------->------------------' |
49 | | inndcomm reports no such site |
50 | |`---------------------------------------------------- | -.
52 | | innd finishes writing D, creates F | |
53 | | inndcomm reports flush successful | |
56 | Separated <----------------' |
57 | F: innd writing F!=D /
58 | D: duct reading; or ENOENT both exist /
60 | | duct gets to the end of D /
61 | | duct opens F too /
64 | F: innd writing, duct reading |
67 | | duct finishes processing D F: ENOENT
68 | V duct unlinks D D: duct reading
70 `--<--' | duct finishes
80 "duct reading" means innduct is reading the file but also
81 overwriting processed tokens.
85 We implement this as follows:
94 |`---------------------------------------------------.
96 |`---------------- - - - |
97 D ENOENT | D EXISTS see OVERALL STATES diagram |
98 | for full startup logic |
101 | ============ try to |
107 | | F IS SO BIG WE SHOULD FLUSH, OR TIMEOUT |
108 ^ | hardlink F to D |
111 | | our handle onto F is now onto D |
114 | |<-------------------<---------------------<---------+
116 | | spawn inndcomm flush |
118 | ================== |
119 | FLUSHING[-ABSENT] |
122 | ================== |
124 | | INNDCOMM FLUSH FAILS ^
125 | |`----------------------->----------. |
128 ^ |`--------------->----. ==================== |
129 | | \ FLUSHFAILED[-ABSENT] |
131 | | FLUSH OK \ main D tail/none |
132 | | open F \ ==================== |
134 | | \ | TIME TO RETRY |
135 | |`------->----. ,---<---'\ `----------------'
136 | | D NONE | | D NONE `----.
138 | ============= V V ============
139 | SEPARATED-1 | | DROPPING-1
140 | flsh->rd!=0 | | flsh->rd!=0
141 | [Separated] | | [Dropping]
142 | main F idle | | main none
143 | flsh D tail | | flsh D tail
144 | ============= | | ============
146 ^ | EOF ON D | | defer | EOF ON D
148 | =============== | | ===============
149 | SEPARATED-2 | | DROPPING-2
150 | flsh->rd==0 | V flsh->rd==0
151 | [Finishing] | | [Dropping]
152 | main F tail | `. main none
153 | flsh D closed | `. flsh D closed
154 | =============== V `. ===============
156 | | ALL D PROCESSED `. | ALL D PROCESSED
157 | V install defer as backlog `. | install defer
158 ^ | close D `. | close D
159 | | unlink D `. | unlink D
162 `----------' ==============
181 rune for printing diagrams:
182 a2ps -R -B -ops README.states
187 # tailing reliable realtime streaming feeder for inn
189 # Copyright Ian Jackson <ijackson@chiark.greenend.org.uk>
190 # and contributors; see LICENCE.txt.
191 # SPDX-License-Identifier: GPL-3.0-or-later