<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jul 10, 2017 at 3:06 PM, Dennis Kliban <span dir="ltr"><<a href="mailto:dkliban@redhat.com" target="_blank">dkliban@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>The upload API for Artifacts is going to allow users to specify the artifact size and a digest. The Artifact model currently supports  'md5', 'sha1', 'sha224', 'sha256', 'sha384', and 'sha512' digests.<br><br></div>Do we want to let users specify more than one digest per upload? e.g. md5 and sha256? <br></div></div></blockquote><div><br></div><div>There may be no harm in this, but it would add complexity to the verification and not add much value. I'd stick with just one unless there's a compelling reason for multiple.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div>Do we want to store all 6 digests for each Artifact? </div></blockquote><div><br></div><div>The expensive part of calculating the digests is reading the file. As long as you're already reading the entire file, which we will during verification, you may as well stuff the bits through multiple hashers (digesters?) and get all the digests. Pulp 2 has a function that does this:</div><div><br></div><div><a href="https://github.com/pulp/pulp/blob/2.13-release/server/pulp/server/util.py#L327-L353">https://github.com/pulp/pulp/blob/2.13-release/server/pulp/server/util.py#L327-L353</a><br></div><div><br></div><div>But we can't always guarantee that we'll have all the checksums available, for at least two reasons. 1) If in the future if we want to use yet another algorithm, we probably won't want to run a migration that re-reads every file and calculates the additional digest. 2) For on-demand content, we don't have it locally, so we can't calculate any additional checksums until it gets fetched.</div><div><br></div><div>So this may be one of those times where we use a good-ole-fashioned getter method that returns the requested digest if it's on the artifact, calculates it if not, or raises an exception if the value isn't available and can't be calculated.</div></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><p style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px;margin:0px;padding:0px"><span style="margin:0px;padding:0px">Michael</span> <span style="margin:0px;padding:0px">Hrivnak</span></p><p style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px;margin:0px;padding:0px"></p><span style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px;margin:0px;padding:0px"><span style="margin:0px;padding:0px">Principal Software Engineer</span><span style="margin:0px;padding:0px">, <span style="margin:0px;padding:0px">RHCE</span></span> </span><span style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px"></span><br style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px;margin:0px;padding:0px"><p style="color:rgb(0,0,0);font-family:overpass-mono,monospace;font-size:10px;margin:0px;padding:0px">Red Hat</p></div></div>
</div></div>