thrift-protocol

Is safe to rename a field in Thrift IDL?

。_饼干妹妹 提交于 2021-01-29 09:18:16
问题 Is it safe to deprecate a field in Thrift by renaming if the field is no longer used by clients? My understanding is this should work as long as we don't change the type. For example From struct FooResponse { 1: optional i32 foo } To struct FooResponse { 1: optional i32 fooDeprecated } 回答1: Yes it is 100% safe. Thrift only deals with field IDs internally. The names of a struct as well as method argument names are used to generate field names in the generated code only. They do not even go

Is safe to rename a field in Thrift IDL?

余生长醉 提交于 2021-01-29 09:06:58
问题 Is it safe to deprecate a field in Thrift by renaming if the field is no longer used by clients? My understanding is this should work as long as we don't change the type. For example From struct FooResponse { 1: optional i32 foo } To struct FooResponse { 1: optional i32 fooDeprecated } 回答1: Yes it is 100% safe. Thrift only deals with field IDs internally. The names of a struct as well as method argument names are used to generate field names in the generated code only. They do not even go

Apache Thrift not loading PHP definition

你说的曾经没有我的故事 提交于 2020-01-05 04:12:05
问题 I have the following codes. I have checked the files and they exist. require_once "/usr/lib/php/Thrift/ClassLoader/ThriftClassLoader.php"; use Thrift\ClassLoader\ThriftClassLoader; $GEN_PHP = __DIR__ . "/gen-php/"; $loader = new ThriftClassLoader(); $loader->registerNamespace("Thrift", "/usr/lib/php/"); $loader->registerDefinition("hello", $GEN_PHP); $loader->register(); use Thrift\Protocol\TBinaryProtocol; use Thrift\Transport\TPhpStream; use Thrift\Transport\TBufferedTransport; class

Thrift python 3.4 TypeError: string argument expected, got 'bytes'

梦想的初衷 提交于 2020-01-03 18:59:35
问题 I am trying out Apache Thrift using python 3.4 which Thrift seems to have support, since it has lib.linux-x86_64-3.4 under build directory. But I am keeping getting this error message File "/home/qunzi/Downloads/thrift-0.9.2/lib/py/build/lib.linux-x86_64-3.4/thrift/transport/TTransport.py", line 163, in write self.__wbuf.write(buf) TypeError: string argument expected, got 'bytes' Anybody knows what's going on, and possibly with a solution? Here below is the relevant code socket = TSocket

How to I get started with Apache Thrift? [closed]

本秂侑毒 提交于 2019-12-20 08:48:53
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I wanted to create a simple Thrift server for C++ and provide a client with Python language. I went to the official site but it lacks

How to use java built-in exception in Thrift IDL

心已入冬 提交于 2019-12-12 09:25:37
问题 I'd like to throws some java built-in exception such IOException in the Thrift IDL. like this: service B{ void removeLease() throws (1:ioexception e), } however, the Thrift compiler warns that ioexception doesn't be defined. 回答1: Every java exception is serializable, so it's possible to wrap it into thrift exception. Thrift code: exception SerializedException { 1: required binary payload } service MyService { int method(1: required string param) throws (1: SerializedException

All subcolumns for multiple supercolumns against a key in cassandra

两盒软妹~` 提交于 2019-12-12 04:07:05
问题 Can we read list of all available subcolumns for multiple supercolumns against a key in one request. for example we have a key "y1" with supercolumns x1,x2,x3 x1 has subcolumns with names like c1,c2,c3 x2 has subcolumns c9 and c8 x3 has c1,c3,c10 I want to read all the subcolumns in one request against one key "y1". 回答1: You'll want to use a super slice query and specify a range. Here's a Hector example: SuperSliceQuery query = HFactory.createSuperSliceQuery(keyspace, ... serializers ...);

Thrift server: detect client disconnections (C++ library)

試著忘記壹切 提交于 2019-12-11 12:15:12
问题 When running a Thrift server, it's necessary to handle cases where the client unexpectedly disconnects. This might happen while the server is processing an RPC. This is not an uncommon occurrence if the server has a blocking call which is often used to pend an operation in order to notify clients of asynchronous events. In any case, it's a corner case that can and does happen on any server and cleanup is often necessary. Fortunately Thrift provides the class TServerEventHandler to hook into

How to convert thrift objects to readable string and convert it back?

北战南征 提交于 2019-12-11 03:35:17
问题 Sometimes, we need to create some thrift objects in unit tests. We can do it by manually create object using Java code, like: MyObj myObj = new MyObj(); myObj.setName("???"); myObj.setAge(111); But which is not convenient. I'm looking for a way to create objects with some readable text. We can convert thrift objects to JSON with TSimpleJSONProtocol , and get very readable JSON string, like: { "name": "???", "age": 111 } But the problem is TSimpleJSONProtocol is write only, thrift can't read