Docs

api-compatibility

Source: crates/lvcs-api/src/lib.rs.

/// The API's compatibility rules (decision 325), from v0.1.0 on. The
/// usual case is a newer client (the site's app, a paired device, a newer
/// CLI) against an older daemon, and the reverse happens too.
///
/// - Every type here (params, results, pushes, `ErrorData`) ignores
///   fields it doesn't know: none is `deny_unknown_fields`, which
///   `scripts/check.sh` refuses in this crate.
/// - A field added after v0.1.0 is an `Option` or `#[serde(default)]`, so
///   a reply or a request without it still decodes.
/// - Removing or renaming a field, changing its type or meaning, or
///   making an optional one required is a new op (or a new op version,
///   `<op>.v2`); the old one is served for at least one more minor
///   release.
/// - A result's or push's list, map, count, or flag, whose empty or zero
///   value reads as none, is `#[serde(default)]`; ids, addresses, heads,
///   frontiers, times, and closed-set values are required, and so is
///   every param an op can't do without (`invalid_params` names the op).
/// - A value added to a bounded set a result carries is refused by a
///   client older than the daemon; its next is `lvcs update`.
/// - A client ignores a push method it doesn't know.
/// - `hello`'s result (`host::HelloResult`) names the daemon's `version`
///   and this `API_VERSION`, which changes only with a change these rules
///   don't admit.
pub const API_VERSION: u16 = 1;