Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fanout results class

  • Loading branch information...
commit ff0fe046efc3c7434e04c78785bbe2ba48946e23 1 parent 9e243be
Kyle Maxwell authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 src/main/scala/com/twitter/gizzard/shards/FanoutResults.scala
View
19 src/main/scala/com/twitter/gizzard/shards/FanoutResults.scala
@@ -0,0 +1,19 @@
+package com.twitter.gizzard.shards
+
+object FanoutResults {
+ def apply[S, A](method: (S => A), shard: S): FanoutResults[A] = {
+ try {
+ val output = method(shard)
+ FanoutResults(Seq(output), Seq[Throwable]())
+ } catch {
+ case e => FanoutResults(Seq[A](), Seq(e))
+ }
+ }
+}
+
+/**
+ * It's both a Seq and a case class. OMG Magic!
+ */
+case class FanoutResults[A](results: Seq[A], exceptions: Seq[Throwable]) extends SeqProxy[A] {
+ val self = results
+}
Please sign in to comment.
Something went wrong with that request. Please try again.