這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。
本文已經是很久以前的文章了,也不知道新版本thrift如何
Thrift是一個跨語言的服務部署架構,Thrift通過一個中繼語言(IDL, 介面定義語言)來定義RPC的介面和資料類型,然後通過一個編譯器產生不同語言的代碼(目前支援C++,Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk和OCaml),並由產生的程式碼負責RPC協議層和傳輸層的實現。
Thrift版本:0.9.2
在編譯支援golang時,依賴gomock,makefile中gomock的包地址是google code(牆外),更改為github即可。
thrift-0.9.2/test/go/Makefile
559 #GOPATH=`pwd` $(GO) get code.google.com/p/gomock/gomock560 GOPATH=`pwd` $(GO) get github.com/rafrombrc/gomock/gomock579 #GOPATH=`pwd` $(GO) install code.google.com/p/gomock/mockgen580 GOPATH=`pwd` $(GO) install github.com/rafrombrc/gomock/mockgen
thrift-0.9.2/test/go/src/common/mock_handler.go
25 import (26 //gomock "code.google.com/p/gomock/gomock"27 gomock "github.com/rafrombrc/gomock/gomock"28 thrifttest "gen/thrifttest"29 )
Thrift一些參考資料:
架構介紹:http://dongxicheng.org/search-engine/thrift-framework-intro/
使用指南:http://dongxicheng.org/search-engine/thrift-guide/
RPC編程:http://dongxicheng.org/search-engine/thrift-rpc/