Commit 3a46c36
Address review feedback on WindowsDirectory/NativeUnixDirectory port (#1342)
Per NightOwl888's review of #1346:
- Surface IOException.HResult on the native-error paths so NativeFSLock (which
inspects HResult to detect share/lock violations) keeps working:
- errno-derived throws (NativePosixUtil.NewIOException/posix_fadvise;
NativeUnixDirectory PWrite/FTruncate/FileSize) pass errno into the
IOException(message, hresult) ctor. On Unix the BCL surfaces the raw errno
as HResult (a FileStream share violation gives HResult == EWOULDBLOCK), so
errno-as-HResult matches the convention.
- Win32-derived throws (WindowsDirectory OpenFile/Read/Length) use
Marshal.GetHRForLastWin32Error().
- Exception-wrap sites (WindowsDirectory.ReadInternal; NativeUnixDirectory
Refill/Length/Clone) preserve the original HResult. Uses the
IOException(message, hresult) ctor where possible because the HResult setter
is protected on net462/netstandard2.0; the RuntimeException wrappers guard
the setter with #if for those TFMs.
- Implement NativeUnixIndexOutput.Checksum via a running CRC32 (like
FSIndexOutput) instead of throwing NotSupportedException. The base-suite
TestChecksum now passes against NativeUnixDirectory.
- Move the LuceneNetSpecific test files into the Support folder:
Store/Test{NativeUnix,Windows}Directory.cs -> Support/Store/...
Not changed: the optional Put/Get micro-optimizations (Unsafe.CopyBlockUnaligned
/ ref byte), which the reviewer flagged as "benchmark to be sure it is worth
it"; the current Span.CopyTo already lowers to memmove.
Verified: builds on net10/net8/netstandard2.0/net462; TestNativeUnix/TestWindows
pass 24/24 on macOS arm64 and 23/23 on Linux aarch64.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent df10293 commit 3a46c36
5 files changed
Lines changed: 63 additions & 13 deletions
File tree
- src
- Lucene.Net.Misc/Store
- Lucene.Net.Tests.Misc/Support/Store
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
162 | | - | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
163 | 165 | | |
164 | 166 | | |
165 | 167 | | |
| |||
188 | 190 | | |
189 | 191 | | |
190 | 192 | | |
191 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
192 | 197 | | |
193 | 198 | | |
194 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
186 | 187 | | |
187 | 188 | | |
188 | 189 | | |
189 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
190 | 194 | | |
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
197 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
205 | 211 | | |
206 | 212 | | |
207 | 213 | | |
208 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
209 | 217 | | |
210 | 218 | | |
211 | 219 | | |
| |||
286 | 294 | | |
287 | 295 | | |
288 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
289 | 300 | | |
290 | 301 | | |
291 | 302 | | |
| |||
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
| 316 | + | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
| |||
311 | 323 | | |
312 | 324 | | |
313 | 325 | | |
| 326 | + | |
314 | 327 | | |
315 | 328 | | |
316 | 329 | | |
| |||
393 | 406 | | |
394 | 407 | | |
395 | 408 | | |
396 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
397 | 412 | | |
398 | 413 | | |
399 | 414 | | |
| |||
494 | 509 | | |
495 | 510 | | |
496 | 511 | | |
497 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
498 | 522 | | |
499 | 523 | | |
500 | 524 | | |
| |||
524 | 548 | | |
525 | 549 | | |
526 | 550 | | |
527 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
528 | 555 | | |
529 | 556 | | |
530 | 557 | | |
| |||
567 | 594 | | |
568 | 595 | | |
569 | 596 | | |
570 | | - | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
571 | 605 | | |
572 | 606 | | |
573 | 607 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
160 | | - | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
161 | 165 | | |
162 | 166 | | |
163 | 167 | | |
| |||
208 | 212 | | |
209 | 213 | | |
210 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
211 | 218 | | |
212 | 219 | | |
213 | 220 | | |
214 | | - | |
| 221 | + | |
215 | 222 | | |
216 | 223 | | |
217 | 224 | | |
| |||
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
242 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
| |||
251 | 260 | | |
252 | 261 | | |
253 | 262 | | |
254 | | - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
255 | 266 | | |
256 | 267 | | |
257 | 268 | | |
| |||
0 commit comments