chore: rename data to doc_state
This commit is contained in:
parent
971aa6d3e1
commit
011a5b59c9
|
|
@ -217,7 +217,7 @@ pub struct InsertSnapshotParams {
|
||||||
#[validate(custom(function = "validate_not_empty_str"))]
|
#[validate(custom(function = "validate_not_empty_str"))]
|
||||||
pub object_id: String,
|
pub object_id: String,
|
||||||
#[validate(custom(function = "validate_not_empty_payload"))]
|
#[validate(custom(function = "validate_not_empty_payload"))]
|
||||||
pub data: Bytes,
|
pub doc_state: Bytes,
|
||||||
#[validate(custom(function = "validate_not_empty_str"))]
|
#[validate(custom(function = "validate_not_empty_str"))]
|
||||||
pub workspace_id: String,
|
pub workspace_id: String,
|
||||||
pub collab_type: CollabType,
|
pub collab_type: CollabType,
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ where
|
||||||
user: self.user.clone(),
|
user: self.user.clone(),
|
||||||
message,
|
message,
|
||||||
})
|
})
|
||||||
.map_err(|err| RealtimeError::Internal(err.into()))
|
.map_err(|err| RealtimeError::SendWSMessageFailed(err.to_string()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,9 @@ pub enum RealtimeError {
|
||||||
|
|
||||||
#[error("failed to obtain lease: {0}")]
|
#[error("failed to obtain lease: {0}")]
|
||||||
Lease(Box<dyn std::error::Error + Send + Sync>),
|
Lease(Box<dyn std::error::Error + Send + Sync>),
|
||||||
|
|
||||||
|
#[error("failed to send ws message: {0}")]
|
||||||
|
SendWSMessageFailed(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
||||||
|
|
@ -1151,7 +1151,7 @@ impl CollabPersister {
|
||||||
.observe(doc_state_full.len() as f64);
|
.observe(doc_state_full.len() as f64);
|
||||||
let params = InsertSnapshotParams {
|
let params = InsertSnapshotParams {
|
||||||
object_id: self.object_id.clone(),
|
object_id: self.object_id.clone(),
|
||||||
data: doc_state_full.into(),
|
doc_state: doc_state_full.into(),
|
||||||
workspace_id: self.workspace_id.clone(),
|
workspace_id: self.workspace_id.clone(),
|
||||||
collab_type: self.collab_type.clone(),
|
collab_type: self.collab_type.clone(),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ where
|
||||||
let data = encode_collab.doc_state;
|
let data = encode_collab.doc_state;
|
||||||
let params = InsertSnapshotParams {
|
let params = InsertSnapshotParams {
|
||||||
object_id,
|
object_id,
|
||||||
data,
|
doc_state: data,
|
||||||
workspace_id,
|
workspace_id,
|
||||||
collab_type,
|
collab_type,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ impl SnapshotControl {
|
||||||
let timestamp = Utc::now();
|
let timestamp = Utc::now();
|
||||||
let snapshot_id = timestamp.timestamp_millis();
|
let snapshot_id = timestamp.timestamp_millis();
|
||||||
let key = collab_snapshot_key(¶ms.workspace_id, ¶ms.object_id, snapshot_id);
|
let key = collab_snapshot_key(¶ms.workspace_id, ¶ms.object_id, snapshot_id);
|
||||||
let compressed = zstd::encode_all(params.data.as_ref(), ZSTD_COMPRESSION_LEVEL)?;
|
let compressed = zstd::encode_all(params.doc_state.as_ref(), ZSTD_COMPRESSION_LEVEL)?;
|
||||||
if let Err(err) = self.s3.put_blob(&key, compressed.into(), None).await {
|
if let Err(err) = self.s3.put_blob(&key, compressed.into(), None).await {
|
||||||
self.collab_metrics.write_snapshot_failures.inc();
|
self.collab_metrics.write_snapshot_failures.inc();
|
||||||
return Err(err);
|
return Err(err);
|
||||||
|
|
|
||||||
|
|
@ -1304,7 +1304,7 @@ async fn create_collab_snapshot_handler(
|
||||||
.create_snapshot(InsertSnapshotParams {
|
.create_snapshot(InsertSnapshotParams {
|
||||||
object_id,
|
object_id,
|
||||||
workspace_id,
|
workspace_id,
|
||||||
data,
|
doc_state: data,
|
||||||
collab_type,
|
collab_type,
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue