Use queryPathFromHashPart to look up binary cache requests efficiently

[?]
Jul 18, 2012, 9:14 PM
UD2WKDUVY2MLHT3TFSJ45OWD4RGT6JGVIUJOMM3KVM4V7WSZAYYQC

Dependencies

  • [2] IDT3SO3P Generate *.narinfo files on the fly to support the binary cache substituter
  • [3] AFEKITYD Fix some warnings about undefined values
  • [4] MVB7RRLT * Move NARs from the NixChannel controller to the Root controller and
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.

Change contents

  • replacement in src/lib/Hydra/Controller/Root.pm at line 201
    [2.74][2.74:468]()
    # FIXME: doing a glob is very inefficient. Should do a database
    # lookup.
    my @glob = glob("/nix/store/$hash*");
    foreach my $storePath (@glob) {
    if (isValidPath($storePath)) {
    print STDERR "FOUND: $hash -> $storePath\n";
    return $storePath;
    }
    #return $storePath if isValidPath($storePath);
    }
    notFound($c, "Store path with hash ‘$hash’ does not exist.");
    [2.74]
    [2.468]
    my $path = queryPathFromHashPart($hash);
    notFound($c, "Store path with hash ‘$hash’ does not exist.") unless $path;
    return $path;