コード例 #1
0
func TestMultiStreamer(t *testing.T) {
	var streamers []blobserver.BlobStreamer
	var want []blob.SizedRef
	n := 0

	for st := 0; st < 3; st++ {
		var blobs []*blob.Blob
		for i := 0; i < 3; i++ {
			n++
			tb := &test.Blob{strconv.Itoa(n)}
			b := tb.Blob()
			want = append(want, b.SizedRef()) // overall
			blobs = append(blobs, b)          // this sub-streamer
		}
		streamers = append(streamers, staticStreamer(blobs))
	}
	storagetest.TestStreamer(t, blobserver.NewMultiBlobStreamer(streamers...), storagetest.WantSizedRefs(want))
}
コード例 #2
0
ファイル: stream.go プロジェクト: rfistman/camlistore
func (s *storage) StreamBlobs(ctx context.Context, dest chan<- blobserver.BlobAndToken, contToken string) (err error) {
	return blobserver.NewMultiBlobStreamer(
		smallBlobStreamer{s},
		largeBlobStreamer{s},
	).StreamBlobs(ctx, dest, contToken)
}