-
Notifications
You must be signed in to change notification settings - Fork 187
Thrift columns
To use Thrift columns, first and foremost you need a dependency on phantom-thrift
. The Thrift module has no explicit dependency on any Apache Thrift library and instead allows Twitter Scrooge, the real underlying serialization mechanism for Apache Thrift, to set the version it needs.
Scrooge is a very powerful integration tool for Scala services built atop Twitter Finagle and Apache Thrift and has the ability to automatically generate entire server and client applications from a simple IDL, and mixing that with a Phantom/Cassandra database store will help you build a very powerful distributed system with minimal effort. Read more about Twitter Scrooge.
libraryDependencies ++= Seq(
"com.websudos" %% "phantom-thrift" % PhantomVersion
)
These columns are especially useful if you are building Thrift services. They are deeply integrated with Twitter Scrooge and relevant to the Twitter ecosystem(Finagle, Zipkin, Storm etc)
They are available via the phantom-thrift
module and you need to import the Thrift package to get all necessary types into scope.
import com.websudos.phantom.thrift._
In the below scenario, the Cassandra type is always text and the type you need to pass to the column is a Thrift struct, specifically com.twitter.scrooge .ThriftStruct
.
phantom will use a CompactThriftSerializer
, store the record as a binary string and then reparse it on fetch.
Thrift serialization and de-serialization is extremely fast, so you don't need to worry about speed or performance overhead. You generally use these to store collections(small number of items), not big things.
phantom columns | Cassandra columns |
---|---|
ThriftColumn.<type> | text |
ThriftListColumn.<type> | list<text> |
ThriftSetColumn.<type> | set<text> |
ThriftMapColumn.<type, type> | map<text, text> |
To stay up-to-date with our latest releases and news, follow us on Twitter: @outworkers.
- Issues and questions
- Adopters
- Roadmap
- Changelog
- Tutorials
- Commercial support
- Using phantom in your project
- Primitive columns
- Optional primitive columns
- Collection columns
- Collection operators
- Automated schema generation
- Indexing columns
- Data modeling with phantom
- Querying with phantom
- Asynchronous iterators
- Batch statements
- Apache Thrift integration
- Apache ZooKeeper integration
- The phantom testkit