Specification » History » Version 1

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