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"))]
|
||||
pub object_id: String,
|
||||
#[validate(custom(function = "validate_not_empty_payload"))]
|
||||
pub data: Bytes,
|
||||
pub doc_state: Bytes,
|
||||
#[validate(custom(function = "validate_not_empty_str"))]
|
||||
pub workspace_id: String,
|
||||
pub collab_type: CollabType,
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ where
|
|||
user: self.user.clone(),
|
||||
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}")]
|
||||
Lease(Box<dyn std::error::Error + Send + Sync>),
|
||||
|
||||
#[error("failed to send ws message: {0}")]
|
||||
SendWSMessageFailed(String),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
|
|||
|
|
@ -1151,7 +1151,7 @@ impl CollabPersister {
|
|||
.observe(doc_state_full.len() as f64);
|
||||
let params = InsertSnapshotParams {
|
||||
object_id: self.object_id.clone(),
|
||||
data: doc_state_full.into(),
|
||||
doc_state: doc_state_full.into(),
|
||||
workspace_id: self.workspace_id.clone(),
|
||||
collab_type: self.collab_type.clone(),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ where
|
|||
let data = encode_collab.doc_state;
|
||||
let params = InsertSnapshotParams {
|
||||
object_id,
|
||||
data,
|
||||
doc_state: data,
|
||||
workspace_id,
|
||||
collab_type,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ impl SnapshotControl {
|
|||
let timestamp = Utc::now();
|
||||
let snapshot_id = timestamp.timestamp_millis();
|
||||
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 {
|
||||
self.collab_metrics.write_snapshot_failures.inc();
|
||||
return Err(err);
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,7 @@ async fn create_collab_snapshot_handler(
|
|||
.create_snapshot(InsertSnapshotParams {
|
||||
object_id,
|
||||
workspace_id,
|
||||
data,
|
||||
doc_state: data,
|
||||
collab_type,
|
||||
})
|
||||
.await?;
|
||||
|
|
|
|||
Loading…
Reference in New Issue