<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Rust on Mini Fish</title>
    <link>https://blog.minifish.org/tags/rust/</link>
    <description>Recent content in Rust on Mini Fish</description>
    <image>
      <title>Mini Fish</title>
      <url>https://blog.minifish.org/android-chrome-512x512.png</url>
      <link>https://blog.minifish.org/android-chrome-512x512.png</link>
    </image>
    <generator>Hugo -- 0.165.0</generator>
    <language>en-US</language>
    <copyright>Mini Fish 2014-present. Licensed under CC-BY-NC</copyright>
    <lastBuildDate>Mon, 01 Jun 2026 09:00:00 +0800</lastBuildDate>
    <atom:link href="https://blog.minifish.org/tags/rust/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>tegdb-server: Putting a PostgreSQL-Compatible Protocol in Front of TegDB</title>
      <link>https://blog.minifish.org/posts/tegdb-server-postgres-compatible/</link>
      <pubDate>Mon, 01 Jun 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/tegdb-server-postgres-compatible/</guid>
      <description>A project note on tegdb-server, a Rust server that puts a PostgreSQL-compatible protocol and network boundary in front of the TegDB embedded database.</description>
      <content:encoded><![CDATA[<p><code>tegdb-server</code> is a PostgreSQL-compatible database server built on top of TegDB. It explores what changes when an embedded database becomes a networked service.</p>
<p>The project is small, but the architectural jump is large.</p>
<h2 id="why-add-a-server">Why add a server</h2>
<p>An embedded database can keep many assumptions local:</p>
<ul>
<li>one process owns access</li>
<li>file paths are local</li>
<li>query state is in-process</li>
<li>errors are library errors</li>
<li>clients are application code</li>
</ul>
<p>A server changes the boundary. Now there are connections, protocol messages, authentication questions, configuration, network errors, allocation pressure, and client compatibility expectations.</p>
<p>That is why this project exists: to study that boundary.</p>
<h2 id="postgresql-compatibility">PostgreSQL compatibility</h2>
<p>PostgreSQL compatibility is useful because it gives the project a familiar client surface. If a normal client can connect, the database becomes easier to test and demonstrate.</p>
<p>But compatibility is also a trap. The PostgreSQL ecosystem expects a lot:</p>
<ul>
<li>protocol behavior</li>
<li>type handling</li>
<li>error responses</li>
<li>transaction semantics</li>
<li>SQL behavior</li>
<li>metadata queries</li>
</ul>
<p>The right goal for a small project is progressive compatibility, not pretending to be PostgreSQL.</p>
<h2 id="storage-boundary">Storage boundary</h2>
<p><code>tegdb-server</code> keeps TegDB as the storage engine and adds a server layer in front. That separation is useful:</p>
<ul>
<li>TegDB owns on-disk behavior</li>
<li>the server owns connections and protocol handling</li>
<li>configuration stays explicit</li>
<li>future distribution experiments have a place to attach</li>
</ul>
<p>The project README frames this as progressive scalability from single-node to more distributed deployment shapes. That is ambitious, but it starts with a concrete first step: one server in front of one storage engine.</p>
<h2 id="what-i-learned">What I learned</h2>
<p>The protocol path has different performance concerns from the storage path. Per-query allocations, message parsing, response construction, and connection lifecycle can dominate before the storage engine becomes interesting.</p>
<p>This is a useful reminder: a database is not only its storage engine. It is also a wire protocol, client contract, operations surface, and set of compatibility promises.</p>
<h2 id="open-source-status">Open source status</h2>
<p><code>tegdb-server</code> is public because it pairs naturally with the public TegDB experiment. It is best read as a learning project about database server boundaries.</p>
]]></content:encoded>
    </item>
    <item>
      <title>cta-guard: Risk Controls Before Trading Logic</title>
      <link>https://blog.minifish.org/posts/cta-guard-trading-risk-system/</link>
      <pubDate>Sun, 31 May 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/cta-guard-trading-risk-system/</guid>
      <description>A sanitized project note on cta-guard, a Rust trading runtime and research tool focused on risk controls, ingestion, backtesting, and operational guardrails.</description>
      <content:encoded><![CDATA[<p><code>cta-guard</code> is a private trading-system project. It includes a runtime loop, ingestion tools, backtesting, walk-forward validation, health checks, and venue integration.</p>
<p>This is the kind of project where the most useful public topic is not the trading strategy. It is the guardrail design.</p>
<h2 id="why-risk-first">Why risk first</h2>
<p>Trading code has a dangerous failure mode: a bug can become a position.</p>
<p>That changes the engineering priority. Before clever strategy logic, the system needs operational controls:</p>
<ul>
<li>dry-run mode</li>
<li>explicit venue adapters</li>
<li>heartbeat checks</li>
<li>halted state</li>
<li>read-only mode</li>
<li>data freshness checks</li>
<li>position and exposure constraints</li>
<li>clear separation between research and live execution</li>
</ul>
<p>The project name reflects that priority. The guard matters before the CTA.</p>
<h2 id="system-shape">System shape</h2>
<p>The maintained path is a modular trader stack:</p>
<ul>
<li>runtime orchestration</li>
<li>risk app service</li>
<li>strategy app service</li>
<li>backtest app service</li>
<li>domain models and ports</li>
<li>SQLite repositories</li>
<li>venue adapters and stubs</li>
</ul>
<p>There are separate binaries for live or dry-run runtime, health checks, ingestion, historical import, backtest, and walk-forward validation.</p>
<p>That separation is important. A backtest binary should not have the same operational authority as a live execution process.</p>
<h2 id="what-should-stay-private">What should stay private</h2>
<p>Some details are not appropriate for a public blog:</p>
<ul>
<li>strategy parameters</li>
<li>production configuration</li>
<li>account or venue details</li>
<li>exact deployment topology</li>
<li>operational thresholds</li>
<li>anything that could imply a trade recommendation</li>
</ul>
<p>The safe public layer is architecture: how to keep execution constrained, observable, and stoppable.</p>
<h2 id="what-i-learned">What I learned</h2>
<p>Risk control is not one module. It is a state machine that should shape the whole runtime.</p>
<p>A good trading system needs to answer boring questions quickly:</p>
<ul>
<li>is data fresh?</li>
<li>is the venue reachable?</li>
<li>is the runtime allowed to trade?</li>
<li>what happens after an error?</li>
<li>can the system stop without making things worse?</li>
<li>can research code accidentally reach execution?</li>
</ul>
<p>If those answers are unclear, the system is not ready for live use.</p>
<h2 id="current-status">Current status</h2>
<p><code>cta-guard</code> is private. I may continue writing about its engineering lessons, but only at the level of risk design, runtime isolation, and validation workflow.</p>
]]></content:encoded>
    </item>
    <item>
      <title>scale-kv: A Storage Experiment About Complexity</title>
      <link>https://blog.minifish.org/posts/scale-kv-storage-experiment/</link>
      <pubDate>Sat, 30 May 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/scale-kv-storage-experiment/</guid>
      <description>A project note on scale-kv, a Rust experiment with transactional KV storage, page B&#43;trees, quorum commit paths, Cap&amp;#39;n Proto RPC, and storage-system design notes.</description>
      <content:encoded><![CDATA[<p><code>scale-kv</code> is a Rust storage experiment. It contains transactional KV code, page structures, quorum client paths, Cap&rsquo;n Proto RPC, performance notes, and a growing set of documents about capacity, observability, fault drills, and roadmap choices.</p>
<p>The most useful lesson from the project is not a feature. It is how quickly storage complexity expands.</p>
<h2 id="what-it-explores">What it explores</h2>
<p>The codebase touches several storage-system ideas:</p>
<ul>
<li>transactional KV</li>
<li>page-based B+tree structures</li>
<li>secondary indexes</li>
<li>WAL encoding and replay</li>
<li>embedded compute paths</li>
<li>quorum commit experiments</li>
<li>RPC schema generation</li>
<li>redb and sled comparisons</li>
<li>performance baselines</li>
</ul>
<p>Each of these is reasonable on its own. Together, they create a system that needs strong boundaries to stay understandable.</p>
<h2 id="why-this-is-hard">Why this is hard</h2>
<p>Storage systems are full of cross-cutting constraints:</p>
<ul>
<li>write durability affects read visibility</li>
<li>page layout affects compaction and recovery</li>
<li>transactions affect indexing</li>
<li>indexes affect write amplification</li>
<li>replication affects latency and failure handling</li>
<li>observability affects whether any benchmark can be trusted</li>
</ul>
<p>It is easy to add one more subsystem and hard to know when the conceptual model has become too large.</p>
<h2 id="documents-as-part-of-the-project">Documents as part of the project</h2>
<p>One good part of <code>scale-kv</code> is that it includes design notes: API drafts, capacity models, fault drills, observability notes, and performance snapshots.</p>
<p>For this kind of experiment, documents are not decoration. They are the only way to keep track of what the system is supposed to prove.</p>
<h2 id="what-i-learned">What I learned</h2>
<p>The project reinforced a simple rule: decide what a storage experiment is testing before building the next layer.</p>
<p>If the goal is page structure, do not also invent distributed commit. If the goal is quorum behavior, use the simplest storage backend that can support the test. If the goal is API design, avoid mixing it with WAL recovery work.</p>
<p>That does not mean the project failed. It means the project taught the lesson it was supposed to teach: complexity is the main resource being spent.</p>
<h2 id="current-status">Current status</h2>
<p><code>scale-kv</code> is private and experimental. It may remain a lab rather than a product, which is a valid outcome for a systems project.</p>
]]></content:encoded>
    </item>
    <item>
      <title>QuackLake: A DuckDB-WASM Analytics Prototype</title>
      <link>https://blog.minifish.org/posts/quacklake-wasm-analytics-prototype/</link>
      <pubDate>Fri, 29 May 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/quacklake-wasm-analytics-prototype/</guid>
      <description>A project note on QuackLake, a prototype combining DuckDB-WASM compute, MinIO object storage, a Rust API, and an HTTP range gateway.</description>
      <content:encoded><![CDATA[<p>QuackLake is a WASM-first analytics prototype. It combines DuckDB-WASM compute, MinIO object storage, a Rust control plane, and an HTTP range gateway.</p>
<p>The project is deliberately prototype-shaped. It asks what an analytics stack looks like when browser or WASM compute is treated as a real part of the system rather than only a demo surface.</p>
<h2 id="components">Components</h2>
<p>The local stack is split into small services:</p>
<ul>
<li>API control plane</li>
<li>HTTP range gateway over object storage</li>
<li>Node runner using DuckDB-WASM</li>
<li>browser query UI</li>
<li>MinIO for S3-compatible storage</li>
</ul>
<p>That separation makes the data flow easier to inspect:</p>
<ol>
<li>data lives in object storage</li>
<li>range requests expose only needed bytes</li>
<li>DuckDB-WASM runs queries</li>
<li>lineage or job metadata can be tracked by the control plane</li>
</ol>
<h2 id="why-duckdb-wasm">Why DuckDB-WASM</h2>
<p>DuckDB is already a strong fit for local analytics. DuckDB-WASM adds a different deployment shape: query execution can move closer to the browser, a worker, or a constrained runtime.</p>
<p>The attraction is not that every analytics job should run in the browser. The attraction is that the compute boundary becomes flexible.</p>
<h2 id="what-the-prototype-tests">What the prototype tests</h2>
<p>QuackLake is useful for testing system questions:</p>
<ul>
<li>how painful are range requests in practice?</li>
<li>where should metadata live?</li>
<li>what should the API own?</li>
<li>when does browser compute become awkward?</li>
<li>how much can object storage simplify the backend?</li>
</ul>
<p>These are architectural questions, not UI questions.</p>
<h2 id="what-i-learned">What I learned</h2>
<p>WASM analytics is promising, but the hard parts move around. Query execution can be surprisingly capable, while data access, file layout, caching, and observability become the real design surface.</p>
<p>The range gateway is a good example. It sounds like plumbing, but it shapes whether the system feels smooth or fragile.</p>
<h2 id="current-status">Current status</h2>
<p>QuackLake is private and experimental. I would not present it as a finished product. Its value is as a small lab for object-storage-first analytics and DuckDB-WASM deployment patterns.</p>
]]></content:encoded>
    </item>
    <item>
      <title>TegDB: Notes from Building a Small Embedded Database</title>
      <link>https://blog.minifish.org/posts/tegdb-embedded-database/</link>
      <pubDate>Wed, 27 May 2026 09:00:00 +0800</pubDate>
      <guid>https://blog.minifish.org/posts/tegdb-embedded-database/</guid>
      <description>A project note on TegDB, a lightweight embedded database engine with ACID transactions, WAL recovery, B&#43;tree indexing, and a SQL-like interface.</description>
      <content:encoded><![CDATA[<p>TegDB is a lightweight embedded database engine with a SQL-like interface. It is written in Rust and focuses on simplicity, reliability, and predictable behavior.</p>
<p>The project is not trying to compete with SQLite. It is a learning and systems-design project: what happens when you build the parts of a small database yourself?</p>
<h2 id="design-philosophy">Design philosophy</h2>
<p>The most important choice is simplicity. TegDB uses a deliberately constrained architecture:</p>
<ul>
<li>embedded engine</li>
<li>single-process access</li>
<li>write-ahead logging</li>
<li>crash recovery</li>
<li>B+tree-style indexing</li>
<li>schema and constraint checks</li>
<li>SQL-like query surface</li>
</ul>
<p>Avoiding broad concurrency is not a weakness for this kind of project. It reduces the number of failure modes and makes the storage path easier to reason about.</p>
<h2 id="why-build-a-database">Why build a database</h2>
<p>Database internals are easier to understand when you have to implement the boring parts:</p>
<ul>
<li>how records are serialized</li>
<li>how pages are found</li>
<li>how an index points to storage</li>
<li>when a transaction becomes durable</li>
<li>how recovery decides what to replay</li>
<li>how a query stops early with <code>LIMIT</code></li>
</ul>
<p>Reading database code is useful. Writing a small one makes the tradeoffs harder to ignore.</p>
<h2 id="reliability-work">Reliability work</h2>
<p>The most interesting code in a database is often not the happy path. TegDB spends attention on:</p>
<ul>
<li>write-ahead log commit markers</li>
<li>rollback behavior</li>
<li>partial write handling</li>
<li>file locking</li>
<li>recovery after crash</li>
<li>corruption boundaries</li>
</ul>
<p>These are the parts that turn “data structure on disk” into “database.”</p>
<h2 id="what-i-learned">What I learned</h2>
<p>The database abstraction is expensive because it hides many coordinated guarantees. Even a small embedded engine has to care about durability, serialization, schema behavior, query planning shortcuts, and operational failure.</p>
<p>The lesson is not that every app should have a custom database. The lesson is the opposite: after building even a small one, you gain more respect for mature storage engines.</p>
<h2 id="open-source-status">Open source status</h2>
<p>TegDB is public because the project is mainly educational and architectural. It is useful as a record of experiments in storage design, not as a claim that it should replace established embedded databases.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
