diff --git a/docs/remote-interface.md b/docs/remote-interface.md new file mode 100644 index 0000000..84f24ab --- /dev/null +++ b/docs/remote-interface.md @@ -0,0 +1,67 @@ +# Remote interface +## Introduction + +``` + +-----------------------------------------------+ + | remote interface | + | +----------------------------------------+ | + | +----------------------------------------+| | + | +----------------------------------------+|+ | + | | RabbitMQ-provided RPC |+ | + | +----------------------------------------+ | + | | ^ | + +------------|---------------------|------------+ + +------------|---------------------|------------+ + | | RabbitMQ broker | | + | | | | + | | +------------------+ | + | v +------------------+| | + | +------------------+ +------------------+|| | + | | incoming queue | | private queue ||| | + | | | | ||| | + | | - trytes | | - PoW result ||| | + | | - mwm | | ||+ | + | | | | |+ | + | +------------------+ +------------------+ | + | | ^ | + +------------|---------------------|------------+ + v | + +---------------------------------------------+ + +---------------------------------------------+| + +---------------------------------------------+|+ + | remote worker |+ + +---------------------------------------------+ +``` +To support asynchronouse remote procedure call, remote interface, `Remote_ImplContext`, in dcurl provides an interface to implement it. dcurl currently uses RabbitMQ C client to implement asynchronouse RPC in remote interface. Remote interface provides thread management to can run an asynchronouse RPC per thread. + +Here are detailed implementations of the RabbitMQ-provided RPC pattern as follows: +* Asynchronouse RPC requests are inserted into the message queue, `incoming_queue`, in RabbitMQ broker +* Asynchronouse RPCs with exclusive private queues (callback queues) with TTL = 10s property +* Correlation ID is not used +* An asynchronouse RPC uses a connection to RabbitMQ broker +* Remote workers can obtain requests from `incoming_queue` by default exchange of RabbitMQ broker + +## How to test remote interface in localhost +You need to open three terminals + +Terminal 1: Run the RabbitMQ broker You can quickly use docker to run the RabbitMQ broker, rabbitmq +``` +$ sudo docker run -d rabbitmq +``` + +Terminal 2: Run remote workers +``` +$ ./build/remote-worker +``` +How to build remote worker on FPGA board +``` +$ make BUILD_REMOTE=1 BUILD_FPGA_ACCEL=1 BOARD=de10nano +``` + +Terminal 3: Run check +``` +$ make BUILD_REMOTE=1 BUILD_DEBUG=1 check +``` + +## Requirements +Remote interface requires RabbitMQ broker