Commit cff725d
authored
Additions to Media de-duplication efforts (#210)
A little bit of clean up. Abstracting how the local path to the file is
resolved. Ensure consistency when removing media, that if there are
still references to the media that only the metadata is removed until it
is the last reference.
Resolving concerns about moving existing media by leaving it in place
and only new media is de-duplicated.
Stage incoming remote media into it's legacy file path until the sha256
can be discovered, and only after it is written to the database metadata
is it moved into it's new place. This specific set of steps works with
the file path resolving, so if the moving process is interrupted it will
still be usable.
Always provide `StorageProvider` classes with a consistent relative
"path". For a media id of `1234567890`, it would break down to
`12/34/567890`. Do not use the sha256 for this path. `StorageProvider`s
are provided the `FileInfo` class as well, if they want to do media
de-dupe they can get it from there. Should we provide an enhancement to
the bundled `StorageProvider` to allow for this capability?
Depends on #1559 files changed
Lines changed: 605 additions & 299 deletions
File tree
- .github/workflows
- rust/src
- synapse
- media
- storage/databases/main
- tests
- media
- rest/client
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
124 | 126 | | |
125 | 127 | | |
126 | 128 | | |
| 129 | + | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
| |||
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
164 | | - | |
| 167 | + | |
165 | 168 | | |
166 | 169 | | |
167 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| |||
0 commit comments