radicle: add some documentation for node::events::Event
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
parent
2929146c49
commit
4c82bb4c4e
|
|
@ -18,57 +18,109 @@ use crate::storage::{refs, RefUpdate};
|
||||||
pub const MAX_PENDING_EVENTS: usize = 8192;
|
pub const MAX_PENDING_EVENTS: usize = 8192;
|
||||||
|
|
||||||
/// A service event.
|
/// A service event.
|
||||||
|
///
|
||||||
|
/// The node emits events of this type to its control socket for other
|
||||||
|
/// programs to consume.
|
||||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase", tag = "type")]
|
#[serde(rename_all = "camelCase", tag = "type")]
|
||||||
pub enum Event {
|
pub enum Event {
|
||||||
|
/// The node has received changes to Git references in a
|
||||||
|
/// repository stored on the node, from another node.
|
||||||
RefsFetched {
|
RefsFetched {
|
||||||
|
/// The node identifier of the other node.
|
||||||
remote: NodeId,
|
remote: NodeId,
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// The list of Git references that were updated.
|
||||||
updated: Vec<RefUpdate>,
|
updated: Vec<RefUpdate>,
|
||||||
},
|
},
|
||||||
|
/// The node has sent its list of Git references to another node
|
||||||
|
/// and the other has fetched the updated references.
|
||||||
RefsSynced {
|
RefsSynced {
|
||||||
|
/// The node identifier of the other node.
|
||||||
remote: NodeId,
|
remote: NodeId,
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// The `rad/sigrefs` reference that was fetched.
|
||||||
at: Oid,
|
at: Oid,
|
||||||
},
|
},
|
||||||
|
/// The node has discovered a repository on new node on the
|
||||||
|
/// Radicle network.
|
||||||
SeedDiscovered {
|
SeedDiscovered {
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
},
|
},
|
||||||
|
/// The node has dropped a repository on a node from its list of
|
||||||
|
/// known repositories and nodes.
|
||||||
SeedDropped {
|
SeedDropped {
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
},
|
},
|
||||||
|
/// The node has connected directly to another node.
|
||||||
PeerConnected {
|
PeerConnected {
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
},
|
},
|
||||||
|
/// The node has terminated its direct connection to another node.
|
||||||
PeerDisconnected {
|
PeerDisconnected {
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
|
/// The reason why the connection was terminated.
|
||||||
reason: String,
|
reason: String,
|
||||||
},
|
},
|
||||||
|
/// The local node has received changes to Git references from its
|
||||||
|
/// local user. In other words, the local user has pushed to the
|
||||||
|
/// node, updated COBs, or otherwise updated refs in their local node.
|
||||||
LocalRefsAnnounced {
|
LocalRefsAnnounced {
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// List of changed Git references for the repository.
|
||||||
refs: refs::RefsAt,
|
refs: refs::RefsAt,
|
||||||
|
/// When were the new references received? In other words,
|
||||||
|
/// when did the user run `git push`?
|
||||||
timestamp: Timestamp,
|
timestamp: Timestamp,
|
||||||
},
|
},
|
||||||
|
/// The node has received a message with a list of repositories on
|
||||||
|
/// another node on the network.
|
||||||
InventoryAnnounced {
|
InventoryAnnounced {
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
|
/// List of repositories sent.
|
||||||
inventory: Vec<RepoId>,
|
inventory: Vec<RepoId>,
|
||||||
|
/// When was the list sent?
|
||||||
timestamp: Timestamp,
|
timestamp: Timestamp,
|
||||||
},
|
},
|
||||||
|
/// The node has received a message about new signed Git
|
||||||
|
/// references ("sigrefs") for a repository on another node on the
|
||||||
|
/// network.
|
||||||
RefsAnnounced {
|
RefsAnnounced {
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
|
/// The identifier of the repository in question.
|
||||||
rid: RepoId,
|
rid: RepoId,
|
||||||
|
/// List of Git references for the repository.
|
||||||
refs: Vec<refs::RefsAt>,
|
refs: Vec<refs::RefsAt>,
|
||||||
|
/// When was the list sent?
|
||||||
timestamp: Timestamp,
|
timestamp: Timestamp,
|
||||||
},
|
},
|
||||||
|
/// The node received a message about a new node on the network.
|
||||||
NodeAnnounced {
|
NodeAnnounced {
|
||||||
|
/// The node identifier of the other node.
|
||||||
nid: NodeId,
|
nid: NodeId,
|
||||||
|
/// Alias for the other node.
|
||||||
alias: Alias,
|
alias: Alias,
|
||||||
|
/// When was the announcement sent?
|
||||||
timestamp: Timestamp,
|
timestamp: Timestamp,
|
||||||
|
/// What features did the node advertise to the other node.
|
||||||
features: node::Features,
|
features: node::Features,
|
||||||
|
/// What of its addresses did the node tell the other node about?
|
||||||
addresses: Vec<node::Address>,
|
addresses: Vec<node::Address>,
|
||||||
},
|
},
|
||||||
|
/// The node has uploaded a Git pack file to another node.
|
||||||
UploadPack(upload_pack::UploadPack),
|
UploadPack(upload_pack::UploadPack),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue