use log and env_logger, and add some logging around sync

This commit is contained in:
Dustin J. Mitchell
2020-11-29 18:18:28 -05:00
parent c117494ce6
commit 0a1ee470f7
13 changed files with 109 additions and 14 deletions

View File

@@ -49,8 +49,15 @@ pub(crate) fn add_version<'a>(
parent_version_id: VersionId,
history_segment: HistorySegment,
) -> Fallible<AddVersionResult> {
log::debug!(
"add_version(client_id: {}, parent_version_id: {})",
client_id,
parent_version_id,
);
// check if this version is acceptable, under the protection of the transaction
if client.latest_version_id != NO_VERSION_ID && parent_version_id != client.latest_version_id {
log::debug!("add_version request rejected: mismatched latest_version_id");
return Ok(AddVersionResult::ExpectedParentVersion(
client.latest_version_id,
));
@@ -58,6 +65,10 @@ pub(crate) fn add_version<'a>(
// invent a version ID
let version_id = Uuid::new_v4();
log::debug!(
"add_version request accepted: new version_id: {}",
version_id
);
// update the DB
txn.add_version(client_id, version_id, parent_version_id, history_segment)?;