All work

Live

Ordered plugin data on MySQL

A small data layer that moved plugin storage onto MySQL and guarantees each plugin’s reads and writes happen in the order they were made.

Role
Design and implementation
Stack
Lua (GLua), MySQL
Context
Shared infrastructure for every plugin on Diverge Networks
Status
Live

The problem

Plugins save and load their data asynchronously. When a plugin wrote something and read it back soon after, the read could come back before the write had finished, returning stale data.

The design

Code excerpt coming soon

The per-plugin queue, about 70 lines: enqueue, run the next operation, and advance on success or failure.

assets/excerpts/plugin-data-queue.lua

Adapted from production code, lightly edited for readability.