Docs

api-history

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

/// `blame` (decision 303): who wrote each line of the file at `address` on
/// `main`, at `heads` (lowercase hex change hashes), or at the heads this
/// daemon last rendered when omitted, from the document's own history: an
/// author holds a line when a character it inserted is visible there.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct BlameParams {
    pub address: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub heads: Option<Vec<String>>,
}

/// `blame` result: the heads blamed at, and each author with the line runs
/// it holds, sorted by name. A binary or deleted file names no lines.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlameResult {
    pub heads: Vec<String>,
    #[serde(default)]
    pub authors: Vec<BlameAuthor>,
}

/// One author of a file's lines.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct BlameAuthor {
    /// Its participant id (`ID_ENCODING`); absent for an Automerge actor
    /// whose signer this daemon hasn't verified.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub participant: Option<String>,
    /// Its name (`Named`), or `unknown`.
    pub name: String,
    /// The line runs it holds, in order, without `near`.
    pub lines: Vec<LineName>,
}

/// `channel.history` (decision 303): the moves of channel `channel`'s value
/// this daemon saw in its run, newest first, at most `limit` (every one
/// kept when omitted).
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct ChannelHistoryParams {
    pub channel: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub limit: Option<u32>,
}

/// `channel.history` result.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ChannelHistoryResult {
    #[serde(default)]
    pub moves: Vec<ChannelMove>,
}

/// One move of a channel's value.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ChannelMove {
    /// The value it moved to: frontier ids (`ID_ENCODING`), sorted; empty
    /// for none.
    pub frontiers: Vec<String>,
    /// When, by this daemon's clock, in Unix milliseconds.
    pub at_ms: i64,
}