add StreamingFetcher interface

This commit is contained in:
Brad Fitzpatrick 2011-03-24 19:20:47 -07:00
parent 4b5380a8aa
commit 468a4849c4
1 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,7 @@ package blobref
import (
"fmt"
"io"
"os"
"path/filepath"
)
@ -29,6 +30,13 @@ type Fetcher interface {
Fetch(*BlobRef) (file ReadSeekCloser, size int64, err os.Error)
}
type StreamingFetcher interface {
// Fetch returns a blob. If the blob is not found then
// os.ENOENT should be returned for the error (not a wrapped
// error with a ENOENT inside)
FetchStreaming(*BlobRef) (file io.ReadCloser, size int64, err os.Error)
}
func NewSerialFetcher(fetchers ...Fetcher) Fetcher {
return &serialFetcher{fetchers}
}