Commit Graph

46 Commits

Author SHA1 Message Date
Olivier Goffart
48d3c8432e VFS: Do not overwrite existing files by placeholder
For issue #7557 and #7556

Note: this change the API of the VFS plugin, so the VFS plugin needs small
adaptations
2019-11-03 17:01:48 +01:00
Olivier Goffart
60d28c44be Test: Fix testsyncvirtualfiles test
Like previous commit, the failure was caused by two conflicting commits
2019-10-30 18:26:16 +01:00
Olivier Goffart
79e9168beb Fix build of tests.
Resulted from a conflict between two patches
2019-10-30 17:51:28 +01:00
Christian Kamm
16a8823e11 Vfs: Lots of tests and corrections for suffix edge cases
Avoid or deal with problems that happen when suffixed files exist on the
server or suffix and non-suffixed files exist locally.

See #7350, #7261.
2019-10-30 14:41:01 +01:00
Olivier Goffart
1597b2edc1 Tests: introduce ItemCompletedSpy to avoid a bit of code duplication 2019-10-07 22:36:55 +02:00
Christian Kamm
4fd9bdc4b4 Vfs: Remove old db record when dehydrating via rename
For #7338
2019-07-25 15:21:54 +02:00
Christian Kamm
d09c4fd2e8 Vfs: Ensure pins change with (de-)hydration
Previously an implicit hydration of a file in an online-only folder
would not change the pin state and cause a dehydration on the next
sync.
2019-07-24 16:16:39 +02:00
Christian Kamm
199163187a Vfs: Preserve pin state on hydration
For #7322 and #7323
2019-07-18 20:00:28 +02:00
Christian Kamm
75ddb8dd80 Vfs: Make test pass with different suffix #7279 2019-06-28 10:48:18 +02:00
Christian Kamm
6b89747a26 VfsSuffix: Wipe stale pin states #7273
Previously the pin states of deleted files stayed in the 'flags'
database and could be inadvertently reused when a new file with the same
name appeared. Now they are deleted.

To make this work right, the meaning of the 'path' column in the 'flags'
table was changed: Previously it never had the .owncloud file suffix.
Now it's the same as in metadata.path.

This takes the safe parts from #7274 for inclusion in 2.6. The more
elaborate database schema changes (why use 'path' the join the two
tables in the first place?) shall go into master.
2019-06-27 15:57:20 +02:00
Christian Kamm
02a9b16b0f Vfs: Move pin state if files move #7250
Previously renames of items didn't carry the pin state with them.
2019-06-23 10:23:37 +02:00
Christian Kamm
e653924e06 Vfs: Don't let new local files start out unpinned #7250
If one adds a new file to an online-only folder the previous behavior
was to upload the file in one sync and dehydrate it in the next. Now
these new files get set to Unspecified pin state, making them retain
their data.
2019-06-23 10:23:37 +02:00
Christian Kamm
9b01dbae4c Tests: fix vfs availability test case 2019-05-07 08:21:46 +02:00
Christian Kamm
96831247e2 Vfs: "free space" only shows when it has an effect #7143
To do this, introduce AllDehydrated availability and rename
SomeDehydrated to Mixed - it now guarantees there are also hydrated
items.
2019-04-23 09:21:17 +02:00
Christian Kamm
2b0f32c645 Vfs: Add 'availability', a simplified, user-facing pin state #7111
The idea is that the user's question is "is this folder's data available
offline?" and not "does this folder have AlwaysLocal pin state?".
The the answers to the two questions can differ: an always-local
folder can have subitems that are not always-local and are dehydrated.

The new availability enum intends to describe the answer to the user's
actual question and can be derived from pin states. If pin states aren't
stored in the database the way of calculating availability will depend
on the vfs plugin.
2019-04-09 12:52:30 +02:00
Christian Kamm
04268becd1 Vfs: Clear up relationship between _type and pin state
The pin state is a per-item attribute that has an effect on _type:
AlwaysLocal dehydrated files will be marked for hydration and OnlineOnly
hydrated files will be marked for dehydration.

Where exactly this effect materializes depends on how the pin states are
stored. If they're stored in the db (suffix) the dbEntry._type is
changed during the discovery.

If the pin state is stored in the filesystem, the localEntry._type must
be adjusted by the plugin's stat callback.

This patch makes pin states behave more consistently between plugins.
Previously with suffix-vfs pin states only had an effect on new remote
files. Now the effect of pinning or unpinning files or directories is as
documented and similar to other plugins.
2019-04-09 12:46:35 +02:00
Christian Kamm
83c30f7dc7 Vfs: Better handling and more tests for suffix file renames
Previously removing the vfs suffix of a file always triggered a
conflict. Now it may just cause a file download.

This was done because users expected symmetry in the rename actions and
renaming foo -> foo.owncloud already triggers the "make the file
virtual" action. Now foo.owncloud -> foo triggers the "download the
contents" action.
2019-04-09 10:09:34 +02:00
Christian Kamm
aca19c7a6d Vfs: Hydrating a virtual is SYNC not NEW #7101
Previously it'd be NEW(ItemTypeFile), but now it has changed to be
SYNC(ItemTypeVirtualFileDownload) which allows better classification.
2019-03-28 17:30:28 +01:00
Christian Kamm
ca7b4be189 Fix and test _file and _renameTarget
There was a bunch of inconsistency around whether _file was set to
_renameTarget or not. This is now never done, passing on more
information.
2019-03-28 17:30:19 +01:00
Christian Kamm
b181740b30 VFS: Unbreak behavior for rename+hydrate #7001
Users can rename a file *and* add/remove the vfs suffix at the same time
leading to very complex sync actions. This patch doesn't add support for
them, but adds tests and makes sure these cases do not cause unintened
behavior.

The rename will be propagated, but the users's hydrate/dehydrate request
will be ignored.
2019-03-21 11:13:16 +01:00
Christian Kamm
a627f373b1 Ensure local discovery on selective sync changes
As far as I'm aware local discovery can be skipped on folders that are
selective-sync blacklisted, so a local discovery is required when an
entry is removed from the blacklist.

Also rename
avoidReadFromDbOnNextSync() -> schedulePathForRemoteDiscovery()
since the old name might also imply it's not read from db in the local
discovery - which is not the case. Use Folder::
schedulePathForLocalDiscovery() for that.
2019-02-14 10:57:09 +01:00
Christian Kamm
f786ef1430 Vfs: Improve sync protocol entries for actions
Creating a new virtual file and replacing a file with a virtual one now
have their own text in the protocol, not just "Downloaded".

To do this, the SyncFileItem type is kept as
ItemTypeVirtualFileDehydration for these actions. Added new code to
ensure the type isn't written to the database.

While looking at this, I've also added documentation on SyncFileItem's
_file, _renameTarget, _originalFile and destination() because some of
the semantics weren't clear.
2019-02-11 13:35:14 +01:00
Christian Kamm
9b7eba0174 Vfs: Make dehydration a SYNC and not a NEW action
That change will be useful for the notifications. Previously the
dehydrated files were reported as "newly downloaded", now they're
reported as "updated".
2019-02-11 13:35:14 +01:00
Christian Kamm
30d7157eb8 Vfs suffix: Fix dehydration creating the wrong db entry 2019-02-11 13:35:14 +01:00
Christian Kamm
210f309e6e PinStates cleanup
- SyncJournalDB functions now behind internalPinStates() to avoid
accidental usage, when nearly everyone should go through Vfs.
- Rename Vfs::getPinState() to Vfs::pinState()
2019-02-11 13:35:14 +01:00
Christian Kamm
010abe4c82 Pin state updates
- unspecified and inherited are different
- move enum to header in common/
- access through Vfs instead of directly in Journal
2019-02-11 13:35:14 +01:00
Christian Kamm
90a8eaa949 vfs suffix: Ignore server files or synced files with the suffix #6953 2019-01-18 11:03:01 +01:00
Christian Kamm
df1723c9b2 vfs: Remove newFilesAreVirtual - use root PinState instead
This unifies how to deal with pin states.

Also enable reading a folders direct pin state vs its effective pin
state.
2019-01-07 10:09:03 +01:00
Christian Kamm
fac6ad354f vfs: Use PinState in sync algorithm #6815
New files are virtual if the file's pin state is OnlineOnly.
2018-12-19 14:04:24 +01:00
Christian Kamm
18ab3f5dcd vfs: Separate vfs availability from new-files-virtual
This helps support 2.5 settings where there are virtual files in the
tree but new files aren't created virtual.

It's also a prelude for #6815

There's currently no way of
- upgrading vfs plugins (a silent suffix->winvfs upgrade is attempted
  once only, when moving to master)
- disabling vfs capabilities outright
2018-11-26 13:02:48 +01:00
Christian Kamm
4f56366fd5 vfs: Ensure SyncOptions::_vfs is never null
- Create a VfsOff derived class
- Make it a shared pointer shared with Folder::_vfs
2018-11-26 13:02:48 +01:00
Christian Kamm
6d0f9a50ad vfs: Be more careful about Vfs instance ownership 2018-11-26 13:02:48 +01:00
Christian Kamm
59a114cd4d vfs: Fix plugin decision in wizards, sanitize loading 2018-11-26 13:02:48 +01:00
Christian Kamm
06928a4037 winvfs: initial work
Done by ckamm and dschmidt
2018-11-26 12:53:30 +01:00
Christian Kamm
07ce6a8399 Discovery: Add back virtual file instruction checks 2018-10-19 10:24:47 +02:00
Olivier Goffart
28f1c95b96 Merge remote-tracking branch 'origin/master' into new_discovery_algo
Conflicts:
	src/csync/csync_reconcile.cpp
	src/csync/csync_update.cpp
	src/libsync/syncengine.cpp
	src/libsync/syncengine.h

Note: csync changes from 5e442f588e
are not included and will be fixed separately
2018-10-04 11:23:19 +02:00
Christian Kamm
5e442f588e Virtual files: Renames propagate #6718 2018-09-26 16:39:41 +02:00
Olivier Goffart
597c28f316 Merge remote-tracking branch 'master' into new_discovery_algo 2018-08-21 11:22:38 +02:00
Olivier Goffart
d1e15b7802 Virtual Files: Set the mtime of the virtual file to that of the server
Note: When the server mtime is modified, the mtime of the file is not updated

Issue #6727
2018-08-19 21:11:59 +02:00
Christian Kamm
0b9049e6ff Virtual files: Renaming to virtual doesn't delete data #6718
Unfortunately to do this, the local update phase must write to the
database, creating a new side-effect and order dependency (local update
must run before remote update).
2018-08-17 14:27:09 +02:00
Olivier Goffart
33940c0fd1 Skip failing test
These tests are failling because now we consider that any files that ends
with .owncloud is a virtual file, regardless what the DB say.
2018-07-26 13:55:13 +02:00
Olivier Goffart
a299907c59 New discovery algorithm: Virtual files
The commented tests lines were implementation details
2018-07-17 13:35:07 +02:00
Olivier Goffart
1753ce651b Virtual Files: Allow to download a folder recursively from the socket API
Issue: #6466
2018-05-30 11:57:57 +02:00
Christian Kamm
3a7a6b0b9e Virtual files: Wipe virtual after download completes, not before
Otherwise a interrupted or unsuccessful download would mean that the
download-intend was forgotten. The next sync would reestablish the
virtual file instead.
2018-05-30 11:50:14 +02:00
Christian Kamm
252484e875 Virtual files: Only remove virtual file once on download
With thanks to @ogoffart for spotting the problem.
2018-05-30 10:39:49 +02:00
Christian Kamm
8f9f2b5462 Rename Placeholders to Virtual Files in code #6531 2018-05-23 09:57:00 +02:00