Skip to content

masroof-maindak/jalebi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jalebi

Jalebi (+ Namak Paare) is a peculiar little server-client application set responsible for creating an authenticated 'cloud-based' storage environment.

I'm quite content with its current state and would consider it my first major C program -- one that taught me how to truly use/vastly enhanced my knowledge of an array of tools including but not limited to TSan, Valgrind, gdb, perf and most importantly, man pages.

It has also taught me how much I fucking hate not having a fixed, idiomatic way to handle errors, for instance Rust's Result types, or Go's error types.

Both binaries, but the server in particular, are to the best of my juvenile knowledge, quite robust in terms of error-handling, catering to imperfect input, and tiny nitpicks pertaining to the usage of certain syscalls/libc functions and ANSI-C compliance -- the lattermost notably requiring arcane knowledge uncovered by poring through tomes inscribed by wise sages of the past (i.e, reading manpages).

In hindsight, there are a handful of things I could have improved upon, for instance 'typing' erroneous return values via enums, using the sendfile() syscall for some spicy zero-copy action via DMA (I don't regret doing it the 'manual way' considering this was my first proper foray into C sockets), minorly-incomplete clean-exiting for the threadpool, or some rather trivial TODOs, but I am choosing to leave this project as is to serve as a keepsake of days (and skill levels) bygone.

Furthermore, I am quite proud of certain things, for instance the novel (albeit contrived) architecture, profoundly graceful cond_var_t usage (or so I would like to delude myself), and the from-scratch, generic thread-pool & queue implementations, notwithstanding them being a staple for C programmers, provided a delectable respite from wanting to bash my head against the wall whilst x/-ing my way through gdb.

Architecture

architecture

Dependencies

  • GNU Readline
  • libbsd
  • SQLite3
  • OpenSSL
  • libuuid

Arch

sudo pacman -S lib32-sqlite lib32-openssl readline libbsd util-linux

Debian

sudo apt install libsqlite3-dev libssl-dev libreadline-dev libbsd-dev uuid-dev

Usage

git clone https://github.com/masroof-maindak/jalebi.git
cd jalebi
make all
./jalebi      # server
./namak-paare # client

TODOs

  • Thread monitoring - Restart killed threads, etc.
    • How to find out a thread's died? Ping-ponging.
  • close() -> shutdown() for sockets?
  • Signal handlers; gracefully deal w/ sockets/readline(?)/database/threadpool/etc.

Acknowledgements

About

Lightweight multi-threaded cloud storage service.

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  

Languages