Crate fts_sqlite

Source
Expand description

crates.io version docs.rs documentation crates.io downloads crates.io license getting started

§Flow Trading Service (FTS)

This crate is part of a collection of crates that together implement flow trading as proposed by Budish, Cramton, et al, in which trade occurs continuously over time via regularly-scheduled batch auctions.

The different crates in this workspace are as follows:

  • fts_core: Defines a set of data primitives and operations but defers the implementations of these operations, consistent with a so-called “hexagonal architecture” approach to separating responsibilities.
  • fts_solver: Provides a reference solver for the flow trading quadratic program.
  • fts_axum: A REST API HTTP server for interacting with the solver and persisting state across auctions.
  • fts_sqlite: An implementation of the core data operations using SQLite, suitable for exploration of flow trading-based marketplaces such as a forward market.

§FTS SQLite

This crate provides a SQLite-based implementation of all the repository traits defined in fts-core, enabling persistent storage and retrieval of flow trading data. It’s designed to be efficient for both development/testing scenarios and production use cases with moderate data volumes.

§Architecture

The implementation leverages SQLite’s strengths while working around its limitations:

  • Dual connection pools: Separate reader and writer pools optimize for SQLite’s concurrency model
  • WAL mode: Write-Ahead Logging enables concurrent reads while maintaining consistency
  • Temporal data model: Built-in support for historical queries and audit trails
  • JSON storage: Flexible application data storage using SQLite’s JSON functions

Modules§

config
Configuration types for the SQLite database connection.
types
Type definitions for the SQLite implementation.

Structs§

Db
SQLite database implementation for flow trading repositories.