mirror of https://github.com/perkeep/perkeep.git
schema: make serverHasBlob just use blobserver.StatBlob
Change-Id: I3012763660c9ed87eb48b2d95b8265c3c77f32df
This commit is contained in:
parent
96ea9af952
commit
6a4eff5b84
|
@ -22,6 +22,7 @@ import (
|
|||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"camlistore.org/pkg/blobref"
|
||||
|
@ -137,13 +138,11 @@ func writeFileMapOld(bs blobserver.StatReceiver, file *Builder, r io.Reader) (*b
|
|||
}
|
||||
|
||||
func serverHasBlob(bs blobserver.BlobStatter, br *blobref.BlobRef) (have bool, err error) {
|
||||
ch := make(chan blobref.SizedBlobRef, 1)
|
||||
go func() {
|
||||
err = bs.StatBlobs(ch, []*blobref.BlobRef{br}, 0)
|
||||
close(ch)
|
||||
}()
|
||||
for _ = range ch {
|
||||
_, err = blobserver.StatBlob(bs, br)
|
||||
if err == nil {
|
||||
have = true
|
||||
} else if err == os.ErrNotExist {
|
||||
err = nil
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue