Chapter 7. User-defined types

 

This chapter covers

  • Designing effective cross-platform data types
  • Serializing objects
  • Designing for type evolution
  • Looking inside type serialization
  • Using Zlib compression

At this point we’ve covered the foundational elements of the Apache Thrift framework. Chapter 4 exposed us to the transport layer and demonstrated its ability to provide device independence, chapter 5 covered the serialization capabilities of the plug-in protocol layer, and chapter 6 took us on a comprehensive tour of the Apache Thrift IDL syntax.

As discussed in chapter 6, Apache Thrift interfaces have three key facets:

  • User-Defined Types (UDTs)—Data types that define the structure of data shared and exchanged by Apache Thrift programs
  • Constants—Immutable instances of types
  • Services—Collections of functions implemented by servers that can be called remotely by clients (covered in chapter 8)

In this chapter, we’ll focus on the design and use of cross-language user-defined types (see figure 7.1). The Apache Thrift IDL makes it fairly effortless to declare complex types that can then be easily exchanged across a wide range of languages.

Figure 7.1. Apache Thrift Framework user-defined types

7.1. A simple user-defined type example

7.2. Type design

7.3. Serializing objects to disk

7.4. Under the type serialization hood

7.5. Type evolution

7.6. Using Zlib compression

Summary

sitemap