Skip to Content
DocsConceptsImport Status and Pending Operations

Import Status

Quick Reference

Import status tells you what operations were applied and what’s pending due to missing dependencies. Essential for handling out-of-order updates in distributed systems.

Status Structure

interface ImportStatus { : PeerVersionRange; // What was applied ?: PeerVersionRange; // What needs dependencies } interface PeerVersionRange { [: `${number}`]: { : number; // Inclusive : number; // Exclusive (e.g., 0-50 = ops 0-49) }; }

Pending Operations

Operations become pending when they depend on missing operations (causal dependencies).

Common Scenario: Out-of-Order Delivery

const = new (); // Peer A creates ops 0-4, then 5-10 const = new (); .("text").(0, "Hello"); const = .({ : "update" }); .("text").(5, " World"); const = .({ : "update", : .() }); // If update2 arrives first: const = .(); .(.); // Ops 10-19 pending, need 0-9 // Import missing dependencies: .(); // Both updates now applied

Handling Pending Operations

async function ( : , : , : (: ) => <> ) { const = .(); if (.) { const = await (.()); .(); } }

Best Practices

Always Check Status

const = new (); const = .(); if (.) { .("Operations pending:", .); // Fetch missing updates }

Use Batch Import

const : [] = [ //... ]; const = new (); const = .(); // Single status check for all updates
Last updated on