DEV Community

Gyubong
Gyubong

Posted on

rraft-py: Unofficial Python Binding of the tikv/raft-rs

Hello, I am a developer working as a DevOps engineer at a small IT startup in Korea.
I should've use raft implementation for my company's proprietary orchestrator.

Our company product is developed in Python, but there doesn't seem to be "de facto" standard when it comes to raft, at least to my knowledge.

So, I decided to search for papers on raft implementation. But these papers exceeded 250 pages, and I found it overwhelming to comprehend and implement all the knowledge therein. (From previous experience, I know that once the complexity of the source code reaches a certain threshold, maintaining it becomes quite a challenge, especially while managing full-time work.)

Hence, I resolved to write Python bindings for a well-established, battle-tested raft library. I initially considered writing bindings for Hashicorp's Raft implementation, but handling asynchronous things seems was tricky. Upon the advice of a senior developer, I turned to pyo3 to create bindings for 'tikv/raft-rs'.

The process of writing bindings was more challenging than I had anticipated.

Anyway after much struggle, I succeeded in implementing bindings that pass all the harness test codes.

However, having written all the source codes, I can't help but question whether I should have opted for a different implementation such as async-raft or Hashicorp's raft implementation. I also wonder if it would have been more prudent to port the source codes itself, rather than writing bindings. Numerous thoughts have been running through my mind.

What are your thoughts on this Python binding implementation?

Top comments (1)

Collapse
 
jopemachine profile image
Gyubong