1、 Demand background
It can be found from the GitHub of nebula that Nebula provides a client SDK for the following languages:
Our company’s business development language is c#, but Nebula does not provide the client of c# version.
Because Nebula supports source code compilation, you simply have to try to compile one yourself.
2、 Introduction to thrift
1. Thrift is an open source project contributed by Facebook to the Apache foundation in 2007: https://thrift.apache.org/
Thrift can support multiple programming languages, such as C + +, c#, cocoa, Erlang, Haskell, Java, ocami, Perl, PHP, python, ruby and Smalltalk.
Thrift can be used as a binary high-performance communication middleware to support data (object) serialization and various types of RPC services
2. Facebook also maintains a thrift, which is quite different from Apache’s thrift. It rewrites the compiler and re implements a fully asynchronous thrift server: https://github.com/facebook/fbthrift
Facebook Thrift is not a distribution of Apache Thrift.
This is an evolved internal branch of Thrift that Facebook re-released to open source community in February 2014.
Facebook Thrift was originally released closely tracking Apache Thrift but is now evolving in new directions.
In particular, the compiler was rewritten from scratch and the new implementation features a fully asynchronous Thrift server.
3. The client of nebula is compiled based on the thrift file, but the thrift compiler used is not the thrift contributed by Facebook to Apache, but the thrift maintained by Facebook itself, which is a bit around.
4. The thrift template provided by nebula is: https://github.com/vesoft-inc/nebula-common/tree/master/src/common/interface
3、 Preparation before Compilation
1. Operating system
Through the local cenos 7 built by VMware, the virtual machine is connected with the host key through the NAT network, with 8g memory. The host has a ladder to FQ
2. Installation dependency
root# yum update root# yum install -y make \ m4 \ git \ wget \ unzip \ xz \ readline-devel \ ncurses-devel \ zlib-devel \ gcc \ gcc-c++ \ cmake \ gettext \ curl \ redhat-lsb-core \ bzip2
3. Check whether GCC and cmake versions on the host are correct
root# g++ --version root# cmake --version
It was found that the version was incorrect and git clone was not working well, so we had to manually download version 2.0.1 of nebula common: https://github.com/vesoft-inc/nebula-common/tree/v2.0.1
4. Unzip the above nebula-common-2.0.1.zip file and enter the root directory of nebula-common-2.0.1
5. Execute the following commands in sequence:
//Install cmake. root# ./third-party/install-cmake.sh cmake-install //Enable cmake. root# source cmake-install/bin/enable-cmake.sh //Add write permissions to the opt directory. root# sudo mkdir /opt/vesoft && sudo chmod -R a+w /opt/vesoft //Install GCC. Installation to the opt directory requires write permission, and users can also modify it to other directories. root# ./third-party/install-gcc.sh --prefix=/opt //Enable GCC. root# source /opt/vesoft/toolset/gcc/7.5.0/enable //Install third party dependencies root# ./third-party/install-third-party.sh
1. Enter the root directory of nebula-common-2.0.1 above
2. Execute commands in sequence
3. View the c# code generated based on thrift template
5、 Follow up work
At present, only the definition and analysis of the corresponding c# interface are generated according to the thrift template. It is also necessary to refer to the Java client code provided by nebula and translate it into the corresponding c# code
6、 Reference documents
This is the end of this article on c# version of the nebula client compilation. For more relevant c# version of the nebula client compilation content, please search the previous articles of developeppaer or continue to browse the relevant articles below. I hope you will support developeppaer in the future!