syncthing/lib/model
Jakob Borg b1b68ceedb
Add LocalFlags to FileInfo (#4952)
We have the invalid bit to indicate that a file isn't good. That's enough for remote devices. For ourselves, it would be good to know sometimes why the file isn't good - because it's an unsupported type, because it matches an ignore pattern, or because we detected the data is bad and we need to rescan it.

Or, and this is the main future reason for the PR, because it's a change detected on a receive only device. We will want something like the invalid flag for those changes, but marking them as invalid today means the scanner will rehash them. Hence something more fine grained is required.

This introduces a LocalFlags fields to the FileInfo where we can stash things that we care about locally. For example,

    FlagLocalUnsupported = 1 << 0 // The kind is unsupported, e.g. symlinks on Windows
    FlagLocalIgnored     = 1 << 1 // Matches local ignore patterns
    FlagLocalMustRescan  = 1 << 2 // Doesn't match content on disk, must be rechecked fully

The LocalFlags fields isn't sent over the wire; instead the Invalid attribute is calculated based on the flags at index sending time. It's on the FileInfo anyway because that's what we serialize to database etc.

The actual Invalid flag should after this just be considered when building the global state and figuring out availability for remote devices. It is not used for local file index entries.
2018-06-24 09:50:18 +02:00
..
testdata lib/fs, lib/model: Make tests caching compatible (fixes #4749) (#4804) 2018-03-13 14:03:10 +01:00
debug.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
deviceactivity.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
deviceactivity_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
devicedownloadstate.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
devicedownloadstate_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
doc.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
folder.go lib/model: Don't set watch error on folder creation (fixes 5005) (#5006) 2018-06-15 23:33:23 +01:00
folder_sendonly.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
folder_sendrecv.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
folder_sendrecv_test.go lib/model: Also wait for ItemFinished in TestDeregister (#4951) 2018-05-14 20:01:35 +01:00
folderstate.go lib/model, lib/config: Refactor folder health/error handling (fixes #4445, fixes #4451) 2017-10-24 07:58:55 +00:00
model.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
model_test.go lib/model: Don't panic when rechecking file (fixes #5002) (#5003) 2018-06-13 18:07:52 +01:00
progressemitter.go all: Correct various typos 2017-02-25 08:12:13 +00:00
progressemitter_test.go lib/fs, lib/model: Make tests caching compatible (fixes #4749) (#4804) 2018-03-13 14:03:10 +01:00
queue.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
queue_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
requests_test.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
sentdownloadstate.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
sharedpullerstate.go all: Implement variable sized blocks (fixes #4807) 2018-04-16 19:08:50 +01:00
sharedpullerstate_test.go lib/model: Remove dead code (*sharedPullerState).sourceFile 2017-12-12 11:30:47 +01:00
util.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00