radicle/cob/identity: Deprecate `Identity::id`
In the heartwood workspace, there is just a single use of this function. Also, the repository ID can be computed on demand, saving memory.
This commit is contained in:
parent
97f279fe41
commit
ebf0f417f7
|
|
@ -167,9 +167,6 @@ pub enum Error {
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Identity {
|
pub struct Identity {
|
||||||
/// The canonical identifier for this identity.
|
|
||||||
/// This is the object id of the initial document blob.
|
|
||||||
pub id: RepoId,
|
|
||||||
/// The current revision of the document.
|
/// The current revision of the document.
|
||||||
/// Equal to the head of the identity branch.
|
/// Equal to the head of the identity branch.
|
||||||
pub current: RevisionId,
|
pub current: RevisionId,
|
||||||
|
|
@ -201,7 +198,6 @@ impl Identity {
|
||||||
let root_id = root.id;
|
let root_id = root.id;
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
id: root.blob.into(),
|
|
||||||
root: root_id,
|
root: root_id,
|
||||||
current: root_id,
|
current: root_id,
|
||||||
revisions: HashMap::from_iter([(root_id, root)]),
|
revisions: HashMap::from_iter([(root_id, root)]),
|
||||||
|
|
@ -300,8 +296,9 @@ impl Identity {
|
||||||
|
|
||||||
impl Identity {
|
impl Identity {
|
||||||
/// The repository identifier.
|
/// The repository identifier.
|
||||||
|
#[deprecated]
|
||||||
pub fn id(&self) -> RepoId {
|
pub fn id(&self) -> RepoId {
|
||||||
self.id
|
self.root().blob.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The current document.
|
/// The current document.
|
||||||
|
|
@ -2350,7 +2347,7 @@ mod test {
|
||||||
|
|
||||||
assert_eq!(identity.signatures().count(), 2);
|
assert_eq!(identity.signatures().count(), 2);
|
||||||
assert_eq!(identity.revisions().count(), 5);
|
assert_eq!(identity.revisions().count(), 5);
|
||||||
assert_eq!(identity.id(), id);
|
assert_eq!(RepoId::from(identity.root().blob), id);
|
||||||
assert_eq!(identity.root().id, root);
|
assert_eq!(identity.root().id, root);
|
||||||
assert_eq!(identity.current().blob, doc.blob);
|
assert_eq!(identity.current().blob, doc.blob);
|
||||||
assert_eq!(identity.current().description.as_str(), "Bob's repository");
|
assert_eq!(identity.current().description.as_str(), "Bob's repository");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue