Amazon Ion

栏目: IT技术 · 发布时间: 6年前

内容简介:Amazon Ion is arichly-typed,self-describing, hierarchical data serialization format offeringIon was built to address rapid development, decoupling, and efficiency challenges faced every day while engineering large-scale, service-oriented architectures. It

Amazon Ion is arichly-typed,self-describing, hierarchical data serialization format offering interchangeable binary and text representations. Thetext format (a superset of JSON ) is easy to read and author, supporting rapid prototyping. The binary representation is efficient to store, transmit, and skip-scan parse . The rich type system provides unambiguous semantics for long-term preservation of data which can survive multiple generations of software evolution.

Ion was built to address rapid development, decoupling, and efficiency challenges faced every day while engineering large-scale, service-oriented architectures. It has been addressing these challenges within Amazon for nearly a decade, and we believe others will benefit as well.

Available Languages: CC#JavaJavaScriptPython

Related Projects:Ion Hash –Ion Schema

Tools: Hive SerDe

Getting Started

All JSON values are valid Ion values, and while any value can be encoded in JSON (e.g., a timestamp value can be converted to a string), such approaches require extra effort, obscure the actual type of the data, and tend to be error-prone.

In contrast, Ion’s rich type system enables unambiguous semantics for data (e.g., a timestamp value can be encoded using the timestamp type). The following illustrates some of the features of the Ion type system:

  • timestamp: arbitrary precision date / timestamps
    2003-12-01T
    2010-03-22T18:00:00Z
    2019-05-01T18:12:53.472-0800
  • int: arbitrary size integers
    0
    -1
    12345678901234567890...
  • decimal: arbitrary precision, base-10 encoded real numbers
    0.
    -1.2
    3.141592653589793238...
    6.62607015d-34
  • float: 32-/64-bit IEEE-754 floating-point values
    0e0
    -1.2e0
    6.02e23
    -inf
  • symbol: provides efficient encoding for frequently occurring strings
    inches
    dollars
    'high-priority'    // symbols with special characters ('-' in this example)
                       // are enclosed in single-quotes
  • blob: binary data
    {{ aGVsbG8= }}
  • annotation: metadata associated with a value
    dollars::100.0
    height::inches::72
    lotto_numbers::[7, 9, 19, 40, 42, 44]

TheSpecification provides an overview of the full set of Ion types.

Binary Encoding

Ion provides two encodings: human-readable text (as shown above), and a space- and read-efficient binary encoding. When binary-encoded, every Ion value is prefixed with the value’s type and length. The following illustrates a few of the efficiences provided by Ion’s binary encoding:

  • The following timestamp encoded as a JSON string requires 26 bytes: “2017-07-26T16:30:04.076Z”. This timestamp requires just 11 bytes when encoded in Ion binary:
    6a 80 0f e1 87 9a 90 9e 84 c3 4c

    That first byte 6a indicates the value is a timestamp (type 6 ) represented by the subsequent 10 bytes (that’s what the a represents). If this particular timestamp value is not of interest, a reader can jump over the value by skipping 10 bytes. This ability to skip over a value enables faster navigation over Ion data.

  • Binary encoding of a symbol replaces the text of a symbol with an integer that can be resolved to the original text via a symbol table. This can result in substantial space savings for symbols that occur frequently!

  • While blob data is base-64 encoded in text (which produces 4 bytes for every 3 bytes of the original data), a blob encoded as Ion binary is simply encoded as is—no base-64 expansion required!

Similar space efficiencies are found in other aspects of Ion’s binary encoding.

Give Ion a Try!

/* Ion supports comments. */ // Here is a struct, which is similar to a JSON object { // Field names don't always have to be quoted name: "Fido", // This is an integer with a 'years' annotation age: years::4, // This is a timestamp with day precision birthday: 2012-03-01T, // Here is a list, which is like a JSON array toys: [ // These are symbol values, which are like strings, // but get encoded as integers in binary ball, rope, ], // This is a decimal -- a base-10 floating point value weight: pounds::41.2, // Here is a blob -- binary data, which is // base64-encoded in Ion text encoding buzz: {{VG8gaW5maW5pdHkuLi4gYW5kIGJleW9uZCE=}}, }

More Information

To learn more, check out theDocs page, or seeLibs for the officially supported libraries as well as community supported tools. For information on how to contribute, how to contact the Ion Team, and answers to the frequently asked questions, seeHelp.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Maven实战

Maven实战

许晓斌 / 机械工业出版社 / 2010年12月 / 65.00元

你是否早已厌倦了日复一日的手工构建工作?你是否对各个项目风格迥异的构建系统感到恐惧?Maven——这一Java社区事实标准的项目管理工具,能帮你从琐碎的手工劳动中解脱出来,帮你规范整个组织的构建系统。不仅如此,它还有依赖管理、自动生成项目站点等超酷的特性,已经有无数的开源项目使用它来构建项目并促进团队交流,每天都有数以万计的开发者在访问中央仓库以获取他们需要的依赖。 本书内容全面而系统,Ma......一起来看看 《Maven实战》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

URL 编码/解码
URL 编码/解码

URL 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具