Documentation Index
Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
Use this file to discover all available pages before exploring further.
Two Resources Meeting Through One Gesture
Gestures usually act on one resource at a time. A handshake is the special case where a single gesture reaches across two resources and makes them cooperate.cp /gdrive/data.csv /s3/data.csv, Google Drive and S3 coordinate to move a filemv /ram/scratch.txt /disk/archive.txt, in-memory and local disk hand offdiff /s3/a.txt /github/b.txt, two resources both produce bytes for comparisoncat /s3/a.txt /github/b.txt, aggregator; both feed the same output stream
Why Handshakes Are Special
A normal gesture likecat /s3/data.csv is a single-handed motion: one resource, one Finger (read), one result.
A handshake requires two resources to cooperate. That means:
- Two fingers, possibly of different kinds.
cp /s3/a /gdrive/bisreadon S3 pluswriteon GDrive. - A meeting point. Bytes stream from one resource through Mirage into the other. A direct resource-to-resource path (e.g., S3→S3 server-side copy) is a future optimization; the default is stream-through.
- A shared failure model. If one side breaks mid-transfer, the gesture must clean up on both sides without leaving partial state.
Handshake Types
| Type | When it fires | Example | Constraint |
|---|---|---|---|
| Transfer | Write gesture across resources | cp, mv | Destination must support write; mv also needs delete on source |
| Comparison | Two reads feeding one comparison | diff, cmp | Both sides need read only, works for every resource |
| Aggregation | Many reads, one merged output stream | cat, grep, wc across mounts | All sides need read only, works for every resource |
Asymmetric Resources
Not every resource can play both sides of a transfer. A read-only resource (today: Google Drive) can be the source ofcp but never the destination, and can never participate in mv at all (since mv deletes the source after writing the destination). The dispatcher detects this at execution time and surfaces a clean failure rather than corrupting state. Aggregation and comparison handshakes are unaffected, they only need reads.
How Mirage Handles Them
Handshakes are implemented as cross-mount handlers inside the command dispatcher. When a gesture receives paths that span resources, Mirage:- Groups paths by resource so each side’s finger work can run locally.
- Picks a handler, a registered cross-mount handler for the specific
(src, dst)pair, or a generic aggregator across resources, or an error if no handshake exists for this gesture. - Coordinates the transfer as one streaming pipeline, with cleanup on failure.
Why Handshakes Are Still One Motion
The handshake metaphor lands because the two resources are both within reach of the same Arm. A resource is an Eye the Arm can reach toward; a Hand at the end of that reach is what actually touches it. A handshake is the Arm (or two Arms, if you prefer the symmetric read) performing one coordinated motion whose endpoints happen to live on two different resources. Without this framing, cross-resource commands feel like a special case bolted on. With it, they are just the gesture the Arm performs when two of its reachable Eyes need to exchange what they see.Tested Matrix
tests/integration/test_cross_mount_matrix.py exercises every handshake type across 14 ordered (src, dst) pairs spanning RAM, disk, Redis, S3, and Google Drive, 126 parametrized assertions in total. The matrix confirms both the working combinations and that the unsupported ones (e.g. cp into Google Drive, mv touching any read-only end) fail cleanly rather than leaving partial state behind.
Related
- Gestures, single-resource commands, of which handshakes are a variant.
- Commands, Cross-Resource Dispatch, the concrete dispatch rules.
- Fingers, the
read/writeops a handshake composes. - Eyes, the resources a handshake reaches across.