From 21797e21502a41ef0b139f07a3724edb68396a01 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sat, 21 May 2011 18:19:37 -0700 Subject: [PATCH] Make shard Enumerate use new blobserver.MergedEnumerated; not yet implemented. Will need for replica target too. --- lib/go/camli/blobserver/mergedenum.go | 30 ++++++++++++++++++++++++++ lib/go/camli/blobserver/shard/shard.go | 11 +++------- 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 lib/go/camli/blobserver/mergedenum.go diff --git a/lib/go/camli/blobserver/mergedenum.go b/lib/go/camli/blobserver/mergedenum.go new file mode 100644 index 000000000..e08f4e8af --- /dev/null +++ b/lib/go/camli/blobserver/mergedenum.go @@ -0,0 +1,30 @@ +/* +Copyright 2011 Google Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package blobserver + +import ( + "os" + + "camli/blobref" +) + +// TODO: it'd be nice to make sources be []BlobEnumerator, but that +// makes callers more complex since assignable interfaces' slice forms +// aren't assignable. +func MergedEnumerated(dest chan<- blobref.SizedBlobRef, sources []Storage, after string, limit uint, waitSeconds int) os.Error { + return os.NewError("TODO: NOT IMPLEMENTED") +} diff --git a/lib/go/camli/blobserver/shard/shard.go b/lib/go/camli/blobserver/shard/shard.go index db8c076c9..1680b59d7 100644 --- a/lib/go/camli/blobserver/shard/shard.go +++ b/lib/go/camli/blobserver/shard/shard.go @@ -103,19 +103,14 @@ func (sto *shardStorage) Remove(blobs []*blobref.BlobRef) os.Error { }) } -func (sto *shardStorage) Stat(dest chan<- blobref.SizedBlobRef, -blobs []*blobref.BlobRef, -waitSeconds int) os.Error { +func (sto *shardStorage) Stat(dest chan<- blobref.SizedBlobRef, blobs []*blobref.BlobRef, waitSeconds int) os.Error { return sto.batchedShards(blobs, func(s blobserver.Storage, blobs []*blobref.BlobRef) os.Error { return s.Stat(dest, blobs, waitSeconds) }) } -func (sto *shardStorage) EnumerateBlobs(dest chan<- blobref.SizedBlobRef, -after string, -limit uint, -waitSeconds int) os.Error { - return os.NewError("shard: TODO: NOT IMPLEMENTED") +func (sto *shardStorage) EnumerateBlobs(dest chan<- blobref.SizedBlobRef, after string, limit uint, waitSeconds int) os.Error { + return blobserver.MergedEnumerated(dest, sto.shards, after, limit, waitSeconds) } func init() {