Next: catalog.txt, Previous: supports.txt, Up: Relational schema [Contents][Index]
SERVER (see Server) backup its collection’s status into the ~mdtx/md5sums/mdtx-COLL.md5 file. When PUBLISHER or CLIENT want to read the lastest status, they need to ask SERVER the refresh this file.
The Messages the cgiClient (see cgiClient), supp (see supp) and notify (see notify) processes exchange via socket are using the same grammar language. There is type for such messages:
DISK
: used to serialize the ~mdtx/md5sums/mdtx-COLL.md5 file
NOTIFY
: used by SERVERs to talk each others
UPLOAD
: used to add new incoming archives
CGI
: used by cgiClient (see cgiClient) to send USER queries
HAVE
: used when PUBLISHER notify that a support is provided
These messages are cyphered using AES algorithm and a key defined into /etc/mediatex/mdtx-COLL/servers.txt (see servers.txt) file.
When loaded into memory, such messages are handled using the following relational schema:
There is 7 types of records
Type | type | host | extra |
---|---|---|---|
FINAL_DEMAND | D | local | |
LOCAL_DEMAND | D | local | !wanted |
REMOTE_DEMAND | D | remote | !wanted |
FINAL_SUPPLY | S | local | absolute path |
MALLOC_SUPPLY | S | local | !malloc |
LOCAL_SUPPLY | S | local | relative path |
REMOTE_SUPPLY | S | remote | relative path |
Notice: for FINAL_SUPPLY
the extra field is more accurately path1[:path2]
, where:
The MALLOC_SUPPLY
is an internal state used when allocating the archive’s data file into the SERVER’s cache.
LOCAL_DEMAND
) on the local cache.
FINAL_SUPPLY
).
REMOTE_SUPPLY
) from the other SERVER.
FINAL_DEMAND
, LOCAL_DEMAND
and REMOTE_DEMAND
) for an archive
All the time cache is loaded, archive objects are never free but eventually marked as deleted. The cache api is thread safe. 3 locks are used in order to allow concurrent access:
Example:
Headers Collection hello Type DISK Server adc2f7b78c43354df5a86efae3dfe562 DoCypher FALSE Body # date host hash size extra D 2015-10-04,23:40:13 adc2… 022a… 24075 test@test.org S 2015-10-04,23:40:28 adc2… 1a16… 20480 logoP1.cat S 2015-10-04,23:40:24 aed9… 1a16… 20480 logoP1.cat S 2015-10-04,23:34:30 adc2… 99b8… 1004 2015-10/mediatex.css
Grammar:
file: //empty file | header | header lines header: HEADERS hLines BODY hLines: hLines hLine | hLine hLine: COLLECTION string | SERVER string | TYPE msgval | DOCYPHER bool lines: lines newLine | newLine newLine: line line: type date hash hash [[:digit:]]+ string msgval: DISK | CGI | HAVE | NOTIFY | UPLOAD bool: FALSE | TRUE type: S | D date: {year}-{month}-{day},{HOUR}:{min}:{sec} year: [[:digit:]]{4} month: [[:digit:]]{2} day: [[:digit:]]{2} HOUR: [[:digit:]]{2} min: [[:digit:]]{2} sec: [[:digit:]]{2} hash: [[:xdigit:]]{32} string: [^[:blank:]\r\n]{1,511}
Code:
This code is use to get the record’s type:
RecordType rc = UNDEF_RECORD; switch (self->type & 0x3) { case DEMAND: if (!self->server->isLocalhost) rc = REMOTE_DEMAND; else if (self->extra[0] != '!') rc = FINAL_DEMAND; else if (self->extra[1] == 'w') rc = LOCAL_DEMAND; break; case SUPPLY: if (!self->server->isLocalhost) rc = REMOTE_SUPPLY; else if (self->extra[0] == '/') rc = FINAL_SUPPLY; else if (self->extra[0] != '!') rc = LOCAL_SUPPLY; else if (self->extra[1] == 'm') rc = MALLOC_SUPPLY; break; }
Next: catalog.txt, Previous: supports.txt, Up: Relational schema [Contents][Index]