Agent skill

Glommio Locking Patterns

by celeriant in celeriant/celeriant-db

Locking patterns for Glommio's single-threaded async executors.

Apache-2.0Auto-check passedDatabases

Install Glommio Locking Patterns

skills CLI
$ npx skills add celeriant/celeriant-db --skill glommio-locking-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install celeriant/celeriant-db glommio-locking-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/celeriant/celeriant-db.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/glommio-locking-patterns .claude/skills/glommio-locking-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
glommio-locking-patterns
GitHub stars
114
Token cost
~876 tokens
SKILL.md length
435 words
Files
1
Skills in repo
13
Repo updated
First seen
Licence
Apache-2.0

At a glance

Locking patterns for Glommio's single-threaded async executors.

  • Works in 3 steps: Borrow, snapshot into owned data, drop… → Do async work with the snapshot (no… → Re-borrow, commit or rollback (sync)
  • Working with shard read/write paths
  • SKILL.md covers The Rule, RefCell vs RwLock, Snapshot Before Async and RwLock Timeouts, plus 4 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Glommio Locking Patterns is an agent skill from celeriant/celeriant-db. Locking patterns for Glommio's single-threaded async executors. Use when working with shard read/write paths, replication, or any async code needing synchronization. Critical for avoiding deadlocks.

Its SKILL.md is about 880 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases. The repository describes itself as: Fast, distributed per-aggregate event log with strict ordering and optimistic concurrency control. The licence is Apache-2.0.

When your agent uses it

  • Working with shard read/write paths
  • Any async code needing synchronization

Example prompts

  • “/glommio-locking-patterns”

Workflow steps

3 steps, taken from the first numbered list in SKILL.md.

  1. Borrow, snapshot into owned data, drop borrow (sync)
  2. Do async work with the snapshot (no borrow held)
  3. Re-borrow, commit or rollback (sync)

What it can do on your machine

Read from SKILL.md and the folder at commit d071a6d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Glommio Locking Patterns loads about 876 tokens when it runs. Until then it costs about 56 tokens; SKILL.md has 435 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~56
When it runs · the whole SKILL.md, loaded when a task matches
~876

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from celeriant/celeriant-db at commit d071a6d, republished under its Apache-2.0 licence (© celeriant). 435 words, ~876 tokens.

Download SKILL.mdSave it as .claude/skills/glommio-locking-patterns/SKILL.md (or your agent's skills folder).
name
glommio-locking-patterns
description
Locking patterns for Glommio's single-threaded async executors. Use when working with shard read/write paths, replication, or any async code needing synchronization. Critical for avoiding deadlocks.

Glommio Locking Patterns

The Rule

Glommio is single-threaded per executor. No thread contention, but async tasks interleave at .await points. The one rule that matters:

Never hold a RefCell borrow across an .await boundary. Another task will try to borrow while you're suspended. Deadlock under load.

RefCell vs RwLock

RefCell when all operations on the data are synchronous. No .await while borrowed.

Glommio RwLock when you need to hold across async operations (file I/O, network). More overhead, but safe across .await.

If you're unsure, ask: will I .await while holding this? Yes = RwLock. No = RefCell.

Snapshot Before Async

The core pattern for working with RefCell-wrapped state:

  1. Borrow, snapshot into owned data, drop borrow (sync)
  2. Do async work with the snapshot (no borrow held)
  3. Re-borrow, commit or rollback (sync)

This is how the fsync path works. take_sync_positions_snapshot() clones queue positions and swaps out the pending queue, then the borrow drops. Async disk I/O happens with no borrow held. Then commit or rollback re-borrows briefly.

RwLock Timeouts

All RwLock acquisitions use read_with_timeout / write_with_timeout wrappers with a 1-second deadline. Timeout returns PotentialDeadlock error with a location string instead of blocking forever. This catches bugs during development and prevents stuck tasks under high load.

Always use these wrappers. Always pass a descriptive location string.

See celeriant_rotating_log/src/rwlock_timeout.rs.

Loading Coordinator (Thundering Herd)

When multiple async tasks want the same cold aggregate from disk, only one does the I/O. Others wait on a per-key RwLock, then double-check the cache. Without the double-check after acquiring the lock, you get duplicate I/O.

See celeriant_shard/src/loading_coordinator.rs.

Show full SKILL.md (177 more words)Show less

Amortisation Coordinator (Fsync Batching)

Multiple concurrent writers coalesce into one fsync. First caller becomes leader (sleeps for configurable delay to accumulate followers), then performs the sync and broadcasts the result via LocalEvent. Followers never call the sync function. At most one sync executes at a time.

Key subtlety: the snapshot is captured before the queue is cleared. Reversing this loses writes that arrive between clear and snapshot.

See celeriant_shard/src/amortisation/coordinator.rs.

Semaphores (Concurrency Limiting)

Glommio Semaphore limits how many async tasks can do expensive work concurrently:

  • list_semaphore: bounds concurrent list operations. Lists allocate unbudgeted per-request memory, so unlimited concurrency can exhaust RAM.
  • cache_load_semaphore: bounds concurrent cache-miss disk scans. Without this, cold start read amplification saturates NVMe reads and starves the fsync write path.

Both configured via list_max_concurrent and read_max_concurrent in shard config.

Sync Gate (Rollback Serialisation)

The sync_gate: RwLock<()> in the amortisation coordinator serialises fsync execution and supports rollback. Normal fsyncs acquire a read lock (concurrent reads OK, one-at-a-time via the coordinator). Rollback acquires the write lock, which drains all in-flight fsyncs and blocks new ones until rollback completes.

© celeriant, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/glommio-locking-patterns of celeriant/celeriant-db.

Open the folder on GitHubat commit d071a6d

Compare with similar skills

Glommio Locking Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Glommio Locking Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Glommio Locking Patterns this skillceleriant/celeriant-db114—~876Automated safety check: PassApache-2.0
Mail Timeveliovgroup/mail-time143—~1kAutomated safety check: PassBSD-3-Clause
Tgf Server Devthkhxm/tgf128—~1.3kAutomated safety check: NotesMIT
Azure Storagemicrosoft/GitHub-Copilot-for-Azure2552 repos~1.3kAutomated safety check: PassMIT
Configure REST Cachestrapi-community/plugin-rest-cache155—~1.1kAutomated safety check: PassMIT
ArchitectYougLin-dev/Aha-Loop181—~2.2kAutomated safety check: PassMIT

Similar skills

  • Mail Time

    veliovgroup/mail-time

    A skill your agent uses when building, wiring, reviewing, or debugging MailTime and ostrio:mailer email queues for horizontally scaled Node.js, Bun, or Meteor apps.

    143 GitHub stars~1k tokensUpdated 7 days ago
    DatabasesAuto-check passed
  • Tgf Server Dev

    thkhxm/tgf

    基于 tgf v2(github.com/thkhxm/tgf/v2)用确定性的 tgfctl 工作流创建、验证和维护 Go 游戏服务器项目。

    128 GitHub stars~1.3k tokensUpdated 2 mo ago
    DatabasesAuto-check: notes
  • Azure Storage

    microsoft/GitHub-Copilot-for-Azure

    Official

    Azure Storage Services including Blob Storage, File Shares, Queue Storage, Table Storage, and Data Lake.

    255 GitHub starsUsed in 2 repos~1.3k tokens
    DatabasesAuto-check passed
  • Configure REST Cache

    strapi-community/plugin-rest-cache

    Choose and write a Strapi REST Cache configuration for a specific use case.

    155 GitHub stars~1.1k tokensUpdated 9 days ago
    DatabasesAuto-check passed
  • Architect

    YougLin-dev/Aha-Loop

    Designs system architecture and selects technology stack based on vision analysis.

    181 GitHub stars~2.2k tokensUpdated 8 mo ago
    DatabasesAuto-check passed
  • Pocketbase

    pockethost/pockethost

    Models PocketBase backends: collections, relations, auth, API rules, migrations, and architecture.

    1.4k GitHub stars~1k tokensUpdated 10 days ago
    DatabasesAuto-check passed

More from celeriant/celeriant-db

All 13 skills in this repo
  • Error Handling

    celeriant/celeriant-db

    Error handling patterns in Celeriant. An agent skill from celeriant/celeriant-db.

    114 GitHub stars~550 tokensUpdated 9 days ago
    Auto-check passed
  • Testing

    celeriant/celeriant-db

    How to write and run tests in Celeriant. An agent skill from celeriant/celeriant-db.

    114 GitHub stars~951 tokensUpdated 9 days ago
    Auto-check passed
  • Understanding Celeriant Structure

    celeriant/celeriant-db

    Celeriant codebase architecture, crate responsibilities, and how they fit together.

    114 GitHub stars~803 tokensUpdated 9 days ago
    Auto-check passed
  • Extract A Type

    celeriant/celeriant-db

    Refactor a named Rust type or its surrounding code with an agreed scope.

    114 GitHub stars~934 tokensUpdated 9 days ago
    Auto-check passed
  • Client Server Protocol

    celeriant/celeriant-db

    Celeriant's client-server protocol invariants, network behavior, failure modes, and shard routing.

    114 GitHub stars~1.6k tokensUpdated 9 days ago
    Auto-check passed
  • Database Architecture

    celeriant/celeriant-db

    Core architecture invariants for Celeriant. An agent skill from celeriant/celeriant-db.

    114 GitHub stars~1.5k tokensUpdated 9 days ago
    Auto-check passed

Questions about Glommio Locking Patterns

What does Glommio Locking Patterns do?

Locking patterns for Glommio's single-threaded async executors. Glommio Locking Patterns is an agent skill from celeriant/celeriant-db. Locking patterns for Glommio's single-threaded async executors.

When should I use Glommio Locking Patterns?

Glommio Locking Patterns fits situations like: working with shard read/write paths; any async code needing synchronization.

How do I install Glommio Locking Patterns in Claude Code?

Run `npx skills add celeriant/celeriant-db --skill glommio-locking-patterns -a claude-code`. Or copy the skill folder (.claude/skills/glommio-locking-patterns in celeriant/celeriant-db) into .claude/skills/glommio-locking-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Glommio Locking Patterns in Codex?

Run `npx skills add celeriant/celeriant-db --skill glommio-locking-patterns -a codex`. Or copy the skill folder (.claude/skills/glommio-locking-patterns in celeriant/celeriant-db) into .agents/skills/glommio-locking-patterns in your project. Codex loads it when a task matches its description.

Can I use Glommio Locking Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add celeriant/celeriant-db --skill glommio-locking-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/glommio-locking-patterns, .gemini/skills/glommio-locking-patterns, .github/skills/glommio-locking-patterns and .opencode/skills/glommio-locking-patterns in your project.

What does Glommio Locking Patterns need to run?

SKILL.md names no scripts, command-line tools or credentials: Glommio Locking Patterns is instructions for the agent only.

Does Glommio Locking Patterns access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Glommio Locking Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Glommio Locking Patterns use?

Glommio Locking Patterns is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Glommio Locking Patterns use?

About 876 tokens (SKILL.md is roughly 3.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Glommio Locking Patterns?

Skills that share tags, products or a category with Glommio Locking Patterns: Mail Time (veliovgroup/mail-time, 143 stars), Tgf Server Dev (thkhxm/tgf, 128 stars), Azure Storage (microsoft/GitHub-Copilot-for-Azure, 255 stars) and Configure REST Cache (strapi-community/plugin-rest-cache, 155 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Glommio Locking Patterns?

celeriant (a GitHub organization) maintains it in celeriant/celeriant-db, which has 114 GitHub stars. The repository holds 13 skills in this directory. The repository was last updated on September 28, 2026.

Source: celeriant/celeriant-db on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.