Fixed DynamoDB batchGet for situations where the batch request size exceeds limits

Fixed DynamoDB batchGet for situations where the batch request size exceeds the DynamoDB limit. Now, batchGet returns a Stream[Item]. (The design of the solution is the same as the S3 listObjects design.) This fixes #33.
Sure. I just reused the original code here which had these flatten calls. I thought it was a but peculiar too.—
Sent from Mailbox

On Thu, Jun 12, 2014 at 12:46 AM, Kazuhiro Sera <notifications@github.com>
wrote:

>> +          val result = batchGetItem(new BatchGetItemRequest(remaining))
>> +          next(State(toItems(result).toList, result.getUnprocessedKeys()))
>> +        }
>> +        case State(Nil, remaining) if remaining.isEmpty => (None, state)
>> +      }
>> +    
>> +    def toStream(state: State): Stream[Item] = 
>> +      next(state) match {
>> +        case (Some(item), nextState) => Stream.cons(item, toStream(nextState))
>> +        case (None, _) => Stream.Empty
>> +      }
>> +    
>> +    def toItems( result: BatchGetItemResult ) : Seq[Item] =
>> +      result.getResponses.asScala.toSeq.map {
>> +        case (t, as) => table(t).map(table => as.asScala.toList.map { a => Item(table, a) })
>> +      }.flatten.flatten
> flatMap?
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/seratch/AWScala/pull/34/files#r13690544