syncthing/lib/db
Jakob Borg d1d967f0cf lib/db: Keep folder meta data persistently in db (fixes #4400)
This keeps the data we need about sequence numbers and object counts
persistently in the database. The sizeTracker is expanded into a
metadataTracker than handled multiple folders, and the Counts struct is
made protobuf serializable. It gains a Sequence field to assist in
tracking that as well, and a collection of Counts become a CountsSet
(for serialization purposes).

The initial database scan is also a consistency check of the global
entries. This shouldn't strictly be necessary. Nonetheless I added a
created timestamp to the metadata and set a variable to compare against
that. When the time since the metadata creation is old enough, we drop
the metadata and rebuild from scratch like we used to, while also
consistency checking.

A new environment variable STCHECKDBEVERY can override this interval,
and for example be set to zero to force the check immediately.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4547
LGTM: imsodin
2017-12-14 09:51:17 +00:00
..
testdata lib/protocol, lib/discover, lib/db: Use protocol buffer serialization (fixes #3080) 2016-07-04 10:40:29 +00:00
.gitignore Change DB label format (index folders, devices) 2016-01-03 19:32:40 +01:00
benchmark_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
blockmap.go lib/db, lib/model: Always use reasonable sized batches (fixes #2250, fixes #4112) 2017-04-22 14:23:33 +00:00
blockmap_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01: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.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
leveldb_dbinstance.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
leveldb_test.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +01:00
leveldb_transactions.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
meta.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
namespaced.go all: Update license url to https (ref #3976) 2017-02-09 08:04:16 +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
set.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
set_test.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
structs.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
structs.pb.go lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00
structs.proto lib/db: Keep folder meta data persistently in db (fixes #4400) 2017-12-14 09:51:17 +00:00