博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Thrift学习(二)协议架构
阅读量:4293 次
发布时间:2019-05-27

本文共 1937 字,大约阅读时间需要 6 分钟。

thrift协议框架

黄色部分是用户实现的业务逻辑

褐色部分是根据 Thrift 定义的服务接口描述文件生成的客户端和服务器端代码框架
红色部分是根据 Thrift 文件生成代码实现数据的读写操作
红色部分以下是 Thrift 的传输体系、协议以及底层 I/O 通信,使用 Thrift 可以很方便的自定义一个服务、传输协议和传输层。

Thrift 服务器包含用于绑定协议和传输层的基础架构,它提供阻塞、非阻塞、单线程和多线程的模式运行在服务器上,可以配合服务器 / 容器一起运行,可以和现有的 J2EE 服务器 /Web 容器无缝的结合。

以PHP代码为例:

└── Thrift

├── Base
│ └── TBase.php
├── ClassLoader
│ └── ThriftClassLoader.php
├── Exception 异常类
│ ├── TApplicationException.php
│ ├── TException.php
│ ├── TProtocolException.php
│ └── TTransportException.php
├── Factory
│ ├── TBinaryProtocolFactory.php
│ ├── TCompactProtocolFactory.php
│ ├── TJSONProtocolFactory.php
│ ├── TProtocolFactory.php
│ ├── TStringFuncFactory.php
│ └── TTransportFactory.php
├── Protocol(协议层),定义数据格式
│ ├── JSON
│ │ ├── BaseContext.php
│ │ ├── ListContext.php
│ │ ├── LookaheadReader.php
│ │ └── PairContext.php
│ ├── SimpleJSON
│ │ ├── CollectionMapKeyException.php
│ │ ├── Context.php
│ │ ├── ListContext.php
│ │ ├── MapContext.php
│ │ └── StructContext.php
│ ├── TBinaryProtocolAccelerated.php
│ ├── TBinaryProtocol.php 二进制格式
│ ├── TCompactProtocol.php 压缩格式
│ ├── TJSONProtocol.php json格式
│ ├── TMultiplexedProtocol.php
│ ├── TProtocolDecorator.php
│ ├── TProtocol.php
│ └── TSimpleJSONProtocol.php
├── Serializer 序列化
│ └── TBinarySerializer.php
├── Server 服务器模式
│ ├── TForkingServer.php
│ ├── TServer.php
│ ├── TServerSocket.php
│ ├── TServerTransport.php
│ ├── TSimpleServer.php 简单的单线程服务模型,常用于测试
│ └── TSSLServerSocket.php
├── StringFunc
│ ├── Core.php
│ ├── Mbstring.php
│ └── TStringFunc.php
├── TMultiplexedProcessor.php
├── Transport(传输层),定义数据传输方式, TCP/IP传输,内存共享或者文件共享等
│ ├── TBufferedTransport.php
│ ├── TCurlClient.php
│ ├── TFramedTransport.php 以frame为单位进行传输,非阻塞式方式
│ ├── THttpClient.php
│ ├── TMemoryBuffer.php 将内存用于I/O
│ ├── TNullTransport.php
│ ├── TPhpStream.php
│ ├── TSocket.php 阻塞式socket
│ ├── TSocketPool.php
│ ├── TSSLSocket.php
│ └── TTransport.php
└── Type 数据类型定义
├── TConstant.php
├── TMessageType.php
└── TType.php

转载地址:http://tmuws.baihongyu.com/

你可能感兴趣的文章
32位架构应用转64位架构小结
查看>>
Objective-C 编程基本概念
查看>>
Base64编码学习
查看>>
Core Data 基本用法
查看>>
Quartz 2D 概述
查看>>
CrashReporter 简介
查看>>
The action could not be completed.Try again.
查看>>
HTML 小结
查看>>
推送通知小结
查看>>
CSS 小结
查看>>
JavaScript 小结
查看>>
mobiscroll 时间选择器小结
查看>>
iOS 时间表示小结
查看>>
iOS 导航控制器小结
查看>>
unrecognized selector sent to instance
查看>>
UIViewController小结
查看>>
iOS 多线程小结
查看>>
AVFoundation 框架小结
查看>>
CGTime CMTimeRange CMTimeMapping 小结
查看>>
UIView 小结
查看>>