当前位置: 首页 > 编程日记 > 正文

clientcontainerThrift Types

首先声明,我是一个菜鸟。一下文章中出现技术误导情况盖不负责

来自Apache Thrift官网:Thrift Types

Thrift Types

The Thrift type system is intended to allow programmers to use native types as much as possible, no matter what programming language they are working in. This information is based on, and supersedes, the information in the Thrift Whitepaper. The Thrift IDL provides descriptions of the types which are used to generate code for each target language.

Base Types

The base types were selected with the goal of simplicity and clarity rather than abundance, focusing on the key types available in all programming languages.

  • bool: A boolean value (true or false)
  • byte: An 8-bit signed integer
  • i16: A 16-bit signed integer
  • i32: A 32-bit signed integer
  • i64: A 64-bit signed integer
  • double: A 64-bit floating point number
  • string: A text string encoded using UTF-8 encoding

Note the absence of unsigned integer types. This is due to the fact that there are no native unsigned integer types in many programming languages.

Special Types

binary: a sequence of unencoded bytes

N.B.: This is currently a specialized form of the string type above, added to provide better interoperability with Java. The current plan-of-record is to elevate this to a base type at some point.

Structs

Thrift structs define a common object – they are essentially equivalent to classes in OOP languages, but without inheritance. A struct has a set of strongly typed fields, each with a unique name identifier. Fields may have various annotations (numeric field IDs, optional default values, etc.) that are described in the Thrift IDL.

Containers

每日一道理
青春是用意志的血滴和拼搏的汗水酿成的琼浆——历久弥香;青春是用不凋的希望和不灭的向往编织的彩虹——绚丽辉煌;青春是用永恒的执著和顽强的韧劲筑起的一道铜墙铁壁——固若金汤。

Thrift containers are strongly typed containers that map to commonly used and commonly available container types in most programming languages.

There are three container types:

list: An ordered list of elements. Translates to an STL vector, Java ArrayList, native arrays in scripting languages, etc. set: An unordered set of unique elements. Translates to an STL set, Java HashSet, set in Python, etc. Note: PHP does not support sets, so it is treated similar to a List map: A map of strictly unique keys to values. Translates to an STL map, Java HashMap, PHP associative array, Python/Ruby dictionary, etc. While defaults are provided, the type mappings are not explicitly fixed. Custom code generator directives have been added to allow substitution of custom types in various destination languages.

Container elements may be of any valid Thrift Type.

N.B.: For maximal compatibility, the key type for map should be a basic type rather than a struct or container type. There are some languages which do not support more complex key types in their native map types. In addition the JSON protocol only supports key types that are base types.

Exceptions

Exceptions are functionally equivalent to structs, except that they inherit from the native exception base class as appropriate in each target programming language, in order to seamlessly integrate with the native exception handling in any given language.

Services

Services are defined using Thrift types. Definition of a service is semantically equivalent to defining an interface (or a pure virtual abstract class) in object oriented programming. The Thrift compiler generates fully functional client and server stubs that implement the interface.

A service consists of a set of named functions, each with a list of parameters and a return type.

Note that void is a valid type for a function return, in addition to all other defined Thrift types. Additionally, an async modifier keyword may be added to a void function, which will generate code that does not wait for a response. Note that a pure void function will return a response to the client which guarantees that the operation has completed on the server side. With async method calls the client will only be guaranteed that the request succeeded at the transport layer. Async method calls of the same client may be executed in parallel/out of order by the server.

文章结束给大家分享下程序员的一些笑话语录: 问:你觉得让你女朋友(或者任何一个女的)从你和李彦宏之间选一个,你觉得她会选谁?  
  答:因为李艳红这种败类,所以我没女友!

--------------------------------- 原创文章 By
client和container
---------------------------------

转载于:https://www.cnblogs.com/jiangu66/archive/2013/05/24/3098111.html

相关文章:

简易git操作 -- 让你的格子绿起来

创建github账号 浏览器输入网址,申请一个github账号,github申请网址,看到下面的图片内容,点击图中红色框里面的内容,用邮箱账号申请一个github账号,一定记住账号和密码 填写注册信息 点击之后跳转到下面…

c语言自定义char*函数返回值是乱码_[每日C语言」printf()函数的修饰符和返回值...

在上一个小demo《printf()函数(1)》中主要说了一下printf()函数的转换说明符,这些转移说明符是可以被修饰的。我们可以在%d和定义的转义字符之间通过插入修饰符对基本的转换说明加以修改。printf()修饰符digit(s) 字符宽度的最小值结果:不够的前面补空格…

win2003辅助域服务器相关几个错误日志的解决办法

1.域助域上做了DNS后,提示:浏览器无法更新服务状态位,数据有错误,错误代码是8007关闭computer browser基本就行了,有人说还要关server,它负责共享之类的,如果关了,就不能共享了,我个人没有关!2.之前,公司主域上有DNS,不过没有允许复制区域,也没有在辅助域上做DNS,所以在辅助域上…

redis.conf配置文件参数说明

参数说明 redis.conf 配置项说明如下:1. Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程daemonize no2. 当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以…

用C#来开发CAD插件,含源代

CAD插件看起来很神秘,其实一个合格码农经过几天就能快速掌握。没什么秘密,开发CAD插件和winform一样简单,多学几个类库用法就是,在CAD里展现界面和winform略有不同。学习CAD插件开发的动机是为了薪水,由于公司是做显示…

动态内存管理和智能指针 2.0 -- shared_ptr

shared_ptr出现原因 通过第一章的学习,我们知道不管是auto_ptr合适scoped_ptr都是存在缺陷的,于是我们必须想出一个方法既能很好的管理我们的内存,而且在使用的时候,可以多个指针指向一个内存,这个时候就出现了shared…

汇总同一时间段的数据_数据集干货:一文读懂Mapsidejoin

我们知道数据分析的第一步是准备数据,所以在前面的课程里,我们介绍了元数据。今天这篇文章,主要介绍大数据量组合数据集在永洪中的应用实例:Mapsidejoin。什么是Mapsidejoin?按照字面意思,Mapsidejoin就是M…

【强烈推荐】国土档案管理信息系统产品使用说明书系列目录【附下载地址】...

<<国土档案管理信息系统>>产品使用说明书系列目录【附下载地址】——通过知识共享树立个人品牌。《国土档案管理信息系统》在线视频讲解一、记大型商业软件<<国土档案管理信息系统>>之系统简介记大型商业软件 > 之系统简介 ——通过知识共享树立个人…

zip函数的使用

s [[1, 10], [1.2, 11], [2, 5], [5, 15]] data zip(*s) x_list data[0] y_list data[1] x_min min(x_list) x_max max(x_list) y_min min(y_list) y_max max(y_list) box [x_min, x_max, y_min, y_max] print(box) # [1, 5, 5, 15] 转载于:https://www.cnblogs.com/…

计算机网络基础 1.0 -- 概述

概念理解 报文&#xff1a;在网络中发送的数据块成为报文在发送报文之前&#xff0c;通常会把数组分组&#xff0c;每个组都有个包头和数据组成&#xff0c;包头中包含了诸如目标地址和源地址等重要信息&#xff0c;这样才保证了数据能够有目的的在网络中的传输主机是用户用来…

字符串循环同构的最小表示法(转)

循环字符串的最小表示法的问题可以这样描述&#xff1a; 对于一个字符串S&#xff0c;求S的循环的同构字符串S’中字典序最小的一个。 由于语言能力有限&#xff0c;还是用实际例子来解释比较容易&#xff1a;设Sbcad&#xff0c;且S’是S的循环同构的串。S’可以是bcad或者cad…

周长相等的正方形面积一定相等_必考单元:三年级下册面积计算公式+知识点+测试卷(附答案),重点内容,收藏练习!...

《面积》公式 知识点面积和面积单位&#xff1a;1.常用的面积单位有&#xff1a;(平方厘米)、(平方分米)、(平方米)。2.理解面积的意义和面积单位的意义。面积&#xff1a;物体表面或封闭图形的大小&#xff0c;叫做它们的面积。1平方米&#xff1a;边长是1米的正方形&#xff…

sql server 2000 版本查询

确定已安装的 SQL Server 2000 Database Components 版本 使用 isql、osql 或查询分析器&#xff0c;对数据库引擎实例执行以下查询之一。 SELECT SERVERPROPERTY(ProductLevel) SELECT VERSION SELECT SERVERPROPERTY(Produc…

ubuntu16创建开机启动服务

1、cd /etc/init.d/ 2、sudo touch zookeeper&#xff08;举例&#xff09; 3、给服务赋权限&#xff1a;sudo chmod x zookeeper 4、执行sudo vim zookeeper 命令写入执行脚本&#xff08;启动脚本中的启动命令对应服务的启动命令&#xff09; #! /bin/sh### BEGIN INIT INFO …

Effective C++ 1.0 -- 概述

声明 对象声明&#xff0c;函数声明&#xff0c;类型声明&#xff0c;是告诉编译器某个东西的 名称和类型&#xff0c;但是略去了实现 细节&#xff0c;因为定义在其他的地方。 external int x; //对象&#xff08;object&#xff09;声明 std:size_t numDigits(int num…

寻找连通域算法_【车牌识别算法】

车牌识别技术要求能够将运动中的汽车牌照从复杂背景中提取并识别出来&#xff0c;通过车牌提取、图像预处理、特征提取、车牌字符识别等技术&#xff0c;识别车辆牌号、颜色等信息。目前车牌识别技术主要分为端到端识别与车牌分割识别两种识别算法。端对端识别技术端到端车牌识…

SQL 2005 删除带有默认值约束的列

在sqlserver 2005中要删除某一列: alter table [表名] drop column [列名] 但是如果该列被创建了默认值约束&#xff0c;我们就只能先删除默认值约束&#xff0c;然后才能删除该列。 第一种方法&#xff1a; 1、删除默认值约束: DECLARE name varchar(100) SELECT nameb.name F…

apple hosts

2019独角兽企业重金招聘Python工程师标准>>> #Apple #125.56.202.7 swcnd.apple.com 203.69.138.34 a1.phobos.apple.com 203.69.138.34 a2.phobos.apple.com 203.69.138.34 a3.phobos.apple.com 203.69.138.34 a4.phobos.apple.com 203.69.138.34 a5.phobos.apple.…

thymeleaf 的常见属性

转载于:https://www.cnblogs.com/hwgok/p/9637723.html

继承和多态 1.0 -- 继承概念(is-a、has-a,赋值兼容规则,隐藏重定义)

普通继承和访问权限 当一个继承没有虚拟继承或者是多重继承时&#xff0c;就是一个简单的继承的时候&#xff0c;这个时候就是一个普通的继承。 普通继承的内存空间是&#xff1a;子类的对象中&#xff0c;包含了父类的成员变量&#xff0c;同时也可以调用父类的成员函数&…

c++标准库 及 命名空间std

1、命名空间std  C标准中引入命名空间的概念&#xff0c;是为了解决不同模块或者函数库中相同标识符冲突的问题。有了命名空间的概念&#xff0c;标识符就被限制在特定的范围(函数)内&#xff0c;不会引起命名冲突。最典型的例子就是std命名空间&#xff0c;C标准库中所有标识…

aop point 只能获取到map嘛_面试被问了几百遍的 IoC 和 AOP ,还在傻傻搞不清楚?...

这篇文章会从下面从以下几个问题展开对 IoC & AOP 的解释什么是 IoC&#xff1f;IoC 解决了什么问题&#xff1f;IoC 和 DI 的区别&#xff1f;什么是 AOP&#xff1f;AOP 解决了什么问题&#xff1f;AOP 为什么叫做切面编程&#xff1f;首先声明&#xff1a;IoC & AOP…

HTML学习笔记_002_如何学习HTML

.htm 还是 .html 文件后缀&#xff1f; 当您保存 HTML 文件时&#xff0c;既可以使用 .htm 也可以使用 .html 文件后缀。我们在实例中使用 .htm。这只是长久以来形成的习惯而已&#xff0c;因为过去的很多软件只允许三个字母的文件后缀。 不过对于新的软件&#xff0c;使用 .ht…

设计1.0 -- iterator 和const_iterator底层的模拟实现

本文概要&#xff1a; 本文主要是模拟实现STL中迭代器和const迭代器的&#xff0c;主要阐述的一个问题就是&#xff0c;为什么我们在设计迭代器的时候需要使用三个模板参数呢 在设计迭代器的时候&#xff0c;我们有下面的代码 #include<iostream> using namespace std…

关于python缩进的描述中_关于Python程序中与“缩进”有关的说法中,以下选项中正确的是()...

关于Python程序中与“缩进”有关的说法中,以下选项中正确的是()答&#xff1a;缩进在程序中长度统一且强制使用同文学或同音乐主题的民歌&#xff0c;《_______》是其中之一。此曲经民间艺人丁喜才改编后&#xff0c;由上海音乐学院鞠秀芳于50年代在国际上唱红答&#xff1a;五…

使用Newtonsoft.Json

首先是前一段某博友对于循环引用的问题的解决&#xff1a;http://www.cnblogs.com/Gryzor/archive/2013/05/06/3062373.html 其次是时间到底是UTC还是Local的问题&#xff1a;http://www.cnblogs.com/leonwang/archive/2013/05/29/javascript-datetime.html 对于第二条&#xf…

回击质疑 HP StoreOnce用高性能说话

四五年以前&#xff0c;记者曾经两次参观过惠普位于英国西南部港口城市布里斯托尔的存储研究中心&#xff0c;那里是惠普数据备份和保护产品的大本营&#xff0c;同时也是惠普磁带产品与HP StoreOnce产品家族的诞生地。就在惠普刚刚发布升级版的HP StoreOnce B6200以及Catalyst…

windows10配置jenkins

1、下载pscp.exe并拷贝到c:\window\system32&#xff0c;此工具用于上传文件至linux服务器 下载地址&#xff1a;https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html 2、下载jenkins.war 下载地下&#xff1a;https://jenkins.io/download/ 3、设置环境变量JENKI…

STL模拟实现1.0 -- list和iterator模拟实现和简单分析

引言 C 标准模本库《STL》中有很多优秀的代码实现&#xff0c;不然怎么能叫做C标准模板库呢&#xff0c;其中一个实现就是有一个容器&#xff0c;叫做list。所谓容器其实就是存储相同类型数据的一个存储集合&#xff0c;list的底层实现其实就是一个链表。 我们的普通数组在使…

hdc mfc 画扇形图_使用echarts绘制条形图和扇形图

使用echarts绘制条形图和扇形图简单举例说明下echarts如何绘制条形图和扇形图代码示例echarts绘制条形图和扇形图var mychart1echarts.init(document.getElementById(chart1),light);// 指定图表的配置项和数据var option {title: {text: ECharts 入门示例},tooltip: {},legen…