ZooKeeper source code analysis-Jute-Part 2, zookeeper-jute-
Data Type and stream
This section describes the basic data types and composite types that support Hadoop. Our goal is to support a series of types that can be used to simplify and effectively express a range of record types in different programming languages.
Basic Type
In most cases, most of Hadoop's basic types are directly mapped to the basic types of advanced programming languages. A special example is the ustring (Unicode string) and buffer type. We believe it can be widely used and usually implemented in library code, rather than as a language-embedded program. When the target language has no built-in implementation and no widely used standard implementation, Hadoop can support them through library code. The complete list of basic data types is as follows:
Byte, boolean, int, long, float, double, ustring, buffer
Combination Type
Haddop supports a small number of combined types to describe simple aggregation types and containers. A composite type is serialized by its components. The combination type includes the following types:
1) Record: similar to the aggregation type of C struct. It is considered as a single data type by combining a series of type fields. A Record is serialized by serializing its composition fields. In addition to serialization, Record also has a comparison function, which is defined as a function for comparing members one by one.
2) vector: A series of collections of the same data type, which can be basic or composite.
3) map: an associated container that maps key-type instances to value-type instances.
Stream
Hadoop automatically generates code serialization and deserialization Record types to convert them into abstract streams. Each target language Haddop defines a very simple input/output stream interface. application developers can develop specific instances of these interfaces by encapsulating specific stream implementation methods.