Introducing Magpie: One Engine for the Many Ways You Read Data
Tables, streams, search, and vectors from one ordered history of writes
An application often needs several ways to read the same data. It needs the current value of a record, the events that changed it, a search over its text, an aggregate over its columns, and perhaps the nearest embedding.
Those needs commonly lead to several systems, each holding its own representation of the data. The application then takes responsibility for moving updates between them, tracking their progress, and deciding what to do when they disagree.
Magpie brings these reads into one storage engine. Every write enters an ordered log. From the same underlying files, a program can read current state, consume changes, search text, find nearest vectors, compute grouped aggregates, and build point-in-time joins.
Magpie is written entirely in Crow and used as a Crow package. A log is a directory of immutable files. HTTP, Redis, and Kafka interfaces make selected capabilities available to other clients. Two packages built on the same engine ship with it: a knowledge graph and a machine-learning feature store.
The central design question is simple: how much can an application do with one ordered history of writes and one storage layout?
The idea
One example that shows what Magpie does.
One write, several ways to read
Consider an application that stores orders. Each order has an identifier, an item, a description, a quantity, and an embedding of its description for similarity search.
When an order changes, Magpie appends a new row and assigns it a position. The position establishes where that write belongs in the log.
The application can then ask different questions about those writes:
| Question | Magpie operation | Explained in |
|---|---|---|
| What is the current state of each order? | latest
|
Current state and change streams |
| Which versions of this order remain in the log? | lookup
|
Current state and change streams |
| What changed after this position? | since
or tail
|
Current state and change streams |
| Which descriptions match these words? | search
|
Full-text search |
| Which orders are most similar to this one, by embedding? | nearest
|
Vector search |
| What is the total quantity of each item? | summary
|
Analytics and point-in-time joins |
| What did each order look like at a given moment? | prior
|
Analytics and point-in-time joins |
These operations share the stored data. An update does not need to be copied into a separate search service or analytics database before those readers can use it.
Retention is an explicit choice. A log can retain every row, or merging can compact it to the newest version of each key. That choice determines how much history remains available.
Storage and consistency
How a write becomes a durable file, how files are laid out and compacted, and how transactions are checked.
The storage design
Magpie organizes storage around three components: a sequencer, immutable batch files, and merged segments.
The sequencer lives in memory. It assigns positions, holds pending writes, checks transaction conflicts, and maintains an index of the newest row for each key when needed.
A flush writes pending rows into a batch file . Each batch carries the rows' positions, sorts the rows by the log's keys, and stores them in columnar row groups.
A merge combines files into larger sorted segments. It can discard superseded versions and builds full-text postings into the resulting segments.
Batch files and segments use the same format. Each file supports several access patterns:
- Positions let consumers follow changes.
- Key ordering, statistics, and Bloom filters let lookups skip irrelevant data.
- Columnar chunks let analytical reads load only the columns they need.
- Text can be searched directly in batches or through postings in merged segments.
A row is written when it reaches a batch file and rewritten when a merge incorporates it into a segment. There is no separate durable write-ahead log or external search store.
Magpie's own file format
Magpie stores everything in one file format of its own, written for this engine: batch files, merged segments and the manifest are all files of this format. A file is written once and never changed. It holds a frame's columns in row groups, followed by an index that lets a reader find one column of one row group without reading the rest.
How a column is stored
A row group holds about 4 MB of rows, and at least 1,024. Within it, each column is one chunk, encoded by its type:
| Column | Encoded as |
|---|---|
| Integers | Offsets from the minimum, or deltas from the previous value, whichever is smaller, bit-packed. A column of positions or timestamps takes a few bits a row. |
| Floats | Their 64 bits, or 32 for a column the log declared narrow
|
| Text | Lengths and bytes, or a dictionary and codes when at most half the values are distinct |
| Booleans | A bitmap |
| Moments | Milliseconds and a UTC offset |
| Vectors | The rows' numbers laid end to end, 64 or 32 bits each |
| Missing cells | A presence bitmap beside any of the above |
Each chunk then goes through an LZ77 compressor written for Magpie, which is kept only where it saves at least about a tenth of the bytes.
What lets a reader skip data
- Statistics. For each column of each row group, the column's block records the minimum, the maximum, and the missing and distinct counts. A reader skips any row group whose range cannot hold what it is looking for.
- Bloom filters. After each chunk comes a filter over the group's distinct values: 8 bits and 6 hashes per value, about 2% false positives. It is left out past 65,536 distinct values, and for the position column, whose minimum and maximum already prune a range.
- Full-text postings. Merged segments add, for each text column, a filter over its words and the postings described under full-text search.
Why not Parquet or Arrow
Parquet keeps one footer that describes every column chunk of every row group, and a reader parses it whole before reading any column; on a wide, long table that footer grows large. Magpie's footer holds one small entry per column, pointing at that column's block of per-group entries, so a reader of two columns out of a thousand reads the footer and two columns' blocks. Magpie's chunks also match how a Crow frame holds its columns, so writing and reading need no conversion through another in-memory format. Programs that need Arrow, Parquet, CSV or JSON load and save them through Crow's table library.
The manifest uses the same format: a one-group file that lists the live segments and what the log declared, replaced atomically when a merge finishes.
Visibility, durability, and snapshots
Magpie distinguishes a write becoming visible from a write becoming durable.
| Write operation | Visible in the writing process | Durable |
|---|---|---|
put
|
Immediately | After a flush |
batch
|
During the call | Before the call returns successfully |
commit
|
If accepted | Before the call returns successfully |
A compiled program flushes puts on a background thread. Writes arriving during a flush join the next batch. Under the interpreter, the flush runs synchronously.
A process crash can lose pending puts. Programs that require durability before proceeding use batch
,
commit
,
or an explicit sync
.
A flush writes the batch under a temporary name, syncs it to the disk ( F_FULLFSYNC
on macOS, which also empties the drive's cache), links it to its final name, and syncs the directory. The link fails if the name is taken, so two writers can never claim one batch number. Recovery replays nothing: a temporary file is never listed, and a file cut short is refused with a reason.
Positions also define read boundaries. Reads using the same snapshot position share the same boundary on visible writes within a log. A table read, a change read, and an aggregate can therefore be evaluated against the same position, through their upto
bound. search
,
nearest
,
and lookup
read the log as it stands when they run.
Historical reads additionally depend on retention. Once compaction removes an older version, its position cannot restore it. Logs that need complete replay or historical reconstruction must retain every row.
A second machine can follow a log: it fetches the immutable files it lacks and reads them with the same operations. Shipping is asynchronous, so a write lives on the leader's disk alone until the follower's next fetch. Promotion is manual; automatic election and fencing are not implemented.
What a merge changes
A merge is an explicit operation controlled by the program.
It streams sorted inputs into new segments, builds full-text postings, and publishes the new file set through an atomically replaced manifest.
The retention mode determines what survives:
| Retention mode | Result |
|---|---|
| Keep the newest version per key | Current state survives; superseded history can disappear. |
Keep every row ( every = true
)
|
Historical versions and replay remain available. |
After compaction, a change consumer sees surviving rows at their original positions, with gaps where older versions were removed.
This makes retention part of the application's data model. A current-state log and a historical event log can use the same engine while choosing different merge behavior.
Transactions over keys
Magpie supports optimistic transactions within one log.
A transaction reads at a snapshot, records the keys it read—including keys it checked but did not find—and submits its writes. The sequencer refuses the commit if a recorded key changed after that snapshot. A refused commit writes nothing, and its error names the key and where it changed. An accepted commit lands as one batch and is on disk before the call returns.
stale = magpie.commit['stock', frame.new[id = [2], qty = [26]],
seen = 1, columns = ['id'], equal = ['2']]
log[stale.reason]
--- conflict: id = 2 was written at position 2, after snapshot 1
This supports transactions whose dependencies can be expressed as explicit keys. For example, an application can read an inventory record and submit an updated quantity, with a conflict if another write changed that record first, as in the figure. When the keys read are the log's own keys, the check runs against the sequencer's in-memory index of each key's last position.
For transactions that name every key they read, the result is serializable: no interleaving of two such transactions can slip past the check. After a refusal, the application reads again at a newer snapshot and retries. A retry is also safe after a crash: if a commit succeeded but its acknowledgement was lost, the same commit sent again is refused, because its own first write now comes after its snapshot. A transaction is never applied twice.
The check does not cover arbitrary predicates. A question such as "does any booking overlap this interval?" needs a key-based representation of the conflicting slots, such as one key per time slot the booking covers, if the application wants those conflicts detected.
A transaction covers one log, and each log has one writing process.
Querying the log
Every way of reading the log, from a key's current value to search, vectors and analytics.
Current state and change streams
This section covers the basic reads, current state and change streams; the next three cover full-text search, vector search, and analytics with point-in-time joins. Every read returns a Crow frame, the language's in-memory table, and takes only what it needs from a file: the footer first, then the column blocks and chunks it asks for, as the file-format section describes.
use magpie, frame
a = magpie.batch['orders', frame.new[id = [1, 2, 3], qty = [3, 12, 7]], by = ['id']]
b = magpie.put['orders', frame.new[id = [2], qty = [20]]]
log[magpie.latest['orders'].qty]
log[magpie.lookup['orders', ['id'], ['2']].qty]
log[magpie.since['orders', 2].qty]
log[len[magpie.tail['orders', 3, 0.1]]]
[3, 7, 20]
[12, 20]
[7, 20]
0
The last line waits a tenth of a second for rows past position 3; none arrive, so it answers an empty frame.
Current state: latest and lookup
latest
answers the table a log holds: the newest version of each key. It can be bounded to a range of the first key, so a segment sorted that way reads only the row groups the range covers, or to a snapshot position with upto
.
Given one key, it answers from the sequencer's memory in microseconds. lookup
answers every version of a key that the log still holds. It opens only the files whose filters admit the key, and in a segment only the row groups whose statistics do, so a lookup by a segment's sort keys reads only the row groups that hold them.
Change streams: since and tail
since
answers every row from a position onward, in position order: a consumer reads from the position after the last one it saw. Reads are bounded windows, so a consumer walks a large log a window at a time. tail
answers the rows after a position, waiting up to a given number of seconds for new ones to arrive (it checks every 20 ms), so a view that follows the log is a loop over tail
.
Kafka consumers reach the same reads through the Kafka protocol, and after a merge a consumer sees the surviving rows at their original positions.
Four reads would need too much data if they were computed after a read returned: full-text search, vector search, analytics and point-in-time joins. Magpie runs them inside the reader, one row group at a time, as the next three sections describe:
Full-text search
search
ranks rows by BM25, scored as Lucene's BM25Similarity
scores it (k1 = 1.2, b = 0.75), over the whole log as one corpus. It returns the top k rows with a score
,
and optionally a snippet around the first match. Over five notes (1: "the kitchen table is set", 2: "a table in the garden", 3: "kitchens of the world", 4: "running the kitchen", 5: "tables and chairs"), each query form finds:
| Form | Query | Finds |
|---|---|---|
| Phrase | 'kitchen table'
|
Note 1 |
| Prefix | 'kit*'
|
Notes 1, 3 and 4 |
| Fuzzy, within two edits | 'kitchn~'
|
Notes 1, 3 and 4 |
Stemmed, in a log declared with stem = true
|
'tabling'
|
"the tables" and "a table" |
| Snippet, 6 characters each side | 'table'
|
"…tchen table is se…" |
A batch file is searched by scanning its text. A merged segment carries an index for each text column of each row group: a filter over its words, a sorted dictionary of terms, and each term's postings (the rows that hold it, how often, and where), delta-encoded and bit-packed in blocks of 128.
Each block records its largest term count and its shortest document, which bound the best score it can add, so a top-k query skips blocks that cannot beat the current k-th score. Two kinds of column get no index: identifier-like columns, with more distinct words than half their documents, and category-like columns, such as a symbol or a day, with fewer than one distinct word per 64 documents. Their value filters already prune, and a search scans them. Scanned or indexed, the counts are the same, so the ranking is the same. Over 100,000 short texts, a common word's top 10 took 54 ms scanned and 17 ms through the index.
Magpie keeps each document's length exactly, where Lucene stores one byte per length, so Elasticsearch's scores differ from Magpie's after the second digit. The scores are checked against the formula computed independently in Python, and every query form against a full scan.
Vector search
A frame column can hold vectors of one width, such as embeddings, stored as 64-bit floats, or as 32-bit for a column the log declares narrow
.
nearest
returns the k rows whose vectors have the highest cosine similarity to a query vector, computed exactly over every row, pending rows included. It agrees row for row and score for score with the flat index of Crow's vectors package. Among 100,000 vectors of width 64, the nearest 10 took 22 ms from the files, against 12 ms for that flat index over the same vectors held in memory. An approximate index such as HNSW is planned for collections where an exact scan is too slow.
nearest
finds them, an exact scan that keeps the k best.For example, the two vectors nearest [1.0, 0.1]
among three:
use magpie, frame
a = magpie.batch['vecs', frame.new[id = [1, 2, 3],
e = [[1.0, 0.0], [0.0, 1.0], [1.0, 1.0]]], by = ['id']]
log[magpie.nearest['vecs', 'e', [1.0, 0.1], 2]]
id e _pos score
int vector int float
-- ------ ---- ------------------
1 [1, 0] 0 0.9950371902099893
3 [1, 1] 2 0.7739572992033211
[2 rows x 4 cols]
Analytics and point-in-time joins
Analytics
summary
computes count, sum, minimum, maximum, mean, variance, standard deviation, and first and last values, grouped by key columns. It can filter by a column compared with a value (equal, not equal, less than and so on), by a range of the first key, and by a position bound. Each row group is pruned by its statistics, decoded for the named columns only, filtered and grouped into partial results, and the partials are combined, the variance by Welford's and Chan's methods. The answer equals Crow's own group
over a full scan
of the same rows, up to the last digits a different summation order moves.
summary
computes the example below. Each row group is reduced to partial results per key, and the partials are combined into the answer. In this tiny example both days fit in one row group; the split shows how a larger log's groups combine.The mean price and total volume per symbol, computed inside the reader:
use magpie, frame
b = magpie.batch['bars', frame.new[day = [1, 1, 2, 2],
sym = ['A', 'B', 'A', 'B'], px = [10.0, 20.0, 12.0, 22.0],
vol = [1, 2, 3, 4]], by = ['day', 'sym']]
log[magpie.summary['bars', ['sym'], ['px', 'vol'], ['mean', 'sum']]]
sym px_mean vol_sum
str float int
--- ------- -------
A 11 4
B 21 6
[2 rows x 3 cols]
Point-in-time joins
prior
is an as-of join. Given a frame of labels, each holding the log's keys and a moment, it finds for each label the newest log row with the same keys at or before that moment, reading each key's run of rows in the sorted segments; a label with no earlier row gets missing cells. Given upto
,
it also ignores rows written after a position, so a training set built as of a position is identical every time it is rebuilt, provided the log kept the versions it read. The feature store's training sets are built this way and checked cell for cell against pandas's merge_asof
.
In the example below, the label for A at 25 gets A's row from 20. B at 12 gets missing cells, because B's only row comes later, at 15, and A at 5 comes before A's first row.
use magpie, frame
c = magpie.batch['prices', frame.new[sym = ['A', 'A', 'B'],
t = [10, 20, 15], px = [1.0, 2.0, 5.0]], by = ['sym'], time = 't']
labels = frame.new[sym = ['A', 'B', 'A'], t = [25, 12, 5]]
log[magpie.prior['prices', labels]]
sym t px
str int float
--- -- -------
A 25 2
B 12 missing
A 5 missing
[3 rows x 3 cols]
These operations make the log useful for application state, retrieval, analytics, and training-data construction.
Packages and protocols
What is built on the engine, and how programs outside Crow reach it.
Built on the engine: a knowledge graph and an ML feature store
Two packages in Magpie's repository are written entirely on the engine's operations, each in a few hundred lines of Crow. They show what the shared log makes cheap: history, point-in-time reads and similarity search come with the storage instead of being built beside it.
kg
keeps a graph as four Magpie logs (nodes, edges, the edges reversed, and node embeddings), so each graph read is a Magpie read of one of them. Right: a feature group is one log; one function fills it from a source log by backfill or by stream, and the same log serves the online value, the offline history and point-in-time training sets.Knowledge graph
kg
keeps a graph's nodes and edges as Magpie logs under one directory. Edges are keyed by source, relation and target, with a weight and the fact's provenance, and are written a second time keyed by target, so a node's outgoing and incoming edges are each one key's run in a sorted segment. Removing a fact writes a tombstone, and every read takes a position, so the graph can be read as it stood at any point in its history.
On that base, kg
answers neighbors, breadth-first walks, shortest paths, pattern matches joined on shared variables, rules that derive new edges, and the edges as they stood at each row's moment. Node embeddings live in a fourth log, so an entity can be found by meaning with similar
and then expanded through its edges. A subgraph can be handed to Crow's graph
package for PageRank, connected components and shortest paths.
ML feature store
features
makes a feature group a log keyed by its entity, with its event time declared. One write then serves both sides of a feature store: the online value is the entity's newest row, read from the sequencer's memory, and the offline history is the log itself. No job copies one into the other.
A feature is defined once, as one Crow function. The same function runs over windows of the source log for a backfill and over its tail for streaming, so training and serving compute features the same way. A training set joins labels to each feature group as of each label's moment, through prior
;
given a position, it comes out identical at every rebuild. Embeddings are features like any other, and a registry log records what each feature means and which function computes it.
| Package capability | Magpie operations underneath |
|---|---|
| Graph history and time travel | Tombstone rows, and every read bounded by upto
|
| A node's edges, walks and paths | Key-sorted logs: a node's edges are one key's run, and a walk reads each hop as one key range |
| Edges as of a moment; training sets | prior
,
the as-of join |
| Similar entities; embeddings as features | nearest
over a column of vectors |
| Online feature reads | latest
of one key, from the sequencer's memory |
| Streaming features | tail
,
the rows past a position |
The feature store's training sets are checked cell for cell against pandas's merge_asof
.
Three network protocols: HTTP, Redis, and Kafka
Crow programs call Magpie inside their own process. For everything else, Magpie implements three network protocols itself, each a small server written in Crow:
- HTTP
carries Magpie's own operations. A request names a log and an operation such as
latest,searchorput, and rows travel as JSON. - Redis's protocol (RESP2) lets Redis clients use Magpie as if it were a Redis server.
- Kafka's protocol lets Kafka producers and consumers use Magpie as if it were a Kafka broker.
No Redis or Kafka runs anywhere, and nothing copies data from one into Magpie. The engine underneath is Magpie's in every case: a Redis key and a Kafka topic are both Magpie logs, so a Crow program can read, search and aggregate the same data the other clients write.
HTTP: Magpie's operations over the network
The HTTP server exposes the operations a Crow program calls. A request's path names the log and the operation, the query string carries the arguments, and a POST body carries rows as JSON records:
- GET
for reads:
latest,lookup,since,scan,search,nearest,summary,head, and the catalog (batches,metrics). - POST with rows
for writes and joins:
put,batch,commit,prior. - POST with no body
for
mergeandsync.
Answers are JSON. A refused request gets status 400 with the reason, and an unknown log or operation gets 404. Another Crow program can pass the server's URL wherever it would pass a directory, and the same calls travel over HTTP.
use magpie, frame
made = magpie.batch['shop/orders', frame.new[
id = [1, 2], qty = [3, 12]], by = ['id']]
served = magpie.door['shop', 9001]
use magpie
log[magpie.latest['http://localhost:9001/orders'].qty]
--- [3, 12]
$ curl 'localhost:9001/orders/latest'
[{"_pos":0,"id":1,"qty":3},{"_pos":1,"id":2,"qty":12}]
$ curl 'localhost:9001/orders/lookup?on=id&equal=2'
[{"_pos":1,"id":2,"qty":12}]
All three servers listen on localhost by default, and none has authentication or TLS built in.
The Redis protocol
Magpie's Redis server speaks RESP2, the protocol redis-cli
and Redis client libraries use, so they connect to Magpie unchanged. Keys and values live in one Magpie log under the server's root, named _kv
,
with a row per write. A read is answered from the sequencer's in-memory index of each key's newest row, so a GET is a memory lookup, as it is in Redis. Streams are logs of their own, and a stream entry's id is its position in that log.
_kv
log or in a stream's log; reads come from the sequencer's memory or by position.Starting the server takes one line, and redis-cli
works against it unchanged:
use magpie.redis
served = redis.serve['cache', 6380]
$ redis-cli -p 6380 SET greeting hello
OK
$ redis-cli -p 6380 GET greeting
"hello"
$ redis-cli -p 6380 INCR visits
(integer) 1
A SET is a Magpie put: visible at once, and on disk at the next flush. Because the keys are an ordinary Magpie log, a Crow program can also read a key's history, search the values, or aggregate them with the operations described earlier.
Not supported yet: EXPIRE and TTL (Magpie has no expiry column yet), lists, hashes, sets and sorted sets, pub/sub, MULTI and Lua scripts, and XREAD's BLOCK option. KEYS takes *
or a single key, and XADD takes *
ids only.
The Kafka protocol
Magpie's Kafka server answers as a Kafka 0.10.1 broker does. A Kafka client first asks the broker which protocol versions it speaks and then uses those, so producers and consumers connect to Magpie unchanged; it is tested with the kafka-python client. Each topic is a Magpie log with one partition, and a record's offset is its position in that log. Consumer groups keep their memberships and committed offsets in two more logs, _groups
and _offsets
.
| Kafka | In Magpie |
|---|---|
| A topic | A log under the server's root, with one partition |
| An offset | The record's position in that log |
| Produce | The records appended as one batch, on disk before the acknowledgement |
| Fetch | The rows from an offset, at most 1,000 at a time; with nothing new, the server waits up to the client's max_wait_ms
|
| Consumer groups | Joins, rebalances and heartbeats, with members kept in the _groups
log |
| Committed offsets | The _offsets
log |
| Compressed messages | gzip and Snappy, decoded by Magpie's own Crow code |
With the server started by kafka.serve['events', 9093]
,
a producer and a consumer group written with kafka-python 3.0.11 work as they would against Kafka, and a Crow program reads the same records as a Magpie log:
from kafka import KafkaProducer, KafkaConsumer
producer = KafkaProducer(bootstrap_servers='localhost:9093')
for key, value in [(b'o1', b'created'), (b'o2', b'created'),
(b'o1', b'shipped')]:
meta = producer.send('orders', key=key, value=value).get(timeout=15)
print('produced at offset', meta.offset)
producer.close()
consumer = KafkaConsumer('orders', bootstrap_servers='localhost:9093',
group_id='billing', auto_offset_reset='earliest',
consumer_timeout_ms=5000)
for msg in consumer:
print(msg.offset, msg.key.decode(), msg.value.decode())
consumer.close()
produced at offset 0
produced at offset 1
produced at offset 2
0 o1 created
1 o2 created
2 o1 shipped
use magpie
log[magpie.since['events/orders', 0, -1, ['key', 'value', '_pos']]]
key value _pos
str str int
--- ------- ----
o1 created 0
o2 created 1
o1 shipped 2
[3 rows x 3 cols]
A produce is acknowledged only after its batch is on disk. A client that retries after a lost acknowledgement appends the records again, so delivery is at-least-once, as with a Kafka producer that is not idempotent.
Not supported yet: the newer record format (magic 2) and its headers, LZ4 and Zstandard compression, more than one partition per topic, SASL and TLS, idempotent and transactional producers, and the topic-administration requests (a topic is created when it is first used). Record values must be UTF-8 text.
In practice
Measurements, a complete example, where Magpie fits today, and availability.
Early measurements
Initial measurements used an Apple M4 Max with 64 GB of memory.
A market-data dataset contained approximately 11.3 million bars and 19.2 million quotes. Merging produced a 289 MB segment for the bars and a 240 MB segment for the quotes.
Representative reads from the files included:
Measured October 30, 2026
| Operation | Measured time |
|---|---|
| One symbol's day as minute candles with running volume-weighted price | 10 ms |
| Last price, high, and volume up to an instant | 11 ms |
| Top 20 symbols by daily volume | 38 ms |
| Monthly volume grouped by day over 11.3 million rows | 108 ms |
| Top 10 for a common word over 100,000 short texts, through the index | 17 ms |
| Exact nearest 10 among 100,000 vectors of width 64 | 22 ms |
| Knowledge-graph walk of three hops, reaching 1,022 of 5,000 nodes | 29 ms |
How measured: compiled programs ( crow build
),
each time the warm median, from the call to the answer in hand, with the data read from the files at every run. The answers to the price, top-20 and monthly-volume questions matched those of the ClickHouse database the data came from.
These are early measurements on one machine with datasets that fit in memory. They do not establish performance beyond memory capacity or under many concurrent clients.
Durable single-write latency is another important limit. A batch that reached disk before returning took about 13.4 ms on the measured machine, largely due to flushing the file and its directory. Grouping durable commits into shared flushes is a planned improvement.
A small example
Crow uses square brackets for function calls. This program creates an orders log, updates an order, and reads the same data in several ways:
use magpie, frame
first = magpie.batch['orders', frame.new[
id = [1, 2],
item = ['apples', 'pears'],
note = ['a crate for the shop', 'pears for the kitchen'],
qty = [3, 12]], by = ['id']]
second = magpie.put['orders', frame.new[
id = [2, 3],
item = ['pears', 'plums'],
note = ['more pears', 'plums for the kitchen table'],
qty = [20, 7]]]
log[magpie.latest['orders']]
log[magpie.latest['orders', equal = ['2']].qty]
log[magpie.search['orders', 'note', ['kitchen table'], 3].item]
log[magpie.since['orders', 2].item]
id item note qty _pos
int str str int int
-- ------ -------------------- --- ----
1 apples a crate for the shop 3 0
2 pears more pears 20 2
3 plums plums for the kit... 7 3
[3 rows x 5 cols]
[20]
['plums']
['pears', 'plums']
The current table contains three orders. Order 2 has quantity 20 because its newer row supersedes its earlier value.
The key read returns [20]
.
The phrase search returns ['plums']
.
Reading changes from position 2 returns ['pears', 'plums']
.
Those results come from the same writes, including rows still pending in the writing process. log[x]
prints x
,
and the program prints the same output whether Crow interprets it or compiles it.
Where Magpie fits
Today, Magpie suits applications that can keep a log on one machine and benefit from several access patterns over the same writes.
Its appeal is a smaller set of moving parts: current state, change consumption, search, vectors, and analytics share an engine and a storage format, and the knowledge graph and feature store are built from the same operations. Crow supplies the programming and query interface, and programs in other languages reach the same data over HTTP or the Redis and Kafka protocols.
A good fit today
- An application whose data fits on one machine and that needs several of these reads over the same writes, such as current state, change streams, search and analytics.
- Machine-learning pipelines that need online features and point-in-time-correct training sets from one write.
- Services that use Redis or Kafka clients for keys, streams or events, within the commands and requests Magpie supports.
Current limits
The present boundaries are substantial:
- One writing process per log.
- Asynchronous followers with manual promotion; no automatic failover.
- Transactions within one log, with key-based conflict checks.
- Historical reads limited by the chosen retention policy.
- Each durable write pays a full disk flush, about 13 ms on the machine measured.
- Exact vector search only.
- Explicitly scheduled merges.
- Schema changes through a new log.
- No SQL: queries are Crow programs, or HTTP calls to Magpie's operations.
- Subsets of the Redis and Kafka protocols, and no authentication or TLS on any network interface.
What comes next
The next work includes shared flushes for durable commits, expiry, approximate vector indexing, newer Kafka records, and larger-scale measurements. Beyond these, the direction is a multi-node data platform: replication with election and fencing, and logs spread across machines.
Availability
Crow is open source at github.com/agncrow/crow.
Magpie is a Crow package at github.com/agncrow/magpie, source-available under the Business Source License 1.1. Its published terms allow development, testing, non-commercial use, and commercial production on one machine per application. Each version becomes Apache-2.0 four years after publication.
Magpie's organizing idea is one ordered set of writes that applications can read in several ways. The engine makes that idea concrete through a shared file format, explicit durability choices, and retention policies the program controls.
