syncthingfuse icon indicating copy to clipboard operation
syncthingfuse copied to clipboard

Replace cached blocks on index update

Open burkemw3 opened this issue 8 years ago • 0 comments

  1. syncthingfuse device A reads all of file foobar, storing all blocks in cache
  2. syncthing device B updates file foobar
  3. device A receives index change. now (some or all) cached blocks are invalid, but still in cache
  4. device A and B are disconnected (e.g. device A goes offline)
  5. device A tries to read contents of file foobar

actual: can't read file, because blocks aren't in cache! would be nice: can read file, because blocks are prefetched

  • probably want to replace existing blocks, where they are in the LRU cache
  • probably only want to replace cached blocks
  • might want to add new block if file grew by one block and all other blocks are in cache

this gets into some interestingly hairy decisions about predicting the future, and also asynchronous network IO.

if another caching strategy (e.g. LRU-2Q) is ever implemented, that might also inform if blocks should be replaces (e.g. only replace if in older generation).

burkemw3 avatar Feb 19 '16 00:02 burkemw3