Specification » History » Version 3

Alexander Blum, 12/10/2019 07:15 PM

1 1 Alexander Blum
{{toc}}
2 1 Alexander Blum
3 1 Alexander Blum
# General
4 1 Alexander Blum
5 1 Alexander Blum
## Object Processing
6 1 Alexander Blum
7 1 Alexander Blum
### Commits
8 1 Alexander Blum
9 1 Alexander Blum
* Web users provide the system with metadata on objects as information basis for the distribution of money
10 1 Alexander Blum
* The system needs to balance the need of web users to change the metadata and the stability of the information basis
11 1 Alexander Blum
* Artists, Releases, Creations have to be committed by the web users as a conscious act
12 1 Alexander Blum
    * No data is published before a commit
13 1 Alexander Blum
    * Web users are able to distinguish public/private fields after a commit
14 1 Alexander Blum
    * A commit of a set of objects (all fields, public fields) is saved as rendered text for evidence
15 1 Alexander Blum
* Creations do not need to have content to be committable
16 1 Alexander Blum
* Content with a relation to a Creation is autocommitted, when the creation is committed
17 1 Alexander Blum
* Before a commit, web users may edit the object freely
18 1 Alexander Blum
* Committing an object implies committing all objects down the hierarchy (see [[Workflows#Licenser-Cascades|Cascades]])
19 1 Alexander Blum
* After a commit, web users may
20 1 Alexander Blum
    * edit only data not relevant for the distribution or object to frequent changes:
21 1 Alexander Blum
        * adding/removing members of an Artist
22 1 Alexander Blum
        * adding a Release to a Creation
23 1 Alexander Blum
        * changing Release metadata
24 1 Alexander Blum
    * trigger a dispute request for changing relevant data:
25 1 Alexander Blum
        * deleting an object (implies creation of duplicate for references)
26 1 Alexander Blum
        * adding/removing a contributor to a Creation
27 1 Alexander Blum
        * adding/removing a original/derivative Creation
28 1 Alexander Blum
        * adding/removing licenses to Releases of Creations
29 1 Alexander Blum
        * adding/removing the Content assigned to a Creation
30 1 Alexander Blum
        * removing a Release from a Creation
31 1 Alexander Blum
* After a commit, administrators may
32 1 Alexander Blum
    * revise the object(s)
33 1 Alexander Blum
    * reject the object(s)
34 1 Alexander Blum
* A successful claim dispute (see [[Workflows#Commit]]) causes the object to be uncommitted
35 1 Alexander Blum
* Uncommitted objects should be recommitted again as soon as possible by the web user
36 1 Alexander Blum
    * if the artist name or creation title is changed on recommit, all admins of referencing objects are informed via email/webinterface
37 1 Alexander Blum
    * if a referenced object is deleted before recommit, a duplicate for all references is created and referenced instead
38 1 Alexander Blum
* Created / Uncommitted objects
39 1 Alexander Blum
    * are promoted on the web user dashboard
40 1 Alexander Blum
    * excluded from searches (via add/list/etc), except
41 1 Alexander Blum
        * web users can add own uncommitted objects to other own uncommitted objects
42 1 Alexander Blum
        * web users can see but not add own uncommitted objects to other committed objects
43 1 Alexander Blum
44 1 Alexander Blum
### Disputes
45 1 Alexander Blum
46 1 Alexander Blum
* A dispute is the process of mediation in a conflict between web users
47 1 Alexander Blum
* A dispute has a
48 1 Alexander Blum
    * code: Sequence
49 1 Alexander Blum
    * state: Selection (requested, assigned, resolved)
50 1 Alexander Blum
    * case: Selection (list of usecases?)
51 1 Alexander Blum
    * object: Reference (to the disputed objects)
52 1 Alexander Blum
    * assignee: User
53 1 Alexander Blum
    * request_party: Party
54 1 Alexander Blum
    * request_text: Text (user statement)
55 1 Alexander Blum
    * request_time: DateTime
56 1 Alexander Blum
    * resolved_time: DateTime
57 1 Alexander Blum
    * comments: Comment (many comments by administrators)
58 1 Alexander Blum
* A dispute comment has a
59 1 Alexander Blum
    * dispute: Dispute
60 1 Alexander Blum
    * text: Text
61 1 Alexander Blum
    * time: DateTime
62 1 Alexander Blum
* A dispute may be triggered by a web user on several occasions
63 1 Alexander Blum
    * The web user [[Specification#Claims|claims]] ownership of an already claimed object
64 1 Alexander Blum
    * The web user claims authorship of a Content marked as a duplicate
65 1 Alexander Blum
    * The web user requests a change/deletion of [[Specification#Commits|commited]] content
66 1 Alexander Blum
* A dispute can be requested, assigned and resolved (see [[Workflows#Dispute]])
67 1 Alexander Blum
* A dispute is requested via a dispute form including
68 1 Alexander Blum
    * The disputed object
69 1 Alexander Blum
    * The issue category
70 1 Alexander Blum
    * The user motivation
71 1 Alexander Blum
* A dispute is handled by an assignee
72 1 Alexander Blum
* The assignee can add many comments
73 1 Alexander Blum
* The assignee can mark the dispute as resolved
74 1 Alexander Blum
75 1 Alexander Blum
76 1 Alexander Blum
# Licensing
77 1 Alexander Blum
78 1 Alexander Blum
## API
79 1 Alexander Blum
80 1 Alexander Blum
# Repertoire
81 1 Alexander Blum
82 2 Alexander Blum
## Rights Management
83 1 Alexander Blum
84 3 Alexander Blum
* A rightsholder
85 2 Alexander Blum
    * must hold a right
86 2 Alexander Blum
        * Copyright
87 2 Alexander Blum
        * Ancillary Copyright
88 2 Alexander Blum
    * must have an object to which the right belongs
89 2 Alexander Blum
        * Creation
90 2 Alexander Blum
        * Release
91 2 Alexander Blum
    * must have a contribution depending on the object and right
92 2 Alexander Blum
        * Creation
93 2 Alexander Blum
            * Copyright
94 2 Alexander Blum
                * Lyrics
95 2 Alexander Blum
                * Composition
96 2 Alexander Blum
            * Ancillary Copyright:
97 2 Alexander Blum
                * Instrument
98 2 Alexander Blum
                * Production
99 2 Alexander Blum
                * Mixing
100 2 Alexander Blum
                * Mastering
101 2 Alexander Blum
        * Release
102 2 Alexander Blum
            * Copyright
103 2 Alexander Blum
                * Artwork
104 2 Alexander Blum
                * Text
105 2 Alexander Blum
                * Layout
106 2 Alexander Blum
            * Ancillary Copyright
107 2 Alexander Blum
                * Production
108 2 Alexander Blum
                * Mixing
109 2 Alexander Blum
                * Mastering
110 2 Alexander Blum
    * may have a start and end date
111 2 Alexander Blum
    * may be restricted to a territory
112 2 Alexander Blum
    * may have a successor
113 2 Alexander Blum
    * may be represented by a collecting society
114 1 Alexander Blum
    * may have a list of instruments for Creation -> Ancillary Copyright -> Instrument
115 3 Alexander Blum
* Rightsholder subjects for creations and releases are Artists
116 1 Alexander Blum
117 1 Alexander Blum
## Object processing
118 1 Alexander Blum
119 1 Alexander Blum
### Claims
120 1 Alexander Blum
121 1 Alexander Blum
* Artist, Releases, and Creations are unclaimed, offered or claimed
122 1 Alexander Blum
* Unclaimed objects are objects, which don't belong to a web user
123 1 Alexander Blum
* Offered objects are objects, which might belong to a web user and are offered to be claimed by the web user (e.g. on registration)
124 1 Alexander Blum
* Claimed objects are objects, which "belong" to at least one web user
125 1 Alexander Blum
* Web users can (see [[Workflows#Claim]]) claim
126 1 Alexander Blum
    * unclaimed and offered objects in general
127 1 Alexander Blum
    * a solo artist for the current web user
128 1 Alexander Blum
    * a group artist for a solo artist
129 1 Alexander Blum
    * a compilation release for a solo artist (role: producer)
130 1 Alexander Blum
    * a split/artist release for an artist
131 1 Alexander Blum
    * a creation for an artist
132 1 Alexander Blum
* A claim implies a request for admin rights, where applicable
133 1 Alexander Blum
* Revised objects are visually promoted on the object list/details
134 1 Alexander Blum
* Unclaiming/Claiming/Revising an object implies unclaiming/claiming/revising all objects down the hierarchy (see [[Workflows#Creative-Cascades|Cascades]])
135 1 Alexander Blum
* Claiming an unclaimed object results in an uncommitted object
136 1 Alexander Blum
* Claiming a claimed object
137 1 Alexander Blum
    * results in a [[Specification#Disputes|dispute]]
138 1 Alexander Blum
    * may result in in an uncommitted object, if the disputing party proves to be right
139 1 Alexander Blum
140 1 Alexander Blum
### Foreign objects
141 1 Alexander Blum
142 1 Alexander Blum
* During object creation, a web user may create several new, [[Specification#Claims|unclaimed]] foreign objects
143 1 Alexander Blum
* When a web user creates a new Artist, he may create many member Artists specified by a name and an email
144 1 Alexander Blum
* When a web user creates a new Creation, he may create
145 1 Alexander Blum
    * many contributor Artists specified by group (yes/no), a name and an email
146 1 Alexander Blum
    * many original/derivative Creations specified by the creation and the artist name, resulting in
147 1 Alexander Blum
        * a new/referenced Artist object: artist name
148 1 Alexander Blum
        * a new Creation object: Artist
149 1 Alexander Blum
    * many track Creations specified by the creation and the artist name, resulting in
150 1 Alexander Blum
        * a new/referenced Artist object: artist name
151 1 Alexander Blum
        * a new Creation object: Artist
152 1 Alexander Blum
* Foreign objects are auto [[Specification#Commits|commited]]
153 1 Alexander Blum
* Foreign objects may be added by others
154 1 Alexander Blum
    * resulting in a duplicate for information separation
155 1 Alexander Blum
    * referencing the duplicated foreign object for deduplication
156 1 Alexander Blum
* Foreign objects are editable
157 1 Alexander Blum
    * by the web user, which created the foreign object, if
158 1 Alexander Blum
        * the object was created by the web user
159 1 Alexander Blum
        * the object is not [[Specification#Claims|claimed]]
160 1 Alexander Blum
        * the object was not part of a distribution, yet
161 1 Alexander Blum
    * by the object admin of the object, which the foreign object was created for
162 1 Alexander Blum
163 1 Alexander Blum
## File Processing
164 1 Alexander Blum
165 1 Alexander Blum
### Intermediate storage for archive
166 1 Alexander Blum
167 1 Alexander Blum
* Files are stored on an intermediate file server
168 1 Alexander Blum
* For every stage of a file there is a corresponding folder `STAGE`
169 1 Alexander Blum
* For each change of processing state, all files are moved into the next `STAGE` folder
170 1 Alexander Blum
* For each folder `STAGE` there is a folder per `USER`
171 1 Alexander Blum
    * Folderstructure for optimized filesystemaccess
172 1 Alexander Blum
    * Semantic information for manual administrative interventions
173 1 Alexander Blum
* The filenames of the files are
174 1 Alexander Blum
    * the `HASH` of the filename for temporary uploads
175 1 Alexander Blum
    * the `UUID` of the content in the database for all other stages
176 1 Alexander Blum
* For each file `[UUID|HASH]` there is a file `[UUID|HASH].checksums`
177 1 Alexander Blum
    * Content: Checksums for each single upload chunk
178 1 Alexander Blum
    * Format: CSV (begin, end, algorithm, checksum)
179 1 Alexander Blum
* For each file `[UUID|HASH]` there is a file `UUID.checksum`
180 1 Alexander Blum
    * Content: Checksum of the whole file
181 1 Alexander Blum
    * Format: Plain text
182 1 Alexander Blum
* The full syntax for a file is
183 1 Alexander Blum
    * `./STAGE/USER/UUID(.checksum(s))`
184 1 Alexander Blum
    * `./temporary/USER/HASH(.checksum(s))`
185 1 Alexander Blum
* Examples of file paths
186 1 Alexander Blum
    * `./temporary/4/82d5582443e9f8d35d3ec798662255e46e9e8138c290b626a74a3bee9382d430`
187 1 Alexander Blum
    * `./temporary/4/82d5582443e9f8d35d3ec798662255e46e9e8138c290b626a74a3bee9382d430.checksums`
188 1 Alexander Blum
    * `./uploaded/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
189 1 Alexander Blum
    * `./uploaded/4/35f0c169-6594-4bf3-b285-451d2aa8c61e.checksums`
190 1 Alexander Blum
    * `./previewed/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
191 1 Alexander Blum
    * `./checksummed/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
192 1 Alexander Blum
    * `./checksummed/4/35f0c169-6594-4bf3-b285-451d2aa8c61e.checksum`
193 1 Alexander Blum
    * `./checksummed/4/35f0c169-6594-4bf3-b285-451d2aa8c61e.checksums`
194 1 Alexander Blum
    * `./fingerprinted/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
195 1 Alexander Blum
    * `./dropped/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
196 1 Alexander Blum
    * `./rejected/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
197 1 Alexander Blum
198 1 Alexander Blum
199 1 Alexander Blum
### Permanent storage for user content
200 1 Alexander Blum
201 1 Alexander Blum
* User content is stored on a permanent file server
202 1 Alexander Blum
* For every content type of a file there is a corresponding folder `CONTENTYPE` (e.g. 'previews')
203 1 Alexander Blum
* For each folder `CONTENTYPE` there is a folder per `USER`
204 1 Alexander Blum
    * Folderstructure for optimized filesystemaccess
205 1 Alexander Blum
    * Semantic information for manual administrative interventions
206 1 Alexander Blum
* The filenames of the files are
207 1 Alexander Blum
    * the `UUID` of the content in the database
208 1 Alexander Blum
* The full syntax for a file is
209 1 Alexander Blum
    * `./CONTENTTYPE/USER/UUID`
210 1 Alexander Blum
* Examples of file paths
211 1 Alexander Blum
    * `./previews/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
212 1 Alexander Blum
    * `./excerpts/4/35f0c169-6594-4bf3-b285-451d2aa8c61e`
213 1 Alexander Blum
214 1 Alexander Blum
### Stages
215 1 Alexander Blum
216 1 Alexander Blum
* For an overview of the workflow, see [[Workflows#File-Processing|Workflow]]
217 1 Alexander Blum
* Each stage of file processing results in a corresponding processing state
218 1 Alexander Blum
    1. Upload *(uploaded)*
219 1 Alexander Blum
    2. Process
220 1 Alexander Blum
        * Preview *(previewed)*
221 1 Alexander Blum
        * Checksum *(checksummed)*
222 1 Alexander Blum
        * Fingerprint *(fingerprinted)*
223 1 Alexander Blum
    5. Drop *(dropped)*
224 1 Alexander Blum
    6. Archive *(archived)*
225 1 Alexander Blum
* There is a special state for user requested deletions *(tobedeleted)*
226 1 Alexander Blum
* Before a file is being processed at any stage, a file <UUID>.lock will be created to signal other processes to skip the file. The lockfile will be deleted after the file <UUID> has been moved to the next stage folder.
227 1 Alexander Blum
228 1 Alexander Blum
#### Upload a file
229 1 Alexander Blum
230 1 Alexander Blum
* Users are allowed to upload content only, if it belongs to them
231 1 Alexander Blum
* Upload of a file in chunks
232 1 Alexander Blum
    * The chunk size is 1MiB (1024*1024 Byte)
233 1 Alexander Blum
    * The chunk position is given by the header `Content-Range` (chunk start, chunk end, total size)
234 1 Alexander Blum
    * A HASH of the user given filename is used as temporary filename
235 1 Alexander Blum
    * The file is stored in `./storage/temporary/USER/HASH`
236 1 Alexander Blum
* For each uploaded chunk
237 1 Alexander Blum
    * A checksum of the chunk is calculated, while the chunk is still in RAM
238 1 Alexander Blum
    * The checksum is appended to `./storage/temporary/USER/HASH.checksums` (CSV: begin, end, algorithm, checksum)
239 1 Alexander Blum
    * The database is queried for a duplicate of the checksum for early abuse detection
240 1 Alexander Blum
        * The chunk checksum collisions are tracked in the user session
241 1 Alexander Blum
        * Certain checksums are whitelisted (e.g. silence in different formats with/without headers)
242 1 Alexander Blum
        * Above a configurable threshold (e.g. 150), the user upload is restricted temporarily
243 1 Alexander Blum
        * The threshold violations are tracked in the database
244 1 Alexander Blum
    * The chunk is appended to `./storage/temporary/USER/HASH`
245 1 Alexander Blum
* When the upload is finished
246 1 Alexander Blum
    * A Uuid is generated
247 1 Alexander Blum
    * If the validation of the fileextension or mimetype fails, further processing is aborted
248 1 Alexander Blum
        * The files are moved to `./storage/rejected/USER/UUID(.checksums)`
249 1 Alexander Blum
        * The Content is saved to the database (processing state: rejected, rejection reason: format_error, path)
250 1 Alexander Blum
    * The files are moved to `./storage/uploaded/USER/UUID(.checksums)`
251 1 Alexander Blum
    * The Content is saved to the database (processing state: uploaded, path, storage_hostname)
252 1 Alexander Blum
    * The Checksums are saved to the database
253 1 Alexander Blum
254 1 Alexander Blum
#### Create a preview
255 1 Alexander Blum
256 1 Alexander Blum
* For each file in `./storage/uploaded`
257 1 Alexander Blum
    * The file is locked during processing
258 1 Alexander Blum
    * If the associated Content (processing state, processing hostname, storage hostname) is not valid, further processing is aborted
259 1 Alexander Blum
        * The files are moved to `./storage/unknown/(USER/)UUID(.checksums)`
260 1 Alexander Blum
        * The Content is updated, if possible (processing state: unkown, path)
261 1 Alexander Blum
    * An excerpt for analysis and statistics is taken and stored in `./content/excerpt/UUID[1]/UUID[2]/UUID`
262 1 Alexander Blum
        * Lenght: 60 seconds out of the middle of the file
263 1 Alexander Blum
        * Quality: Minimum for fingerprint recognition (11025 Hz, 16 bit, mono)
264 1 Alexander Blum
    * A preview is created and stored in `./content/previews/UUID[1]/UUID[2]/UUID`
265 1 Alexander Blum
        * Quality: Minimum for acceptable user experience (12bit, mono, 16kHz, ogg)
266 1 Alexander Blum
        * Configuration: fade in, fade out, segment interval, segment length, segment crossfade
267 1 Alexander Blum
    * If preview or excerpt creation fails, further processing is aborted
268 1 Alexander Blum
        * The files are moved to `./storage/rejected/USER/UUID(.checksums)`
269 1 Alexander Blum
        * The Content is rejected (rejection reason: format_error, path)
270 1 Alexander Blum
    * The files are moved to `./storage/previewed/USER/UUID(.checksums)`
271 1 Alexander Blum
    * The audio properties are saved to the database (length, channels, sample rate, sample width)
272 1 Alexander Blum
    * The Content is updated (processing state: previewed, path)
273 1 Alexander Blum
274 1 Alexander Blum
#### Calculate a checksum
275 1 Alexander Blum
276 1 Alexander Blum
* For each file in `./storage/previewed`
277 1 Alexander Blum
    * The file is locked during processing
278 1 Alexander Blum
    * If the associated Content (processing state, processing hostname, storage hostname) is not valid, further processing is aborted
279 1 Alexander Blum
        * The files are moved to `./storage/unknown/(USER/)UUID(.checksums)`
280 1 Alexander Blum
        * The Content is updated, if possible (processing state: unkown, path)
281 1 Alexander Blum
    * Checksums for each chunk of 1MiB (1024*1024 Byte) are calculated and saved to the database, if not present
282 1 Alexander Blum
    * A checksum for the whole file is calculated and stored in `./storage/previewed/USER/UUID.checksum`
283 1 Alexander Blum
    * If the checksum is already present in the database, further processing is aborted
284 1 Alexander Blum
        * The preview and excerpt is deleted
285 1 Alexander Blum
        * The files are moved to `./storage/rejected/USER/UUID(.checksum(s))`
286 1 Alexander Blum
        * The Content is rejected (rejection reason: checksum_collision, duplicate of: Content, path)
287 1 Alexander Blum
    * The files are moved to `./storage/checksummed/USER/UUID(.checksum(s))`
288 1 Alexander Blum
    * The Checksum is saved to the database
289 1 Alexander Blum
    * The Content is updated (processing state: checksummed, path)
290 1 Alexander Blum
291 1 Alexander Blum
#### Calculate a fingerprint
292 1 Alexander Blum
293 1 Alexander Blum
* For each file in `./storage/checksummed`
294 1 Alexander Blum
    * The file is locked during processing
295 1 Alexander Blum
    * If the associated Content (processing state, processing hostname, storage hostname) is not valid, further processing is aborted
296 1 Alexander Blum
        * The files are moved to `./storage/unknown/(USER/)UUID(.checksums)`
297 1 Alexander Blum
        * The Content is updated, if possible (processing state: unkown, path)
298 1 Alexander Blum
    * The fingerprint is created
299 1 Alexander Blum
    * If the fingerprint is already present in the database, further processing is aborted
300 1 Alexander Blum
        * The preview and excerpt is deleted
301 1 Alexander Blum
        * The files are moved to `./storage/rejected/USER/UUID(.checksum(s))`
302 1 Alexander Blum
        * The Content is rejected (rejection reason: fingerprint_collision, duplicate of: Content, path)
303 1 Alexander Blum
    * The fingerprint is ingested into the database (primary key: Content Uuid)
304 1 Alexander Blum
    * A FingerprintLog is saved to the database (timestamp, user, algorithm, version)
305 1 Alexander Blum
    * The files are moved to `./storage/fingerprinted/USER/UUID(.checksum(s))`
306 1 Alexander Blum
    * The Content is updated (processing state: fingerprinted, path)
307 1 Alexander Blum
308 1 Alexander Blum
#### Drop a file
309 1 Alexander Blum
310 1 Alexander Blum
* For each file in `./storage/fingerprinted`
311 1 Alexander Blum
    * The file is locked during processing
312 1 Alexander Blum
    * If the associated Content (processing state, processing hostname, storage hostname) is not valid, further processing is aborted
313 1 Alexander Blum
        * The files are moved to `./storage/unknown/(USER/)UUID(.checksums)`
314 1 Alexander Blum
        * The Content is updated, if possible (processing state: unkown, path)
315 1 Alexander Blum
    * The files are moved to `./storage/dropped/USER/UUID(.checksum(s))`
316 1 Alexander Blum
    * The Content is updated (processing state: dropped, path)
317 1 Alexander Blum
318 1 Alexander Blum
#### Archive a file
319 1 Alexander Blum
320 1 Alexander Blum
* For further details, see
321 1 Alexander Blum
    * [[Specification#Archiving-of-the-files|Archiving of the files]]
322 1 Alexander Blum
    * [[Specification#Orchestration-of-the-archiving|Orchestration of the archiving]]
323 1 Alexander Blum
* For each file in `./storage/dropped`
324 1 Alexander Blum
    * The file is locked during processing
325 1 Alexander Blum
    * If the associated Content (processing state, processing hostname, storage hostname) is not valid, further processing is aborted
326 1 Alexander Blum
        * The files are moved to `./storage/unknown/(USER/)UUID(.checksum(s))`
327 1 Alexander Blum
        * The Content is updated, if possible (processing state: unkown)
328 1 Alexander Blum
    * The files are moved to `./storage/dropped.closed/UUID(.checksum(s))`
329 1 Alexander Blum
    * The Storehouse target `LOCATION`s are copied from `./storage/targets/` to `./storage/dropped.closed.targets/`
330 1 Alexander Blum
    * Until there is no `LOCATION` in `./storage/dropped.closed.targets/` left
331 1 Alexander Blum
        * Until the checksums of the whole files are valid on the target machine
332 1 Alexander Blum
            * The files `UUID(.checksum(s))` in `./storage/dropped.closed/` are copied to `LOCATION:./UUID[1]/UUID[2]/`
333 1 Alexander Blum
        * The target location `./storage/dropped.closed.targets/LOCATION` is deleted
334 1 Alexander Blum
    * The target location folder `./storage/dropped.closed.targets/` is deleted
335 1 Alexander Blum
    * The Content is updated (processing state: archived, archive: Archive, path)
336 1 Alexander Blum
337 1 Alexander Blum
#### Delete a file
338 1 Alexander Blum
339 1 Alexander Blum
* A user may request the deletion of uncommited Content
340 1 Alexander Blum
* A corresponding files might be only deleted, if the content is in the state 'uploaded' or 'rejected'
341 1 Alexander Blum
* Further the request for the deletion needs to trigger the deletion of
342 1 Alexander Blum
     * the Content object
343 1 Alexander Blum
     * the preview and excerpt file
344 1 Alexander Blum
     * the entry in the echoprint server referencing the deleted Content object (maybe decentralized)
345 1 Alexander Blum
346 1 Alexander Blum
## Archiving
347 1 Alexander Blum
348 1 Alexander Blum
### Objects
349 1 Alexander Blum
350 1 Alexander Blum
#### Archiving
351 1 Alexander Blum
352 1 Alexander Blum
* The archiving process is coordinated via objects in the Database shown here [[Databasemodels#Archiving|as diagram]]
353 1 Alexander Blum
    * Physical: [[Specification#Storehouse|Storehouse]], [[Specification#Harddisk|Harddisk]], [[Specification#Filesystem|Filesystem]], [[Specification#Content|Content]]
354 1 Alexander Blum
    * Logical: [[Specification#HarddiskLabel|HarddiskLabel]], [[Specification#FilesystemLabel|FilesystemLabel]]
355 1 Alexander Blum
    * Integrity: [[Specification#Checksum|Checksum]], [[Specification#HarddiskTest|HarddiskTest]]
356 1 Alexander Blum
* The archiving objects are administered via tryton client and [[Scripts]]
357 1 Alexander Blum
358 1 Alexander Blum
#### Storehouse
359 1 Alexander Blum
360 1 Alexander Blum
Physical storage location
361 1 Alexander Blum
362 1 Alexander Blum
* has a code
363 1 Alexander Blum
* has an admin user
364 1 Alexander Blum
* may have a detailed description
365 1 Alexander Blum
* may have many Harddisks
366 1 Alexander Blum
367 1 Alexander Blum
#### Harddisk
368 1 Alexander Blum
369 1 Alexander Blum
Physical harddisks
370 1 Alexander Blum
371 1 Alexander Blum
* has uuids (host, harddisk)
372 1 Alexander Blum
* has checksums (harddisk)
373 1 Alexander Blum
* has a HarddiskLabel
374 1 Alexander Blum
* has a Storehouse
375 1 Alexander Blum
* has a version (for Harddisks with the same HarddiskLabel per Storehouse)
376 1 Alexander Blum
* has a closed state
377 1 Alexander Blum
* has a on-/offline state
378 1 Alexander Blum
* has an usage state
379 1 Alexander Blum
* has a creator (tryton user)
380 1 Alexander Blum
* has a function to generate a label sticker
381 1 Alexander Blum
* may have a local position (e.g. "Shelf1")
382 1 Alexander Blum
* may have many Filesystems
383 1 Alexander Blum
* may have many HarddiskTests
384 1 Alexander Blum
* may have a health state (result of the tests)
385 1 Alexander Blum
386 1 Alexander Blum
#### Filesystem
387 1 Alexander Blum
388 1 Alexander Blum
Filesystems on a harddisk
389 1 Alexander Blum
390 1 Alexander Blum
* has uuids (partition, raid, raid sub, crypto, lvm, filesystem)
391 1 Alexander Blum
* has checksums (partition, raid, raid sub, crypto, lvm, filesystem)
392 1 Alexander Blum
* has an FilesystemLabel
393 1 Alexander Blum
* has a Harddisk
394 1 Alexander Blum
* has a closed state
395 1 Alexander Blum
* has partitioning information (partition number)
396 1 Alexander Blum
* has raid information (raid type, raid number, raid total)
397 1 Alexander Blum
398 1 Alexander Blum
#### Content
399 1 Alexander Blum
400 1 Alexander Blum
Contents on a filesystem
401 1 Alexander Blum
402 1 Alexander Blum
* has a file
403 1 Alexander Blum
* may have one FilesystemLabel
404 1 Alexander Blum
405 1 Alexander Blum
#### HarddiskLabel
406 1 Alexander Blum
407 1 Alexander Blum
Label for Harddisks containing the same Filesystems
408 1 Alexander Blum
409 1 Alexander Blum
* has a code
410 1 Alexander Blum
* may have many Harddisks
411 1 Alexander Blum
412 1 Alexander Blum
#### FilesystemLabel
413 1 Alexander Blum
414 1 Alexander Blum
Label for Filesystems containing the same Contents
415 1 Alexander Blum
416 1 Alexander Blum
* has a code
417 1 Alexander Blum
* may have many Filesystems
418 1 Alexander Blum
* may have many Contents
419 1 Alexander Blum
420 1 Alexander Blum
#### Checksum
421 1 Alexander Blum
422 1 Alexander Blum
Checksum, e.g. sha256
423 1 Alexander Blum
424 1 Alexander Blum
* has a timestamp
425 1 Alexander Blum
* has a begin (first Byte)
426 1 Alexander Blum
* has an end (last Byte)
427 1 Alexander Blum
* has an algorithm
428 1 Alexander Blum
429 1 Alexander Blum
#### HarddiskTest
430 1 Alexander Blum
431 1 Alexander Blum
Integrity tests of harddisks
432 1 Alexander Blum
433 1 Alexander Blum
* has a timestamp
434 1 Alexander Blum
* has a user, which performed the test
435 1 Alexander Blum
* has a health state (sane + error for each checksum of Harddisk and Filesystem)
436 1 Alexander Blum
437 1 Alexander Blum
### Identification with uuids
438 1 Alexander Blum
439 1 Alexander Blum
* A uuid is a Universally Unique Identifier
440 1 Alexander Blum
* Harddisks, Filesystems and Content are identified with uuids
441 1 Alexander Blum
* A Harddisk is identified with a combination of the uuids
442 1 Alexander Blum
    * Host
443 1 Alexander Blum
    * Harddisk
444 1 Alexander Blum
* A Filesystem is identified with with a combination of the uuids
445 1 Alexander Blum
    * Partition
446 1 Alexander Blum
    * Raid
447 1 Alexander Blum
    * Raid Sub
448 1 Alexander Blum
    * Crypto
449 1 Alexander Blum
    * LVM
450 1 Alexander Blum
    * Filesystem
451 1 Alexander Blum
* The uuids of a Harddisk and a contained Filesystem are strictly hierarchical:
452 1 Alexander Blum
    * Host > Harddisk > Partition > Raid > Raid Sub > Crypto > LVM > Filesystem
453 1 Alexander Blum
* A Content is identified with exactly one uuid
454 1 Alexander Blum
455 1 Alexander Blum
### Integrity tests with checksums
456 1 Alexander Blum
457 1 Alexander Blum
* When a Harddisk is finalized, the follwing Checksums are saved into the database
458 1 Alexander Blum
    * Checksum of the Harddisk: Harddisk
459 1 Alexander Blum
    * Checksums of the Filesystem: Partition, Raid, Raid Sub, Crypto, LVM, Filesystem
460 1 Alexander Blum
* For each Content the following Checksums are saved to database
461 1 Alexander Blum
    * Checksum for the whole file
462 1 Alexander Blum
    * Checksums for each upload chunk
463 1 Alexander Blum
* All checksums are additionally saved on the harddisk as second indepentend source
464 1 Alexander Blum
    * Harddisk/Filesystem: on a metadata partition
465 1 Alexander Blum
    * File/Chunks: on the filesystem
466 1 Alexander Blum
* A checksum of the metadata partition is saved only on the harddisk
467 1 Alexander Blum
* Regularly schedulled (e.g. biannual) integrity tests ensure the logterm integrity of all Harddisks
468 1 Alexander Blum
    * For each test
469 1 Alexander Blum
        * Check of uuids
470 1 Alexander Blum
        * Check of checksum of metadata partition
471 1 Alexander Blum
        * Activation of crypto and raid
472 1 Alexander Blum
        * Check of checksums of filesystems /dev/disk/by-uuid/...
473 1 Alexander Blum
        * On error:
474 1 Alexander Blum
            * Feedback Admin
475 1 Alexander Blum
            * Write HarddiskTest (state: error_filesystem)
476 1 Alexander Blum
            * Check of Checksumms of all files
477 1 Alexander Blum
        * Write HarddiskTest (state: sane)
478 1 Alexander Blum
    * An error might be tracked down to the resolution of the uploads chunks, if neccessary
479 1 Alexander Blum
480 1 Alexander Blum
481 1 Alexander Blum
### Archiving of the files
482 1 Alexander Blum
483 1 Alexander Blum
* The files associated with a Content are stored on a filesystem
484 1 Alexander Blum
* Each file is named after the Content Uuid: `UUID`
485 1 Alexander Blum
* Each file is associated with two other files by convention:
486 1 Alexander Blum
    * `UUID.checksum`: checksum of the whole file
487 1 Alexander Blum
    * `UUID.checksums`: checksums of all upload chunks
488 1 Alexander Blum
* Each file is stored in the folder `./UUID[0]/UUID[1]/`
489 1 Alexander Blum
    * Folderstructure for optimized filesystemaccess
490 1 Alexander Blum
    * No semantic information (e.g. USER) to avoid the need for corrections
491 1 Alexander Blum
* The full syntax for a file is
492 1 Alexander Blum
    * `./UUID[0]/UUID[1]/UUID(.checksum(s))`
493 1 Alexander Blum
* Examples of file paths
494 1 Alexander Blum
    * `./3/5/35f0c169-6594-4bf3-b285-451d2aa8c61e`
495 1 Alexander Blum
496 1 Alexander Blum
497 1 Alexander Blum
### Orchestration of the archiving
498 1 Alexander Blum
499 1 Alexander Blum
* Files on an [[Specification#Intermediate-storage-for-archive|intermediate storage]] may be archived in many storehouses
500 1 Alexander Blum
* The URLs to the storehouse machines are stored in STOREHOUSECODE target files
501 1 Alexander Blum
* The mappings of all intermediate storages to storehouses are administered on an central orchestration machine
502 1 Alexander Blum
    * Syntax: `./STORAGE/STOREHOUSECODE`
503 1 Alexander Blum
    * Example: `./storage001/DÜ1`
504 1 Alexander Blum
* The mapping of a single intermediate storage to storehouses are mirrored to this intermediate storage
505 1 Alexander Blum
    * Syntax: `./storage/targets/STOREHOUSECODE`
506 1 Alexander Blum
    * Example: `./storage/targets/DÜ1`
507 1 Alexander Blum
* The files on the intermediate storage are synchronized with the files on the orchestration machine for orchestration
508 1 Alexander Blum
509 1 Alexander Blum
510 1 Alexander Blum
### Human readable label sticker
511 1 Alexander Blum
512 1 Alexander Blum
* For each Harddisk, a label sticker may be generated
513 1 Alexander Blum
* Header: `PURPOSE-STOREHOUSECODE-CONTAINERLABELCODE (RAIDTYPE: RAIDNUMBER/RAIDTOTAL)`
514 1 Alexander Blum
    * `PURPOSE`: "UCR" ("User Content Repertoire")
515 1 Alexander Blum
    * `STOREHOUSECODE`: Code of the Storehouse, e.g. "DÜ1" for the first storehouse in Düsseldorf
516 1 Alexander Blum
    * `CONTAINERLABELCODE`: Incremental, padded to 5 digits, e.g. 00001
517 1 Alexander Blum
    * `RAIDTYPE`: Typ of the raid
518 1 Alexander Blum
    * `RAIDNUMBER`: number of the harddisk in the raid
519 1 Alexander Blum
    * `RAIDTOTAL`: total number of harddisks in the raid
520 1 Alexander Blum
* Details: List of `ARCHIVELABELCODE`s
521 1 Alexander Blum
    * `ARCHIVELABELCODE`: Label of the Archive
522 1 Alexander Blum
523 1 Alexander Blum
# Sort
524 1 Alexander Blum
525 1 Alexander Blum
* Only more liberal licenses should be allowed.