3 OVERALL STATES, defining interaction with innd:
10 | | <----------------<---------------------------------'|
16 | F: innd writing, duct reading |
19 | | duct decides time to flush |
20 | | duct makes hardlink |
22 | V <------------------------'|
24 | F == D: innd writing, duct reading both exist |
27 | | <-----------<-------------<--'|
31 | V <---------------------. |
34 | D: innd writing, duct reading; or ENOENT | |
36 | | duct requests flush of feed | |
37 | | (others can too, harmlessly) | |
41 | D: innd flushing, duct; or ENOENT | |
43 | | inndcomm flush fails | |
44 | |`-------------------------->------------------' |
46 | | inndcomm reports no such site |
47 | |`---------------------------------------------------- | -.
49 | | innd finishes writing D, creates F | |
50 | | inndcomm reports flush successful | |
53 | Separated <----------------' |
54 | F: innd writing F!=D /
55 | D: duct reading; or ENOENT both exist /
57 | | duct gets to the end of D /
58 | | duct opens F too /
61 | F: innd writing, duct reading |
64 | | duct finishes processing D F: ENOENT
65 | V duct unlinks D D: duct reading
67 `--<--' | duct finishes
77 "duct reading" means innduct is reading the file but also
78 overwriting processed tokens.
82 We implement this as follows:
91 |`---------------------------------------------------.
93 |`---------------- - - - |
94 D ENOENT | D EXISTS see OVERALL STATES diagram |
95 | for full startup logic |
98 | ============ try to |
104 | | F IS SO BIG WE SHOULD FLUSH, OR TIMEOUT |
105 ^ | hardlink F to D |
108 | | our handle onto F is now onto D |
111 | |<-------------------<---------------------<---------+
113 | | spawn inndcomm flush |
115 | ================== |
116 | FLUSHING[-ABSENT] |
119 | ================== |
121 | | INNDCOMM FLUSH FAILS ^
122 | |`----------------------->----------. |
125 ^ |`--------------->----. ==================== |
126 | | \ FLUSHFAILED[-ABSENT] |
128 | | FLUSH OK \ main D tail/none |
129 | | open F \ ==================== |
131 | | \ | TIME TO RETRY |
132 | |`------->----. ,---<---'\ `----------------'
133 | | D NONE | | D NONE `----.
135 | ============= V V ============
136 | SEPARATED-1 | | DROPPING-1
137 | flsh->rd!=0 | | flsh->rd!=0
138 | [Separated] | | [Dropping]
139 | main F idle | | main none
140 | flsh D tail | | flsh D tail
141 | ============= | | ============
143 ^ | EOF ON D | | defer | EOF ON D
145 | =============== | | ===============
146 | SEPARATED-2 | | DROPPING-2
147 | flsh->rd==0 | V flsh->rd==0
148 | [Finishing] | | [Dropping]
149 | main F tail | `. main none
150 | flsh D closed | `. flsh D closed
151 | =============== V `. ===============
153 | | ALL D PROCESSED `. | ALL D PROCESSED
154 | V install defer as backlog `. | install defer
155 ^ | close D `. | close D
156 | | unlink D `. | unlink D
159 `----------' ==============
178 rune for printing diagrams:
179 a2ps -R -B -ops README.states