Skip to content
@go-ruby-pstore

go-ruby-pstore

go-ruby-pstore

go-ruby-pstore

Ruby's PStore transaction engine in pure Go — MRI-compatible, no cgo.

🌐 Website · 📚 Documentation

Docs License: BSD-3-Clause Go 1.26.4+ Coverage 100%


go-ruby-pstore is a pure-Go (no cgo) reimplementation of the transaction engine at the heart of Ruby's PStore — MRI 4.0.5's transactional, Marshal-backed object store (the pstore-0.2.1 gem). It runs the load → transaction-body → commit/abort state machine over a Hash "table" and serialises that table with go-ruby-marshal, so the on-disk bytes are byte-compatible with a file written by MRI's PStore: a real ruby -rpstore file loads here, and a file this engine commits is read back unchanged by MRI. It was extracted from rbgo's internals into a reusable standalone library: no dependency on the Ruby runtime, the dependency runs the other way. The file half — opening the store (O_CREAT), flock(LOCK_SH/LOCK_EX), the atomic-rename / rewind-truncate save strategies — is injected as a two-method Backend; rbgo wires the real os.File + syscall.Flock, tests use an in-memory backend. It is the PStore backend for go-embedded-ruby, bound by rbgo as a native module just like go-ruby-regexp and go-ruby-erb — differential-tested against MRI, 100% coverage, CI green across 6 arches and 3 OSes.

Repositories

Repo What it is
pstore the library: Ruby's PStore transaction engine in pure Go
docs MkDocs Material documentation, versioned with mike, served at /docs/
go-ruby-pstore.github.io the Hugo landing page
brand logos and brand assets

Principles

  • Pure Go, zero cgo. Cross-compiles and embeds anywhere; a static binary by default.
  • Extracted from rbgo, reusable by anyone. A standalone library lifted from rbgo's internals; rbgo binds it as a native module, the same pattern as go-ruby-regexp and go-ruby-erb.
  • MRI byte-exact on disk. The table is Marshal.dump / loaded through go-ruby-marshal, so a committed file is byte-compatible with one written by MRI's PStore — validated by a differential oracle against the ruby binary, round-tripped both directions (MRI→Go and Go→MRI).
  • The file seam is injected. Locking and the save strategy are the host's job, supplied through a two-method Backend: rbgo wires the real os.File + syscall.Flock, tests use an in-memory backend so the whole suite is deterministic and Ruby-free.
  • 100% test coverage is the target, enforced as a CI gate.

Status

Complete — MRI byte-exact on disk. Faithful port of PStore's transaction semantics: commit on normal exit (skipping the write when nothing changed, MRI's checksum/size guard), Commit / Abort early exit, read-only transactions (writes raise PStore::Error), the full error taxonomy with MRI's exact messages, and the on-disk Marshal format via go-ruby-marshal — so files round-trip both directions with MRI's PStore. 100% coverage, gofmt + go vet clean, CI green across the six 64-bit Go targets (amd64, arm64, riscv64, loong64, ppc64le, s390x) and three operating systems. It is bound into the go-embedded-ruby (rbgo) ecosystem as a native module, where the file/locking layer lives.

BSD-3-Clause.

Popular repositories Loading

  1. pstore pstore Public

    Pure-Go, MRI-4.0.5-faithful Ruby pstore (no cgo)

    Go

  2. brand brand Public

    Brand assets — logos & icons

  3. .github .github Public

    Organization profile

  4. go-ruby-pstore.github.io go-ruby-pstore.github.io Public

    Landing page

    HTML

  5. docs docs Public

    Documentation

    Go

Repositories

Showing 5 of 5 repositories

People

This organization has no public members. You must be a member to see who’s a part of this organization.

Top languages

Loading…

Most used topics

Loading…