syncthing/lib/db
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/db: Add index to track locally needed files (#4958) 2018-06-02 15:08:32 +02:00
.gitignore Change DB label format (index folders, devices) 2016-01-03 19:32:40 +01:00
benchmark_test.go lib/db: Fix prefixed walks (fixes #4925) (#4940) 2018-05-17 09:26:40 +02:00
blockmap_test.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
blockmap.go lib/model: Verify request content against weak (and possibly strong) hash (#4767) 2018-05-05 10:24:44 +02:00
concurrency_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
debug.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
leveldb_dbinstance_updateschema.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
leveldb_dbinstance.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
leveldb_test.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
leveldb_transactions.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
leveldb.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
meta.go lib/db: Don't panic on negative counts (#4761) 2018-02-14 11:25:34 +01:00
namespaced_test.go lib/db: Fix test for Go 1.9's smarter time.Time values 2017-06-28 14:36:04 +02:00
namespaced.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
set_test.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
set.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
structs.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
structs.pb.go Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
structs.proto Add LocalFlags to FileInfo (#4952) 2018-06-24 09:50:18 +02:00
util_test.go lib/db: Add index to track locally needed files (#4958) 2018-06-02 15:08:32 +02:00