2 391
edições
Sem resumo de edição |
(→Outros lembretes: add DL) |
||
Linha 408: | Linha 408: | ||
| CO-ARA-Tame || t || 1 || {c7acQ} | | CO-ARA-Tame || t || 1 || {c7acQ} | ||
|} | |} | ||
== Outros esquemas e tabelas == | |||
=== download.redirects === | |||
{| class="wikitable" | |||
! Column !! Type !! Nullable !! Description | |||
|- | |||
| donor_id || int || || Donor identifier in optim.donor | |||
|- | |||
| filename_original || text || || (not used) | |||
|- | |||
| package_path || text || || (not used) | |||
|- | |||
| hashedfname || text || not null || The filenaname, based on SHA256.extension | |||
|- | |||
| hashedfnameuri || text || || The real URL for file download of the file with the expected SHA256. | |||
|} | |||
<small><pre> | |||
Indexes: | |||
"redirects_pkey" PRIMARY KEY, btree (hashedfname) | |||
-- correto seria unique substring(hashedfname,1,64) para excluir a extension da unicidade | |||
"redirects_hashedfname_hashedfnameuri_key" UNIQUE CONSTRAINT, btree (hashedfname, hashedfnameuri) | |||
Check constraints: | |||
"redirects_hashedfname_check" CHECK (hashedfname ~ '^[0-9a-f]{64,64}\.[a-z0-9]+$'::text) | |||
</pre></small> | |||
Tem relação com a API do ''endpoint'' <code>http://DL.digital-guard.org</code>. | |||
onde faz UNION com a tabela <code>optim.donated_packcomponent_cloudcontrol</code>. No servidor, localmente faz <code>curl http://127.0.0.1:3105/redirects</code>. Na prática é chamado por PHP, ver <code>/var/www/dl.digital-guard.org/dl.php</code>. | |||
<syntaxhighlight lang="sql"> | |||
-- R0. Testa como a API fornece | |||
select * from api.redirects where fhash like 'e5b%'; | |||
CREATE VIEW optim.vw_download_redirects AS | |||
select substring(hashedfname,1,7) as short_id, donor_id, hashedfname, hashedfnameuri from download.redirects | |||
; | |||
-- R1. Gera testes bash dos downloads. Demora, já são mais de 700 | |||
COPY ( | |||
SELECT 'url_'||short_id ||'="' || hashedfnameuri || '"' FROM optim.vw_download_redirects | |||
UNION ALL | |||
SELECT format( | |||
'wget --spider "$url_%s" 2>/dev/null && echo "url_%1$s exists" || echo "!url_%1$s does not exist: $url1"', | |||
short_id | |||
) | |||
FROM optim.vw_download_redirects | |||
) to '/tmp/dl_urls_test.sh'; -- sh /tmp/dl_urls_test.sh | |||
</syntaxhighlight> | |||
== Outros lembretes == | == Outros lembretes == |
edições