forked from twitter-archive/Rowz
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
91 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package com.twitter.rowz | ||
|
||
import com.twitter.xrayspecs.Time | ||
import com.twitter.util.Time | ||
|
||
|
||
case class Row(id: Long, name: String, createdAt: Time, updatedAt: Time, state: State.Value) | ||
case class Row(id: Long, name: String, createdAt: Time, updatedAt: Time, state: State.Value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 19 additions & 6 deletions
25
src/main/scala/com/twitter/rowz/thrift/conversions/Row.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
package com.twitter.rowz.thrift.conversions | ||
|
||
import com.twitter.xrayspecs.Time | ||
import com.twitter.xrayspecs.TimeConversions._ | ||
package com.twitter.rowz | ||
package thrift.conversions | ||
|
||
import com.twitter.util.Time | ||
import com.twitter.conversions.time._ | ||
import com.twitter.rowz | ||
|
||
object Row { | ||
class RichShardingRow(row: rowz.Row) { | ||
def toThrift = new thrift.Row(row.id, row.name, row.createdAt.inSeconds, row.updatedAt.inSeconds, row.state.id) | ||
def toThrift = new thrift.Row( | ||
row.id, | ||
row.name, | ||
row.createdAt.inMilliseconds, | ||
row.updatedAt.inMilliseconds, | ||
row.state.id | ||
) | ||
} | ||
implicit def shardingRowToRichShardingRow(row: rowz.Row) = new RichShardingRow(row) | ||
|
||
class RichThriftRow(row: thrift.Row) { | ||
def fromThrift = new rowz.Row(row.id, row.name, Time(row.created_at.seconds), Time(row.updated_at.seconds), State(row.state)) | ||
def fromThrift = new rowz.Row( | ||
row.id, | ||
row.name, | ||
Time.fromMilliseconds(row.created_at), | ||
Time.fromMilliseconds(row.updated_at), | ||
State(row.state) | ||
) | ||
} | ||
implicit def thriftRowToRichThriftRow(row: thrift.Row) = new RichThriftRow(row) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters