#write-ahead-log #fifo-queue #wal #disk #operations #revert #word

qwal

A disk baced Write Ahead Log that can functuin as a FIFO queue

1 unstable release

0.1.0 Apr 10, 2024

#621 in Database interfaces

Download history 288/week @ 2024-07-19 51/week @ 2024-07-26 22/week @ 2024-08-02 123/week @ 2024-08-09 13/week @ 2024-08-16 21/week @ 2024-08-23 57/week @ 2024-08-30 8/week @ 2024-09-06 22/week @ 2024-09-13 85/week @ 2024-09-20 203/week @ 2024-09-27 47/week @ 2024-10-04 112/week @ 2024-10-11 220/week @ 2024-10-18 91/week @ 2024-10-25 16/week @ 2024-11-01

442 downloads per month

Apache-2.0

50KB
1K SLoC

Rust 795 SLoC // 0.1% comments Shell 235 SLoC // 0.0% comments

Repository Template  Build Status Quality Checks License Checks Security Checks Code Coverage

Queue like disk backed WAL


Pronouced Quál - from the german word for agony - because it is.

features

tokio

uses the tokio types

async-std

uses async-std types

Operations

The basic concept is simple, qwal supports exactly 4 operations:

push

Appends a new entry to the end of the queue, returning its index.

pop

Reads the next index from the queue, returning the previous entry and its index if one exists, or none if the queue is empty.

ack

Acknowledges processing of an entry, confirming it is enqueued.

revert

Reverts back to the last acknowledged entry in the queue - will clear/drain any entry since that point.

Performance Characteristics

push

Writes the data to disk and performs a fsync. Also a seek might be executed if a pop was performed since the last push.

pop

Reads the data from disk. Also a seek is performed if a push since the alst reads.

ack

No disk operations are performed, ack's are persisted either during a push operation or as part of the shutdown sequence.

Operations

qwal provides all limits as soft limits, meaning they are considered reached after an operation has exceeded them, and not before.

chunk_size

To allow easier reclamation of space the WAL is stored in multiple chunks. The chunk size defines the limit. A chunk is considered full once a push makes it exceed the chunk_size

max_chunks

The soft limit of of chunks that can be active and open at the same time. The WAL is considered full when max_chunks + 1 would need to be created.

Dependencies

~2–13MB
~154K SLoC