refactor: add PB suffix to flowy-editor crate's structs

This commit is contained in:
appflowy 2022-07-18 11:58:39 +08:00
parent 609d103779
commit 67f88fab0b
18 changed files with 81 additions and 81 deletions

View File

@ -6,17 +6,17 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-sync/text_block.pb.dart';
class DocumentService {
Future<Either<TextBlockDelta, FlowyError>> openDocument({
Future<Either<TextBlockDeltaPB, FlowyError>> openDocument({
required String docId,
}) async {
await FolderEventSetLatestView(ViewId(value: docId)).send();
final payload = TextBlockId(value: docId);
final payload = TextBlockIdPB(value: docId);
return TextBlockEventGetBlockData(payload).send();
}
Future<Either<TextBlockDelta, FlowyError>> composeDelta({required String docId, required String data}) {
final payload = TextBlockDelta.create()
Future<Either<TextBlockDeltaPB, FlowyError>> composeDelta({required String docId, required String data}) {
final payload = TextBlockDeltaPB.create()
..blockId = docId
..deltaStr = data;
return TextBlockEventApplyDelta(payload).send();

View File

@ -33,7 +33,7 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
});
}
ExportData _convertDeltaToMarkdown(ExportData value) {
ExportDataPB _convertDeltaToMarkdown(ExportDataPB value) {
final result = deltaToMarkdown(value.data);
value.data = result;
writeFile(result);
@ -73,5 +73,5 @@ class DocShareEvent with _$DocShareEvent {
class DocShareState with _$DocShareState {
const factory DocShareState.initial() = _Initial;
const factory DocShareState.loading() = _Loading;
const factory DocShareState.finish(Either<ExportData, FlowyError> successOrFail) = _Finish;
const factory DocShareState.finish(Either<ExportDataPB, FlowyError> successOrFail) = _Finish;
}

View File

@ -5,23 +5,23 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-text-block/protobuf.dart';
class ShareService {
Future<Either<ExportData, FlowyError>> export(String docId, ExportType type) {
final request = ExportPayload.create()
Future<Either<ExportDataPB, FlowyError>> export(String docId, ExportType type) {
final request = ExportPayloadPB.create()
..viewId = docId
..exportType = type;
return TextBlockEventExportDocument(request).send();
}
Future<Either<ExportData, FlowyError>> exportText(String docId) {
Future<Either<ExportDataPB, FlowyError>> exportText(String docId) {
return export(docId, ExportType.Text);
}
Future<Either<ExportData, FlowyError>> exportMarkdown(String docId) {
Future<Either<ExportDataPB, FlowyError>> exportMarkdown(String docId) {
return export(docId, ExportType.Markdown);
}
Future<Either<ExportData, FlowyError>> exportURL(String docId) {
Future<Either<ExportDataPB, FlowyError>> exportURL(String docId) {
return export(docId, ExportType.Link);
}
}

View File

@ -160,7 +160,7 @@ class DocumentShareButton extends StatelessWidget {
);
}
void _handleExportData(ExportData exportData) {
void _handleExportData(ExportDataPB exportData) {
switch (exportData.exportType) {
case ExportType.Link:
break;

View File

@ -17,7 +17,7 @@ use crate::{
use bytes::Bytes;
use flowy_database::kv::KV;
use flowy_folder_data_model::revision::{gen_view_id, ViewRevision};
use flowy_sync::entities::text_block::TextBlockId;
use flowy_sync::entities::text_block::TextBlockIdPB;
use futures::{FutureExt, StreamExt};
use std::{collections::HashSet, sync::Arc};
@ -177,7 +177,7 @@ impl ViewController {
}
#[tracing::instrument(level = "debug", skip(self,params), fields(doc_id = %params.value), err)]
pub(crate) async fn delete_view(&self, params: TextBlockId) -> Result<(), FlowyError> {
pub(crate) async fn delete_view(&self, params: TextBlockIdPB) -> Result<(), FlowyError> {
if let Some(view_id) = KV::get_str(LATEST_VIEW_ID) {
if view_id == params.value {
let _ = KV::remove(LATEST_VIEW_ID);

View File

@ -17,7 +17,7 @@ use flowy_folder::{errors::ErrorCode, services::folder_editor::FolderEditor};
use flowy_revision::disk::RevisionState;
use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS;
use flowy_sync::entities::text_block::TextBlockInfo;
use flowy_sync::entities::text_block::TextBlockInfoPB;
use flowy_test::{event_builder::*, FlowySDKTest};
use std::{sync::Arc, time::Duration};
use tokio::time::sleep;
@ -399,14 +399,14 @@ pub async fn delete_view(sdk: &FlowySDKTest, view_ids: Vec<String>) {
}
#[allow(dead_code)]
pub async fn set_latest_view(sdk: &FlowySDKTest, view_id: &str) -> TextBlockInfo {
pub async fn set_latest_view(sdk: &FlowySDKTest, view_id: &str) -> TextBlockInfoPB {
let view_id: ViewId = view_id.into();
FolderEventBuilder::new(sdk.clone())
.event(SetLatestView)
.payload(view_id)
.async_send()
.await
.parse::<TextBlockInfo>()
.parse::<TextBlockInfoPB>()
}
pub async fn read_trash(sdk: &FlowySDKTest) -> RepeatedTrash {

View File

@ -3,7 +3,7 @@ use crate::{
request::{HttpRequestBuilder, ResponseMiddleware},
};
use flowy_error::FlowyError;
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo};
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockIdPB, TextBlockInfoPB};
use flowy_text_block::BlockCloudService;
use http_flowy::response::FlowyResponse;
use lazy_static::lazy_static;
@ -27,7 +27,7 @@ impl BlockCloudService for BlockHttpCloudService {
FutureResult::new(async move { create_document_request(&token, params, &url).await })
}
fn read_block(&self, token: &str, params: TextBlockId) -> FutureResult<Option<TextBlockInfo>, FlowyError> {
fn read_block(&self, token: &str, params: TextBlockIdPB) -> FutureResult<Option<TextBlockInfoPB>, FlowyError> {
let token = token.to_owned();
let url = self.config.doc_url();
FutureResult::new(async move { read_document_request(&token, params, &url).await })
@ -52,9 +52,9 @@ pub async fn create_document_request(token: &str, params: CreateTextBlockParams,
pub async fn read_document_request(
token: &str,
params: TextBlockId,
params: TextBlockIdPB,
url: &str,
) -> Result<Option<TextBlockInfo>, FlowyError> {
) -> Result<Option<TextBlockInfoPB>, FlowyError> {
let doc = request_builder()
.get(&url.to_owned())
.header(HEADER_TOKEN, token)

View File

@ -1,5 +1,5 @@
use flowy_sync::{
entities::{folder::FolderInfo, text_block::TextBlockInfo},
entities::{folder::FolderInfo, text_block::TextBlockInfoPB},
errors::CollaborateError,
protobuf::{RepeatedRevision as RepeatedRevisionPB, Revision as RevisionPB},
server_document::*,
@ -111,7 +111,7 @@ impl FolderCloudPersistence for LocalTextBlockCloudPersistence {
}
impl TextBlockCloudPersistence for LocalTextBlockCloudPersistence {
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfo, CollaborateError> {
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfoPB, CollaborateError> {
let storage = self.storage.clone();
let doc_id = doc_id.to_owned();
Box::pin(async move {
@ -127,7 +127,7 @@ impl TextBlockCloudPersistence for LocalTextBlockCloudPersistence {
&self,
doc_id: &str,
repeated_revision: RepeatedRevisionPB,
) -> BoxResultFuture<Option<TextBlockInfo>, CollaborateError> {
) -> BoxResultFuture<Option<TextBlockInfoPB>, CollaborateError> {
let doc_id = doc_id.to_owned();
let storage = self.storage.clone();
Box::pin(async move {

View File

@ -6,7 +6,7 @@ use flowy_folder::event_map::FolderCouldServiceV1;
use flowy_sync::{
client_document::default::initial_quill_delta_string,
entities::{
text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo},
text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockIdPB, TextBlockInfoPB},
ws_data::{ClientRevisionWSData, ClientRevisionWSDataType},
},
errors::CollaborateError,
@ -419,8 +419,8 @@ impl BlockCloudService for LocalServer {
FutureResult::new(async { Ok(()) })
}
fn read_block(&self, _token: &str, params: TextBlockId) -> FutureResult<Option<TextBlockInfo>, FlowyError> {
let doc = TextBlockInfo {
fn read_block(&self, _token: &str, params: TextBlockIdPB) -> FutureResult<Option<TextBlockInfoPB>, FlowyError> {
let doc = TextBlockInfoPB {
block_id: params.value,
text: initial_quill_delta_string(),
rev_id: 0,

View File

@ -9,7 +9,7 @@ use flowy_error::{internal_error, FlowyResult};
use flowy_revision::{RevisionCloudService, RevisionManager, RevisionObjectBuilder, RevisionWebSocket};
use flowy_sync::entities::ws_data::ServerRevisionWSData;
use flowy_sync::{
entities::{revision::Revision, text_block::TextBlockInfo},
entities::{revision::Revision, text_block::TextBlockInfoPB},
errors::CollaborateResult,
util::make_delta_from_revisions,
};
@ -229,14 +229,14 @@ impl TextBlockEditor {
struct TextBlockInfoBuilder();
impl RevisionObjectBuilder for TextBlockInfoBuilder {
type Output = TextBlockInfo;
type Output = TextBlockInfoPB;
fn build_object(object_id: &str, revisions: Vec<Revision>) -> FlowyResult<Self::Output> {
let (base_rev_id, rev_id) = revisions.last().unwrap().pair_rev_id();
let mut delta = make_delta_from_revisions(revisions)?;
correct_delta(&mut delta);
Result::<TextBlockInfo, FlowyError>::Ok(TextBlockInfo {
Result::<TextBlockInfoPB, FlowyError>::Ok(TextBlockInfoPB {
block_id: object_id.to_owned(),
text: delta.to_delta_str(),
rev_id,

View File

@ -30,7 +30,7 @@ impl std::convert::From<i32> for ExportType {
}
#[derive(Default, ProtoBuf)]
pub struct ExportPayload {
pub struct ExportPayloadPB {
#[pb(index = 1)]
pub view_id: String,
@ -44,7 +44,7 @@ pub struct ExportParams {
pub export_type: ExportType,
}
impl TryInto<ExportParams> for ExportPayload {
impl TryInto<ExportParams> for ExportPayloadPB {
type Error = ErrorCode;
fn try_into(self) -> Result<ExportParams, Self::Error> {
Ok(ExportParams {
@ -55,7 +55,7 @@ impl TryInto<ExportParams> for ExportPayload {
}
#[derive(Default, ProtoBuf)]
pub struct ExportData {
pub struct ExportDataPB {
#[pb(index = 1)]
pub data: String,

View File

@ -1,41 +1,41 @@
use crate::entities::{ExportData, ExportParams, ExportPayload};
use crate::entities::{ExportDataPB, ExportParams, ExportPayloadPB};
use crate::TextBlockManager;
use flowy_error::FlowyError;
use flowy_sync::entities::text_block::{TextBlockDelta, TextBlockId};
use flowy_sync::entities::text_block::{TextBlockDeltaPB, TextBlockIdPB};
use lib_dispatch::prelude::{data_result, AppData, Data, DataResult};
use std::convert::TryInto;
use std::sync::Arc;
pub(crate) async fn get_block_data_handler(
data: Data<TextBlockId>,
data: Data<TextBlockIdPB>,
manager: AppData<Arc<TextBlockManager>>,
) -> DataResult<TextBlockDelta, FlowyError> {
let block_id: TextBlockId = data.into_inner();
) -> DataResult<TextBlockDeltaPB, FlowyError> {
let block_id: TextBlockIdPB = data.into_inner();
let editor = manager.open_block(&block_id).await?;
let delta_str = editor.delta_str().await?;
data_result(TextBlockDelta {
data_result(TextBlockDeltaPB {
block_id: block_id.into(),
delta_str,
})
}
pub(crate) async fn apply_delta_handler(
data: Data<TextBlockDelta>,
data: Data<TextBlockDeltaPB>,
manager: AppData<Arc<TextBlockManager>>,
) -> DataResult<TextBlockDelta, FlowyError> {
) -> DataResult<TextBlockDeltaPB, FlowyError> {
let block_delta = manager.receive_local_delta(data.into_inner()).await?;
data_result(block_delta)
}
#[tracing::instrument(level = "debug", skip(data, manager), err)]
pub(crate) async fn export_handler(
data: Data<ExportPayload>,
data: Data<ExportPayloadPB>,
manager: AppData<Arc<TextBlockManager>>,
) -> DataResult<ExportData, FlowyError> {
) -> DataResult<ExportDataPB, FlowyError> {
let params: ExportParams = data.into_inner().try_into()?;
let editor = manager.open_block(&params.view_id).await?;
let delta_json = editor.delta_str().await?;
data_result(ExportData {
data_result(ExportDataPB {
data: delta_json,
export_type: params.export_type,
})

View File

@ -19,12 +19,12 @@ pub fn create(block_manager: Arc<TextBlockManager>) -> Module {
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
#[event_err = "FlowyError"]
pub enum TextBlockEvent {
#[event(input = "TextBlockId", output = "TextBlockDelta")]
#[event(input = "TextBlockIdPB", output = "TextBlockDeltaPB")]
GetBlockData = 0,
#[event(input = "TextBlockDelta", output = "TextBlockDelta")]
#[event(input = "TextBlockDeltaPB", output = "TextBlockDeltaPB")]
ApplyDelta = 1,
#[event(input = "ExportPayload", output = "ExportData")]
#[event(input = "ExportPayloadPB", output = "ExportDataPB")]
ExportDocument = 2,
}

View File

@ -15,13 +15,13 @@ pub mod errors {
pub const TEXT_BLOCK_SYNC_INTERVAL_IN_MILLIS: u64 = 1000;
use crate::errors::FlowyError;
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockId, TextBlockInfo};
use flowy_sync::entities::text_block::{CreateTextBlockParams, ResetTextBlockParams, TextBlockIdPB, TextBlockInfoPB};
use lib_infra::future::FutureResult;
pub trait BlockCloudService: Send + Sync {
fn create_block(&self, token: &str, params: CreateTextBlockParams) -> FutureResult<(), FlowyError>;
fn read_block(&self, token: &str, params: TextBlockId) -> FutureResult<Option<TextBlockInfo>, FlowyError>;
fn read_block(&self, token: &str, params: TextBlockIdPB) -> FutureResult<Option<TextBlockInfoPB>, FlowyError>;
fn update_block(&self, token: &str, params: ResetTextBlockParams) -> FutureResult<(), FlowyError>;
}

View File

@ -7,7 +7,7 @@ use flowy_revision::disk::SQLiteTextBlockRevisionPersistence;
use flowy_revision::{RevisionCloudService, RevisionManager, RevisionPersistence, RevisionWebSocket};
use flowy_sync::entities::{
revision::{md5, RepeatedRevision, Revision},
text_block::{TextBlockDelta, TextBlockId},
text_block::{TextBlockDeltaPB, TextBlockIdPB},
ws_data::ServerRevisionWSData,
};
use lib_infra::future::FutureResult;
@ -71,11 +71,11 @@ impl TextBlockManager {
}
#[tracing::instrument(level = "debug", skip(self, delta), fields(doc_id = %delta.block_id), err)]
pub async fn receive_local_delta(&self, delta: TextBlockDelta) -> Result<TextBlockDelta, FlowyError> {
pub async fn receive_local_delta(&self, delta: TextBlockDeltaPB) -> Result<TextBlockDeltaPB, FlowyError> {
let editor = self.get_block_editor(&delta.block_id).await?;
let _ = editor.compose_local_delta(Bytes::from(delta.delta_str)).await?;
let document_json = editor.delta_str().await?;
Ok(TextBlockDelta {
Ok(TextBlockDeltaPB {
block_id: delta.block_id.clone(),
delta_str: document_json,
})
@ -153,7 +153,7 @@ struct TextBlockRevisionCloudService {
impl RevisionCloudService for TextBlockRevisionCloudService {
#[tracing::instrument(level = "trace", skip(self))]
fn fetch_object(&self, user_id: &str, object_id: &str) -> FutureResult<Vec<Revision>, FlowyError> {
let params: TextBlockId = object_id.to_string().into();
let params: TextBlockIdPB = object_id.to_string().into();
let server = self.server.clone();
let token = self.token.clone();
let user_id = user_id.to_string();

View File

@ -15,7 +15,7 @@ pub struct CreateTextBlockParams {
}
#[derive(ProtoBuf, Default, Debug, Clone, Eq, PartialEq)]
pub struct TextBlockInfo {
pub struct TextBlockInfoPB {
#[pb(index = 1)]
pub block_id: String,
@ -29,14 +29,14 @@ pub struct TextBlockInfo {
pub base_rev_id: i64,
}
impl TextBlockInfo {
impl TextBlockInfoPB {
pub fn delta(&self) -> Result<RichTextDelta, OTError> {
let delta = RichTextDelta::from_bytes(&self.text)?;
Ok(delta)
}
}
impl std::convert::TryFrom<Revision> for TextBlockInfo {
impl std::convert::TryFrom<Revision> for TextBlockInfoPB {
type Error = CollaborateError;
fn try_from(revision: Revision) -> Result<Self, Self::Error> {
@ -48,7 +48,7 @@ impl std::convert::TryFrom<Revision> for TextBlockInfo {
let delta = RichTextDelta::from_bytes(&revision.delta_data)?;
let doc_json = delta.to_delta_str();
Ok(TextBlockInfo {
Ok(TextBlockInfoPB {
block_id: revision.object_id,
text: doc_json,
rev_id: revision.rev_id,
@ -67,7 +67,7 @@ pub struct ResetTextBlockParams {
}
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct TextBlockDelta {
pub struct TextBlockDeltaPB {
#[pb(index = 1)]
pub block_id: String,
@ -76,7 +76,7 @@ pub struct TextBlockDelta {
}
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct NewDocUser {
pub struct NewDocUserPB {
#[pb(index = 1)]
pub user_id: String,
@ -88,30 +88,30 @@ pub struct NewDocUser {
}
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct TextBlockId {
pub struct TextBlockIdPB {
#[pb(index = 1)]
pub value: String,
}
impl AsRef<str> for TextBlockId {
impl AsRef<str> for TextBlockIdPB {
fn as_ref(&self) -> &str {
&self.value
}
}
impl std::convert::From<String> for TextBlockId {
impl std::convert::From<String> for TextBlockIdPB {
fn from(value: String) -> Self {
TextBlockId { value }
TextBlockIdPB { value }
}
}
impl std::convert::From<TextBlockId> for String {
fn from(block_id: TextBlockId) -> Self {
impl std::convert::From<TextBlockIdPB> for String {
fn from(block_id: TextBlockIdPB) -> Self {
block_id.value
}
}
impl std::convert::From<&String> for TextBlockId {
impl std::convert::From<&String> for TextBlockIdPB {
fn from(s: &String) -> Self {
TextBlockId { value: s.to_owned() }
TextBlockIdPB { value: s.to_owned() }
}
}

View File

@ -1,5 +1,5 @@
use crate::{
entities::{text_block::TextBlockInfo, ws_data::ServerRevisionWSDataBuilder},
entities::{text_block::TextBlockInfoPB, ws_data::ServerRevisionWSDataBuilder},
errors::{internal_error, CollaborateError, CollaborateResult},
protobuf::{ClientRevisionWSData, RepeatedRevision as RepeatedRevisionPB, Revision as RevisionPB},
server_document::document_pad::ServerDocument,
@ -18,13 +18,13 @@ use tokio::{
};
pub trait TextBlockCloudPersistence: Send + Sync + Debug {
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfo, CollaborateError>;
fn read_text_block(&self, doc_id: &str) -> BoxResultFuture<TextBlockInfoPB, CollaborateError>;
fn create_text_block(
&self,
doc_id: &str,
repeated_revision: RepeatedRevisionPB,
) -> BoxResultFuture<Option<TextBlockInfo>, CollaborateError>;
) -> BoxResultFuture<Option<TextBlockInfoPB>, CollaborateError>;
fn read_text_block_revisions(
&self,
@ -182,7 +182,10 @@ impl ServerDocumentManager {
}
#[tracing::instrument(level = "debug", skip(self, doc), err)]
async fn create_document_handler(&self, doc: TextBlockInfo) -> Result<Arc<OpenDocumentHandler>, CollaborateError> {
async fn create_document_handler(
&self,
doc: TextBlockInfoPB,
) -> Result<Arc<OpenDocumentHandler>, CollaborateError> {
let persistence = self.persistence.clone();
let handle = spawn_blocking(|| OpenDocumentHandler::new(doc, persistence))
.await
@ -206,7 +209,7 @@ struct OpenDocumentHandler {
}
impl OpenDocumentHandler {
fn new(doc: TextBlockInfo, persistence: Arc<dyn TextBlockCloudPersistence>) -> Result<Self, CollaborateError> {
fn new(doc: TextBlockInfoPB, persistence: Arc<dyn TextBlockCloudPersistence>) -> Result<Self, CollaborateError> {
let doc_id = doc.block_id.clone();
let (sender, receiver) = mpsc::channel(1000);
let users = DashMap::new();

View File

@ -2,13 +2,10 @@ use crate::{
entities::{
folder::{FolderDelta, FolderInfo},
revision::{RepeatedRevision, Revision},
text_block::TextBlockInfo,
text_block::TextBlockInfoPB,
},
errors::{CollaborateError, CollaborateResult},
protobuf::{
FolderInfo as FolderInfoPB, RepeatedRevision as RepeatedRevisionPB, Revision as RevisionPB,
TextBlockInfo as TextBlockInfoPB,
},
protobuf::{FolderInfo as FolderInfoPB, RepeatedRevision as RepeatedRevisionPB, Revision as RevisionPB},
};
use dissimilar::Chunk;
use lib_ot::core::{DeltaBuilder, FlowyStr};
@ -202,11 +199,11 @@ pub fn make_folder_pb_from_revisions_pb(
pub fn make_document_info_from_revisions_pb(
doc_id: &str,
revisions: RepeatedRevisionPB,
) -> Result<Option<TextBlockInfo>, CollaborateError> {
) -> Result<Option<TextBlockInfoPB>, CollaborateError> {
match make_document_info_pb_from_revisions_pb(doc_id, revisions)? {
None => Ok(None),
Some(pb) => {
let document_info: TextBlockInfo = pb.try_into().map_err(|e| {
let document_info: TextBlockInfoPB = pb.try_into().map_err(|e| {
CollaborateError::internal().context(format!("Deserialize document info from pb failed: {}", e))
})?;
Ok(Some(document_info))
@ -218,7 +215,7 @@ pub fn make_document_info_from_revisions_pb(
pub fn make_document_info_pb_from_revisions_pb(
doc_id: &str,
mut revisions: RepeatedRevisionPB,
) -> Result<Option<TextBlockInfoPB>, CollaborateError> {
) -> Result<Option<crate::protobuf::TextBlockInfoPB>, CollaborateError> {
let revisions = revisions.take_items();
if revisions.is_empty() {
return Ok(None);
@ -240,7 +237,7 @@ pub fn make_document_info_pb_from_revisions_pb(
}
let text = document_delta.to_delta_str();
let mut block_info = TextBlockInfoPB::new();
let mut block_info = crate::protobuf::TextBlockInfoPB::new();
block_info.set_block_id(doc_id.to_owned());
block_info.set_text(text);
block_info.set_base_rev_id(base_rev_id);