A rust library that implements Remote Procedure Calls. RPC is used in distributed computing to execute a function in a different address space but written as if it's a normal function call.
Just a project to help me learn rust.
-
Clone the repo
-
Build it to create
rrpc
binary
cargo build
- Create your project
cargo new <proj>
-
Add rrpc as a build-dependency
-
Design your IDL and write it
input.txt
(syntax below) -
Write build.rs using which call
rrpc
to generateclient_gen.rs
andserver_gen.rs
-
Use it in your source code
Refer to example/ for a working solution.
rrpc currently supports enum, struct and functions. Functions support just int and string as params (for now).
Example .txt file:
FUNCTION my_func
IN INT var1
IN INT var2
ENDFUNCTION
ENUM test_enum
val1 u32 1
val2 u32 2
ENDENUM
STRUCT structName
INT intvar
STRING str
ENDSTRUCT
V1
- Base bones (lib + test)
- Get it running
- String parsing
V2
- Pass port as a variable
- JSON serialization
- User can choose btw string/json at init time
V3
- Multiple clients. To speed up, server listens and spawns a short lived thread to execute each request from a pool?
- If sync, server main thread executes and returns. If async, dispatches a worker thread to do the job
V4
- Read from a .txt file and write to a .rs file
- Add test infra to test multiple scenarios
- Support enum
- Support struct with basic data types (int and string)
V5
- Support functions
- Use json to pack and unpack
- Test with dummy mains
V6
- Crate logic cleanup. Have a single crate?
- Import it and try using it to generate .rs files
- Fix client packing
V7
-
Build shared libraries and link them - Using above .txt cons, signatures of txt functions will be available to client and definition in server
- How would a user pass this?
V8
- Example project using the rpc crate
V9
- Pass enum, structs created in .txt file in the functions
- Support synchronous functions
- Server should use worker threads for async functions and main thread for sync functions
V10
- Proper error handling
- Refactor. Try to understand more about designing code in rust.
V11
- Horizontal and vertical scaling?
- Parse a language instead of simply structs and enums?
- Do computation in parts and then aggregate?
- user imports this crate as a dependency
- make a .txt file with the specified IDL
- make a small 'build.rs' to generate code
- generates all the files
- user codes their client + server implementation around it