chore: refactor grid block

This commit is contained in:
appflowy 2022-03-17 17:25:43 +08:00
parent 1237962ab2
commit 4730ca9302
39 changed files with 1657 additions and 1050 deletions

View File

@ -3,6 +3,7 @@ import 'package:app_flowy/user/application/user_service.dart';
import 'package:app_flowy/workspace/application/app/prelude.dart';
import 'package:app_flowy/workspace/application/doc/prelude.dart';
import 'package:app_flowy/workspace/application/grid/prelude.dart';
import 'package:app_flowy/workspace/application/grid/row_listener.dart';
import 'package:app_flowy/workspace/application/trash/prelude.dart';
import 'package:app_flowy/workspace/application/workspace/prelude.dart';
import 'package:app_flowy/workspace/application/view/prelude.dart';
@ -98,6 +99,7 @@ class HomeDepsResolver {
getIt.registerFactoryParam<RowBloc, GridRowData, void>(
(data, _) => RowBloc(
service: RowService(data),
listener: RowListener(rowId: data.row.id),
),
);

View File

@ -3,12 +3,12 @@ import 'package:equatable/equatable.dart';
class GridInfo {
final String gridId;
List<Row> rows;
List<GridBlock> gridBlocks;
List<Field> fields;
GridInfo({
required this.gridId,
required this.rows,
required this.gridBlocks,
required this.fields,
});

View File

@ -14,8 +14,8 @@ import 'grid_service.dart';
part 'grid_bloc.freezed.dart';
class GridBloc extends Bloc<GridEvent, GridState> {
final GridService service;
final View view;
final GridService service;
final GridListener listener;
Grid? _grid;
List<Field>? _fields;
@ -49,9 +49,9 @@ class GridBloc extends Bloc<GridEvent, GridState> {
Future<void> _startGridListening() async {
listener.createRowNotifier.addPublishListener((result) {
result.fold((row) {
result.fold((repeatedRow) {
//
Log.info("$row");
Log.info("$repeatedRow");
}, (err) => null);
});
@ -91,10 +91,18 @@ class GridBloc extends Bloc<GridEvent, GridState> {
Future<void> _loadGridInfo(Emitter<GridState> emit) async {
final grid = _grid;
if (grid != null && _fields != null) {
final result = await service.getRows(gridId: grid.id, rowOrders: grid.rowOrders);
result.fold((repeatedRow) {
final rows = repeatedRow.items;
final gridInfo = GridInfo(gridId: grid.id, rows: rows, fields: _fields!);
final result = await service.getGridBlocks(
gridId: grid.id,
blocks: grid.blocks,
);
result.fold((repeatedGridBlock) {
final blocks = repeatedGridBlock.items;
final gridInfo = GridInfo(
gridId: grid.id,
blocks: blocks,
fields: _fields!,
);
emit(
state.copyWith(loadingState: GridLoadingState.finish(left(unit)), gridInfo: some(left(gridInfo))),
);

View File

@ -9,13 +9,11 @@ import 'dart:typed_data';
import 'package:app_flowy/core/notification_helper.dart';
import 'package:dartz/dartz.dart';
typedef CreateRowNotifiedValue = Either<RepeatedRow, FlowyError>;
typedef DeleteRowNotifierValue = Either<RepeatedRow, FlowyError>;
typedef GridBlockUpdateNotifiedValue = Either<GridBlockId, FlowyError>;
class GridListener {
final String gridId;
PublishNotifier<CreateRowNotifiedValue> createRowNotifier = PublishNotifier<CreateRowNotifiedValue>();
PublishNotifier<DeleteRowNotifierValue> deleteRowNotifier = PublishNotifier<DeleteRowNotifierValue>();
PublishNotifier<GridBlockUpdateNotifiedValue> blockUpdateNotifier = PublishNotifier<GridBlockUpdateNotifiedValue>();
StreamSubscription<SubscribeObject>? _subscription;
late GridNotificationParser _parser;
@ -34,16 +32,10 @@ class GridListener {
void _handleObservableType(GridNotification ty, Either<Uint8List, FlowyError> result) {
switch (ty) {
case GridNotification.GridDidCreateRows:
case GridNotification.GridDidUpdateBlock:
result.fold(
(payload) => createRowNotifier.value = left(RepeatedRow.fromBuffer(payload)),
(error) => createRowNotifier.value = right(error),
);
break;
case GridNotification.GridDidDeleteRow:
result.fold(
(payload) => deleteRowNotifier.value = left(RepeatedRow.fromBuffer(payload)),
(error) => deleteRowNotifier.value = right(error),
(payload) => blockUpdateNotifier.value = left(GridBlockId.fromBuffer(payload)),
(error) => blockUpdateNotifier.value = right(error),
);
break;
@ -54,7 +46,6 @@ class GridListener {
Future<void> close() async {
await _subscription?.cancel();
createRowNotifier.dispose();
deleteRowNotifier.dispose();
blockUpdateNotifier.dispose();
}
}

View File

@ -3,6 +3,7 @@ import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
import 'package:dartz/dartz.dart';
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/meta.pb.dart';
class GridService {
Future<Either<Grid, FlowyError>> openGrid({required String gridId}) async {
@ -18,11 +19,12 @@ class GridService {
return GridEventCreateRow(payload).send();
}
Future<Either<RepeatedRow, FlowyError>> getRows({required String gridId, required List<RowOrder> rowOrders}) {
final payload = QueryRowPayload.create()
Future<Either<RepeatedGridBlock, FlowyError>> getGridBlocks(
{required String gridId, required List<GridBlockMeta> blocks}) {
final payload = QueryGridBlocksPayload.create()
..gridId = gridId
..rowOrders = RepeatedRowOrder(items: rowOrders);
return GridEventGetRows(payload).send();
..blocks.addAll(blocks);
return GridEventGetGridBlocks(payload).send();
}
Future<Either<RepeatedField, FlowyError>> getFields({required String gridId, required List<FieldOrder> fieldOrders}) {

View File

@ -1,19 +1,24 @@
import 'package:flowy_sdk/log.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:async';
import 'data.dart';
import 'row_listener.dart';
import 'row_service.dart';
part 'row_bloc.freezed.dart';
class RowBloc extends Bloc<RowEvent, RowState> {
final RowService service;
final RowListener listener;
RowBloc({required this.service}) : super(RowState.initial(service.rowData)) {
RowBloc({required this.service, required this.listener}) : super(RowState.initial(service.rowData)) {
on<RowEvent>(
(event, emit) async {
await event.map(
initial: (_InitialRow value) async {},
initial: (_InitialRow value) async {
_startRowListening();
},
createRow: (_CreateRow value) {
service.createRow();
},
@ -30,8 +35,26 @@ class RowBloc extends Bloc<RowEvent, RowState> {
@override
Future<void> close() async {
await listener.close();
return super.close();
}
Future<void> _startRowListening() async {
listener.updateRowNotifier.addPublishListener((result) {
result.fold((row) {
//
}, (err) => null);
});
listener.updateCellNotifier.addPublishListener((result) {
result.fold((repeatedCvell) {
//
Log.info("$repeatedCvell");
}, (r) => null);
});
listener.start();
}
}
@freezed

View File

@ -0,0 +1,54 @@
import 'package:flowy_sdk/protobuf/dart-notify/subject.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart';
import 'package:flowy_sdk/protobuf/flowy-grid/dart_notification.pb.dart';
import 'package:flowy_sdk/rust_stream.dart';
import 'package:flowy_infra/notifier.dart';
import 'dart:async';
import 'dart:typed_data';
import 'package:app_flowy/core/notification_helper.dart';
import 'package:dartz/dartz.dart';
typedef UpdateCellNotifiedValue = Either<RepeatedCell, FlowyError>;
typedef UpdateRowNotifiedValue = Either<Row, FlowyError>;
class RowListener {
final String rowId;
PublishNotifier<UpdateCellNotifiedValue> updateCellNotifier = PublishNotifier<UpdateCellNotifiedValue>();
PublishNotifier<UpdateRowNotifiedValue> updateRowNotifier = PublishNotifier<UpdateRowNotifiedValue>();
StreamSubscription<SubscribeObject>? _subscription;
late GridNotificationParser _parser;
RowListener({required this.rowId});
void start() {
_parser = GridNotificationParser(
id: rowId,
callback: (ty, result) {
_handleObservableType(ty, result);
},
);
_subscription = RustStreamReceiver.listen((observable) => _parser.parse(observable));
}
void _handleObservableType(GridNotification ty, Either<Uint8List, FlowyError> result) {
switch (ty) {
case GridNotification.GridDidUpdateCells:
result.fold(
(payload) => updateCellNotifier.value = left(RepeatedCell.fromBuffer(payload)),
(error) => updateCellNotifier.value = right(error),
);
break;
default:
break;
}
}
Future<void> close() async {
await _subscription?.cancel();
updateCellNotifier.dispose();
updateRowNotifier.dispose();
}
}

View File

@ -18,18 +18,18 @@ class GridEventGetGridData {
}
}
class GridEventGetRows {
QueryRowPayload request;
GridEventGetRows(this.request);
class GridEventGetGridBlocks {
QueryGridBlocksPayload request;
GridEventGetGridBlocks(this.request);
Future<Either<RepeatedRow, FlowyError>> send() {
Future<Either<RepeatedGridBlock, FlowyError>> send() {
final request = FFIRequest.create()
..event = GridEvent.GetRows.toString()
..event = GridEvent.GetGridBlocks.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(RepeatedRow.fromBuffer(okBytes)),
(okBytes) => left(RepeatedGridBlock.fromBuffer(okBytes)),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}

View File

@ -9,13 +9,15 @@ import 'dart:core' as $core;
import 'package:protobuf/protobuf.dart' as $pb;
import 'meta.pb.dart' as $0;
import 'meta.pbenum.dart' as $0;
class Grid extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'Grid', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..pc<FieldOrder>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldOrders', $pb.PbFieldType.PM, subBuilder: FieldOrder.create)
..pc<RowOrder>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowOrders', $pb.PbFieldType.PM, subBuilder: RowOrder.create)
..pc<$0.GridBlockMeta>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blocks', $pb.PbFieldType.PM, subBuilder: $0.GridBlockMeta.create)
..hasRequiredFields = false
;
@ -23,7 +25,7 @@ class Grid extends $pb.GeneratedMessage {
factory Grid({
$core.String? id,
$core.Iterable<FieldOrder>? fieldOrders,
$core.Iterable<RowOrder>? rowOrders,
$core.Iterable<$0.GridBlockMeta>? blocks,
}) {
final _result = create();
if (id != null) {
@ -32,8 +34,8 @@ class Grid extends $pb.GeneratedMessage {
if (fieldOrders != null) {
_result.fieldOrders.addAll(fieldOrders);
}
if (rowOrders != null) {
_result.rowOrders.addAll(rowOrders);
if (blocks != null) {
_result.blocks.addAll(blocks);
}
return _result;
}
@ -71,7 +73,7 @@ class Grid extends $pb.GeneratedMessage {
$core.List<FieldOrder> get fieldOrders => $_getList(1);
@$pb.TagNumber(3)
$core.List<RowOrder> get rowOrders => $_getList(2);
$core.List<$0.GridBlockMeta> get blocks => $_getList(2);
}
class Field extends $pb.GeneratedMessage {
@ -505,15 +507,15 @@ class Row extends $pb.GeneratedMessage {
void clearHeight() => clearField(3);
}
class RepeatedRow extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedRow', createEmptyInstance: create)
..pc<Row>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: Row.create)
class RepeatedGridBlock extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'RepeatedGridBlock', createEmptyInstance: create)
..pc<GridBlock>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'items', $pb.PbFieldType.PM, subBuilder: GridBlock.create)
..hasRequiredFields = false
;
RepeatedRow._() : super();
factory RepeatedRow({
$core.Iterable<Row>? items,
RepeatedGridBlock._() : super();
factory RepeatedGridBlock({
$core.Iterable<GridBlock>? items,
}) {
final _result = create();
if (items != null) {
@ -521,29 +523,84 @@ class RepeatedRow extends $pb.GeneratedMessage {
}
return _result;
}
factory RepeatedRow.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RepeatedRow.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory RepeatedGridBlock.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory RepeatedGridBlock.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
RepeatedRow clone() => RepeatedRow()..mergeFromMessage(this);
RepeatedGridBlock clone() => RepeatedGridBlock()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
RepeatedRow copyWith(void Function(RepeatedRow) updates) => super.copyWith((message) => updates(message as RepeatedRow)) as RepeatedRow; // ignore: deprecated_member_use
RepeatedGridBlock copyWith(void Function(RepeatedGridBlock) updates) => super.copyWith((message) => updates(message as RepeatedGridBlock)) as RepeatedGridBlock; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static RepeatedRow create() => RepeatedRow._();
RepeatedRow createEmptyInstance() => create();
static $pb.PbList<RepeatedRow> createRepeated() => $pb.PbList<RepeatedRow>();
static RepeatedGridBlock create() => RepeatedGridBlock._();
RepeatedGridBlock createEmptyInstance() => create();
static $pb.PbList<RepeatedGridBlock> createRepeated() => $pb.PbList<RepeatedGridBlock>();
@$core.pragma('dart2js:noInline')
static RepeatedRow getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RepeatedRow>(create);
static RepeatedRow? _defaultInstance;
static RepeatedGridBlock getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<RepeatedGridBlock>(create);
static RepeatedGridBlock? _defaultInstance;
@$pb.TagNumber(1)
$core.List<Row> get items => $_getList(0);
$core.List<GridBlock> get items => $_getList(0);
}
class GridBlock extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridBlock', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blockId')
..pc<Row>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rows', $pb.PbFieldType.PM, subBuilder: Row.create)
..hasRequiredFields = false
;
GridBlock._() : super();
factory GridBlock({
$core.String? blockId,
$core.Iterable<Row>? rows,
}) {
final _result = create();
if (blockId != null) {
_result.blockId = blockId;
}
if (rows != null) {
_result.rows.addAll(rows);
}
return _result;
}
factory GridBlock.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GridBlock.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GridBlock clone() => GridBlock()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GridBlock copyWith(void Function(GridBlock) updates) => super.copyWith((message) => updates(message as GridBlock)) as GridBlock; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static GridBlock create() => GridBlock._();
GridBlock createEmptyInstance() => create();
static $pb.PbList<GridBlock> createRepeated() => $pb.PbList<GridBlock>();
@$core.pragma('dart2js:noInline')
static GridBlock getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GridBlock>(create);
static GridBlock? _defaultInstance;
@$pb.TagNumber(1)
$core.String get blockId => $_getSZ(0);
@$pb.TagNumber(1)
set blockId($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasBlockId() => $_has(0);
@$pb.TagNumber(1)
void clearBlockId() => clearField(1);
@$pb.TagNumber(2)
$core.List<Row> get rows => $_getList(1);
}
class Cell extends $pb.GeneratedMessage {
@ -742,6 +799,53 @@ class GridId extends $pb.GeneratedMessage {
void clearValue() => clearField(1);
}
class GridBlockId extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridBlockId', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'value')
..hasRequiredFields = false
;
GridBlockId._() : super();
factory GridBlockId({
$core.String? value,
}) {
final _result = create();
if (value != null) {
_result.value = value;
}
return _result;
}
factory GridBlockId.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GridBlockId.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GridBlockId clone() => GridBlockId()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GridBlockId copyWith(void Function(GridBlockId) updates) => super.copyWith((message) => updates(message as GridBlockId)) as GridBlockId; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static GridBlockId create() => GridBlockId._();
GridBlockId createEmptyInstance() => create();
static $pb.PbList<GridBlockId> createRepeated() => $pb.PbList<GridBlockId>();
@$core.pragma('dart2js:noInline')
static GridBlockId getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GridBlockId>(create);
static GridBlockId? _defaultInstance;
@$pb.TagNumber(1)
$core.String get value => $_getSZ(0);
@$pb.TagNumber(1)
set value($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasValue() => $_has(0);
@$pb.TagNumber(1)
void clearValue() => clearField(1);
}
enum CreateRowPayload_OneOfUpperRowId {
upperRowId,
notSet
@ -879,47 +983,47 @@ class QueryFieldPayload extends $pb.GeneratedMessage {
RepeatedFieldOrder ensureFieldOrders() => $_ensure(1);
}
class QueryRowPayload extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryRowPayload', createEmptyInstance: create)
class QueryGridBlocksPayload extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'QueryGridBlocksPayload', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
..aOM<RepeatedRowOrder>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowOrders', subBuilder: RepeatedRowOrder.create)
..pc<$0.GridBlockMeta>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blocks', $pb.PbFieldType.PM, subBuilder: $0.GridBlockMeta.create)
..hasRequiredFields = false
;
QueryRowPayload._() : super();
factory QueryRowPayload({
QueryGridBlocksPayload._() : super();
factory QueryGridBlocksPayload({
$core.String? gridId,
RepeatedRowOrder? rowOrders,
$core.Iterable<$0.GridBlockMeta>? blocks,
}) {
final _result = create();
if (gridId != null) {
_result.gridId = gridId;
}
if (rowOrders != null) {
_result.rowOrders = rowOrders;
if (blocks != null) {
_result.blocks.addAll(blocks);
}
return _result;
}
factory QueryRowPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory QueryRowPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
factory QueryGridBlocksPayload.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory QueryGridBlocksPayload.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
QueryRowPayload clone() => QueryRowPayload()..mergeFromMessage(this);
QueryGridBlocksPayload clone() => QueryGridBlocksPayload()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
QueryRowPayload copyWith(void Function(QueryRowPayload) updates) => super.copyWith((message) => updates(message as QueryRowPayload)) as QueryRowPayload; // ignore: deprecated_member_use
QueryGridBlocksPayload copyWith(void Function(QueryGridBlocksPayload) updates) => super.copyWith((message) => updates(message as QueryGridBlocksPayload)) as QueryGridBlocksPayload; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static QueryRowPayload create() => QueryRowPayload._();
QueryRowPayload createEmptyInstance() => create();
static $pb.PbList<QueryRowPayload> createRepeated() => $pb.PbList<QueryRowPayload>();
static QueryGridBlocksPayload create() => QueryGridBlocksPayload._();
QueryGridBlocksPayload createEmptyInstance() => create();
static $pb.PbList<QueryGridBlocksPayload> createRepeated() => $pb.PbList<QueryGridBlocksPayload>();
@$core.pragma('dart2js:noInline')
static QueryRowPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<QueryRowPayload>(create);
static QueryRowPayload? _defaultInstance;
static QueryGridBlocksPayload getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<QueryGridBlocksPayload>(create);
static QueryGridBlocksPayload? _defaultInstance;
@$pb.TagNumber(1)
$core.String get gridId => $_getSZ(0);
@ -931,14 +1035,6 @@ class QueryRowPayload extends $pb.GeneratedMessage {
void clearGridId() => clearField(1);
@$pb.TagNumber(2)
RepeatedRowOrder get rowOrders => $_getN(1);
@$pb.TagNumber(2)
set rowOrders(RepeatedRowOrder v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasRowOrders() => $_has(1);
@$pb.TagNumber(2)
void clearRowOrders() => clearField(2);
@$pb.TagNumber(2)
RepeatedRowOrder ensureRowOrders() => $_ensure(1);
$core.List<$0.GridBlockMeta> get blocks => $_getList(1);
}

View File

@ -14,12 +14,12 @@ const Grid$json = const {
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'field_orders', '3': 2, '4': 3, '5': 11, '6': '.FieldOrder', '10': 'fieldOrders'},
const {'1': 'row_orders', '3': 3, '4': 3, '5': 11, '6': '.RowOrder', '10': 'rowOrders'},
const {'1': 'blocks', '3': 3, '4': 3, '5': 11, '6': '.GridBlockMeta', '10': 'blocks'},
],
};
/// Descriptor for `Grid`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridDescriptor = $convert.base64Decode('CgRHcmlkEg4KAmlkGAEgASgJUgJpZBIuCgxmaWVsZF9vcmRlcnMYAiADKAsyCy5GaWVsZE9yZGVyUgtmaWVsZE9yZGVycxIoCgpyb3dfb3JkZXJzGAMgAygLMgkuUm93T3JkZXJSCXJvd09yZGVycw==');
final $typed_data.Uint8List gridDescriptor = $convert.base64Decode('CgRHcmlkEg4KAmlkGAEgASgJUgJpZBIuCgxmaWVsZF9vcmRlcnMYAiADKAsyCy5GaWVsZE9yZGVyUgtmaWVsZE9yZGVycxImCgZibG9ja3MYAyADKAsyDi5HcmlkQmxvY2tNZXRhUgZibG9ja3M=');
@$core.Deprecated('Use fieldDescriptor instead')
const Field$json = const {
'1': 'Field',
@ -110,16 +110,27 @@ const Row_CellByFieldIdEntry$json = const {
/// Descriptor for `Row`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List rowDescriptor = $convert.base64Decode('CgNSb3cSDgoCaWQYASABKAlSAmlkEkAKEGNlbGxfYnlfZmllbGRfaWQYAiADKAsyFy5Sb3cuQ2VsbEJ5RmllbGRJZEVudHJ5Ug1jZWxsQnlGaWVsZElkEhYKBmhlaWdodBgDIAEoBVIGaGVpZ2h0GkcKEkNlbGxCeUZpZWxkSWRFbnRyeRIQCgNrZXkYASABKAlSA2tleRIbCgV2YWx1ZRgCIAEoCzIFLkNlbGxSBXZhbHVlOgI4AQ==');
@$core.Deprecated('Use repeatedRowDescriptor instead')
const RepeatedRow$json = const {
'1': 'RepeatedRow',
@$core.Deprecated('Use repeatedGridBlockDescriptor instead')
const RepeatedGridBlock$json = const {
'1': 'RepeatedGridBlock',
'2': const [
const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.Row', '10': 'items'},
const {'1': 'items', '3': 1, '4': 3, '5': 11, '6': '.GridBlock', '10': 'items'},
],
};
/// Descriptor for `RepeatedRow`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List repeatedRowDescriptor = $convert.base64Decode('CgtSZXBlYXRlZFJvdxIaCgVpdGVtcxgBIAMoCzIELlJvd1IFaXRlbXM=');
/// Descriptor for `RepeatedGridBlock`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List repeatedGridBlockDescriptor = $convert.base64Decode('ChFSZXBlYXRlZEdyaWRCbG9jaxIgCgVpdGVtcxgBIAMoCzIKLkdyaWRCbG9ja1IFaXRlbXM=');
@$core.Deprecated('Use gridBlockDescriptor instead')
const GridBlock$json = const {
'1': 'GridBlock',
'2': const [
const {'1': 'block_id', '3': 1, '4': 1, '5': 9, '10': 'blockId'},
const {'1': 'rows', '3': 2, '4': 3, '5': 11, '6': '.Row', '10': 'rows'},
],
};
/// Descriptor for `GridBlock`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridBlockDescriptor = $convert.base64Decode('CglHcmlkQmxvY2sSGQoIYmxvY2tfaWQYASABKAlSB2Jsb2NrSWQSGAoEcm93cxgCIAMoCzIELlJvd1IEcm93cw==');
@$core.Deprecated('Use cellDescriptor instead')
const Cell$json = const {
'1': 'Cell',
@ -161,6 +172,16 @@ const GridId$json = const {
/// Descriptor for `GridId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridIdDescriptor = $convert.base64Decode('CgZHcmlkSWQSFAoFdmFsdWUYASABKAlSBXZhbHVl');
@$core.Deprecated('Use gridBlockIdDescriptor instead')
const GridBlockId$json = const {
'1': 'GridBlockId',
'2': const [
const {'1': 'value', '3': 1, '4': 1, '5': 9, '10': 'value'},
],
};
/// Descriptor for `GridBlockId`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridBlockIdDescriptor = $convert.base64Decode('CgtHcmlkQmxvY2tJZBIUCgV2YWx1ZRgBIAEoCVIFdmFsdWU=');
@$core.Deprecated('Use createRowPayloadDescriptor instead')
const CreateRowPayload$json = const {
'1': 'CreateRowPayload',
@ -186,14 +207,14 @@ const QueryFieldPayload$json = const {
/// Descriptor for `QueryFieldPayload`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryFieldPayloadDescriptor = $convert.base64Decode('ChFRdWVyeUZpZWxkUGF5bG9hZBIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSNgoMZmllbGRfb3JkZXJzGAIgASgLMhMuUmVwZWF0ZWRGaWVsZE9yZGVyUgtmaWVsZE9yZGVycw==');
@$core.Deprecated('Use queryRowPayloadDescriptor instead')
const QueryRowPayload$json = const {
'1': 'QueryRowPayload',
@$core.Deprecated('Use queryGridBlocksPayloadDescriptor instead')
const QueryGridBlocksPayload$json = const {
'1': 'QueryGridBlocksPayload',
'2': const [
const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
const {'1': 'row_orders', '3': 2, '4': 1, '5': 11, '6': '.RepeatedRowOrder', '10': 'rowOrders'},
const {'1': 'blocks', '3': 2, '4': 3, '5': 11, '6': '.GridBlockMeta', '10': 'blocks'},
],
};
/// Descriptor for `QueryRowPayload`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryRowPayloadDescriptor = $convert.base64Decode('Cg9RdWVyeVJvd1BheWxvYWQSFwoHZ3JpZF9pZBgBIAEoCVIGZ3JpZElkEjAKCnJvd19vcmRlcnMYAiABKAsyES5SZXBlYXRlZFJvd09yZGVyUglyb3dPcmRlcnM=');
/// Descriptor for `QueryGridBlocksPayload`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List queryGridBlocksPayloadDescriptor = $convert.base64Decode('ChZRdWVyeUdyaWRCbG9ja3NQYXlsb2FkEhcKB2dyaWRfaWQYASABKAlSBmdyaWRJZBImCgZibG9ja3MYAiADKAsyDi5HcmlkQmxvY2tNZXRhUgZibG9ja3M=');

View File

@ -17,7 +17,7 @@ class GridMeta extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridMeta', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridId')
..pc<FieldMeta>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fields', $pb.PbFieldType.PM, subBuilder: FieldMeta.create)
..pc<GridBlock>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blocks', $pb.PbFieldType.PM, subBuilder: GridBlock.create)
..pc<GridBlockMeta>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blocks', $pb.PbFieldType.PM, subBuilder: GridBlockMeta.create)
..hasRequiredFields = false
;
@ -25,7 +25,7 @@ class GridMeta extends $pb.GeneratedMessage {
factory GridMeta({
$core.String? gridId,
$core.Iterable<FieldMeta>? fields,
$core.Iterable<GridBlock>? blocks,
$core.Iterable<GridBlockMeta>? blocks,
}) {
final _result = create();
if (gridId != null) {
@ -73,102 +73,32 @@ class GridMeta extends $pb.GeneratedMessage {
$core.List<FieldMeta> get fields => $_getList(1);
@$pb.TagNumber(3)
$core.List<GridBlock> get blocks => $_getList(2);
}
class GridBlock extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridBlock', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'id')
..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'startRowIndex', $pb.PbFieldType.O3)
..a<$core.int>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowCount', $pb.PbFieldType.O3)
..hasRequiredFields = false
;
GridBlock._() : super();
factory GridBlock({
$core.String? id,
$core.int? startRowIndex,
$core.int? rowCount,
}) {
final _result = create();
if (id != null) {
_result.id = id;
}
if (startRowIndex != null) {
_result.startRowIndex = startRowIndex;
}
if (rowCount != null) {
_result.rowCount = rowCount;
}
return _result;
}
factory GridBlock.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GridBlock.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GridBlock clone() => GridBlock()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GridBlock copyWith(void Function(GridBlock) updates) => super.copyWith((message) => updates(message as GridBlock)) as GridBlock; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static GridBlock create() => GridBlock._();
GridBlock createEmptyInstance() => create();
static $pb.PbList<GridBlock> createRepeated() => $pb.PbList<GridBlock>();
@$core.pragma('dart2js:noInline')
static GridBlock getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GridBlock>(create);
static GridBlock? _defaultInstance;
@$pb.TagNumber(1)
$core.String get id => $_getSZ(0);
@$pb.TagNumber(1)
set id($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasId() => $_has(0);
@$pb.TagNumber(1)
void clearId() => clearField(1);
@$pb.TagNumber(2)
$core.int get startRowIndex => $_getIZ(1);
@$pb.TagNumber(2)
set startRowIndex($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasStartRowIndex() => $_has(1);
@$pb.TagNumber(2)
void clearStartRowIndex() => clearField(2);
@$pb.TagNumber(3)
$core.int get rowCount => $_getIZ(2);
@$pb.TagNumber(3)
set rowCount($core.int v) { $_setSignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasRowCount() => $_has(2);
@$pb.TagNumber(3)
void clearRowCount() => clearField(3);
$core.List<GridBlockMeta> get blocks => $_getList(2);
}
class GridBlockMeta extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridBlockMeta', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blockId')
..pc<RowMeta>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rows', $pb.PbFieldType.PM, subBuilder: RowMeta.create)
..a<$core.int>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'startRowIndex', $pb.PbFieldType.O3)
..a<$core.int>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowCount', $pb.PbFieldType.O3)
..hasRequiredFields = false
;
GridBlockMeta._() : super();
factory GridBlockMeta({
$core.String? blockId,
$core.Iterable<RowMeta>? rows,
$core.int? startRowIndex,
$core.int? rowCount,
}) {
final _result = create();
if (blockId != null) {
_result.blockId = blockId;
}
if (rows != null) {
_result.rows.addAll(rows);
if (startRowIndex != null) {
_result.startRowIndex = startRowIndex;
}
if (rowCount != null) {
_result.rowCount = rowCount;
}
return _result;
}
@ -203,7 +133,77 @@ class GridBlockMeta extends $pb.GeneratedMessage {
void clearBlockId() => clearField(1);
@$pb.TagNumber(2)
$core.List<RowMeta> get rows => $_getList(1);
$core.int get startRowIndex => $_getIZ(1);
@$pb.TagNumber(2)
set startRowIndex($core.int v) { $_setSignedInt32(1, v); }
@$pb.TagNumber(2)
$core.bool hasStartRowIndex() => $_has(1);
@$pb.TagNumber(2)
void clearStartRowIndex() => clearField(2);
@$pb.TagNumber(3)
$core.int get rowCount => $_getIZ(2);
@$pb.TagNumber(3)
set rowCount($core.int v) { $_setSignedInt32(2, v); }
@$pb.TagNumber(3)
$core.bool hasRowCount() => $_has(2);
@$pb.TagNumber(3)
void clearRowCount() => clearField(3);
}
class GridBlockMetaData extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'GridBlockMetaData', createEmptyInstance: create)
..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blockId')
..pc<RowMeta>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rowMetas', $pb.PbFieldType.PM, subBuilder: RowMeta.create)
..hasRequiredFields = false
;
GridBlockMetaData._() : super();
factory GridBlockMetaData({
$core.String? blockId,
$core.Iterable<RowMeta>? rowMetas,
}) {
final _result = create();
if (blockId != null) {
_result.blockId = blockId;
}
if (rowMetas != null) {
_result.rowMetas.addAll(rowMetas);
}
return _result;
}
factory GridBlockMetaData.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r);
factory GridBlockMetaData.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.deepCopy] instead. '
'Will be removed in next major version')
GridBlockMetaData clone() => GridBlockMetaData()..mergeFromMessage(this);
@$core.Deprecated(
'Using this can add significant overhead to your binary. '
'Use [GeneratedMessageGenericExtensions.rebuild] instead. '
'Will be removed in next major version')
GridBlockMetaData copyWith(void Function(GridBlockMetaData) updates) => super.copyWith((message) => updates(message as GridBlockMetaData)) as GridBlockMetaData; // ignore: deprecated_member_use
$pb.BuilderInfo get info_ => _i;
@$core.pragma('dart2js:noInline')
static GridBlockMetaData create() => GridBlockMetaData._();
GridBlockMetaData createEmptyInstance() => create();
static $pb.PbList<GridBlockMetaData> createRepeated() => $pb.PbList<GridBlockMetaData>();
@$core.pragma('dart2js:noInline')
static GridBlockMetaData getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor<GridBlockMetaData>(create);
static GridBlockMetaData? _defaultInstance;
@$pb.TagNumber(1)
$core.String get blockId => $_getSZ(0);
@$pb.TagNumber(1)
set blockId($core.String v) { $_setString(0, v); }
@$pb.TagNumber(1)
$core.bool hasBlockId() => $_has(0);
@$pb.TagNumber(1)
void clearBlockId() => clearField(1);
@$pb.TagNumber(2)
$core.List<RowMeta> get rowMetas => $_getList(1);
}
class FieldMeta extends $pb.GeneratedMessage {
@ -1020,16 +1020,16 @@ class CellMetaChangeset extends $pb.GeneratedMessage {
class BuildGridContext extends $pb.GeneratedMessage {
static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'BuildGridContext', createEmptyInstance: create)
..pc<FieldMeta>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'fieldMetas', $pb.PbFieldType.PM, subBuilder: FieldMeta.create)
..aOM<GridBlock>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridBlock', subBuilder: GridBlock.create)
..aOM<GridBlockMeta>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridBlockMeta', subBuilder: GridBlockMeta.create)
..aOM<GridBlockMeta>(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridBlock', subBuilder: GridBlockMeta.create)
..aOM<GridBlockMetaData>(3, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'gridBlockMetaData', subBuilder: GridBlockMetaData.create)
..hasRequiredFields = false
;
BuildGridContext._() : super();
factory BuildGridContext({
$core.Iterable<FieldMeta>? fieldMetas,
GridBlock? gridBlock,
GridBlockMeta? gridBlockMeta,
GridBlockMeta? gridBlock,
GridBlockMetaData? gridBlockMetaData,
}) {
final _result = create();
if (fieldMetas != null) {
@ -1038,8 +1038,8 @@ class BuildGridContext extends $pb.GeneratedMessage {
if (gridBlock != null) {
_result.gridBlock = gridBlock;
}
if (gridBlockMeta != null) {
_result.gridBlockMeta = gridBlockMeta;
if (gridBlockMetaData != null) {
_result.gridBlockMetaData = gridBlockMetaData;
}
return _result;
}
@ -1068,25 +1068,25 @@ class BuildGridContext extends $pb.GeneratedMessage {
$core.List<FieldMeta> get fieldMetas => $_getList(0);
@$pb.TagNumber(2)
GridBlock get gridBlock => $_getN(1);
GridBlockMeta get gridBlock => $_getN(1);
@$pb.TagNumber(2)
set gridBlock(GridBlock v) { setField(2, v); }
set gridBlock(GridBlockMeta v) { setField(2, v); }
@$pb.TagNumber(2)
$core.bool hasGridBlock() => $_has(1);
@$pb.TagNumber(2)
void clearGridBlock() => clearField(2);
@$pb.TagNumber(2)
GridBlock ensureGridBlock() => $_ensure(1);
GridBlockMeta ensureGridBlock() => $_ensure(1);
@$pb.TagNumber(3)
GridBlockMeta get gridBlockMeta => $_getN(2);
GridBlockMetaData get gridBlockMetaData => $_getN(2);
@$pb.TagNumber(3)
set gridBlockMeta(GridBlockMeta v) { setField(3, v); }
set gridBlockMetaData(GridBlockMetaData v) { setField(3, v); }
@$pb.TagNumber(3)
$core.bool hasGridBlockMeta() => $_has(2);
$core.bool hasGridBlockMetaData() => $_has(2);
@$pb.TagNumber(3)
void clearGridBlockMeta() => clearField(3);
void clearGridBlockMetaData() => clearField(3);
@$pb.TagNumber(3)
GridBlockMeta ensureGridBlockMeta() => $_ensure(2);
GridBlockMetaData ensureGridBlockMetaData() => $_ensure(2);
}

View File

@ -29,35 +29,35 @@ const GridMeta$json = const {
'2': const [
const {'1': 'grid_id', '3': 1, '4': 1, '5': 9, '10': 'gridId'},
const {'1': 'fields', '3': 2, '4': 3, '5': 11, '6': '.FieldMeta', '10': 'fields'},
const {'1': 'blocks', '3': 3, '4': 3, '5': 11, '6': '.GridBlock', '10': 'blocks'},
const {'1': 'blocks', '3': 3, '4': 3, '5': 11, '6': '.GridBlockMeta', '10': 'blocks'},
],
};
/// Descriptor for `GridMeta`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridMetaDescriptor = $convert.base64Decode('CghHcmlkTWV0YRIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSIgoGZmllbGRzGAIgAygLMgouRmllbGRNZXRhUgZmaWVsZHMSIgoGYmxvY2tzGAMgAygLMgouR3JpZEJsb2NrUgZibG9ja3M=');
@$core.Deprecated('Use gridBlockDescriptor instead')
const GridBlock$json = const {
'1': 'GridBlock',
'2': const [
const {'1': 'id', '3': 1, '4': 1, '5': 9, '10': 'id'},
const {'1': 'start_row_index', '3': 2, '4': 1, '5': 5, '10': 'startRowIndex'},
const {'1': 'row_count', '3': 3, '4': 1, '5': 5, '10': 'rowCount'},
],
};
/// Descriptor for `GridBlock`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridBlockDescriptor = $convert.base64Decode('CglHcmlkQmxvY2sSDgoCaWQYASABKAlSAmlkEiYKD3N0YXJ0X3Jvd19pbmRleBgCIAEoBVINc3RhcnRSb3dJbmRleBIbCglyb3dfY291bnQYAyABKAVSCHJvd0NvdW50');
final $typed_data.Uint8List gridMetaDescriptor = $convert.base64Decode('CghHcmlkTWV0YRIXCgdncmlkX2lkGAEgASgJUgZncmlkSWQSIgoGZmllbGRzGAIgAygLMgouRmllbGRNZXRhUgZmaWVsZHMSJgoGYmxvY2tzGAMgAygLMg4uR3JpZEJsb2NrTWV0YVIGYmxvY2tz');
@$core.Deprecated('Use gridBlockMetaDescriptor instead')
const GridBlockMeta$json = const {
'1': 'GridBlockMeta',
'2': const [
const {'1': 'block_id', '3': 1, '4': 1, '5': 9, '10': 'blockId'},
const {'1': 'rows', '3': 2, '4': 3, '5': 11, '6': '.RowMeta', '10': 'rows'},
const {'1': 'start_row_index', '3': 2, '4': 1, '5': 5, '10': 'startRowIndex'},
const {'1': 'row_count', '3': 3, '4': 1, '5': 5, '10': 'rowCount'},
],
};
/// Descriptor for `GridBlockMeta`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridBlockMetaDescriptor = $convert.base64Decode('Cg1HcmlkQmxvY2tNZXRhEhkKCGJsb2NrX2lkGAEgASgJUgdibG9ja0lkEhwKBHJvd3MYAiADKAsyCC5Sb3dNZXRhUgRyb3dz');
final $typed_data.Uint8List gridBlockMetaDescriptor = $convert.base64Decode('Cg1HcmlkQmxvY2tNZXRhEhkKCGJsb2NrX2lkGAEgASgJUgdibG9ja0lkEiYKD3N0YXJ0X3Jvd19pbmRleBgCIAEoBVINc3RhcnRSb3dJbmRleBIbCglyb3dfY291bnQYAyABKAVSCHJvd0NvdW50');
@$core.Deprecated('Use gridBlockMetaDataDescriptor instead')
const GridBlockMetaData$json = const {
'1': 'GridBlockMetaData',
'2': const [
const {'1': 'block_id', '3': 1, '4': 1, '5': 9, '10': 'blockId'},
const {'1': 'row_metas', '3': 2, '4': 3, '5': 11, '6': '.RowMeta', '10': 'rowMetas'},
],
};
/// Descriptor for `GridBlockMetaData`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List gridBlockMetaDataDescriptor = $convert.base64Decode('ChFHcmlkQmxvY2tNZXRhRGF0YRIZCghibG9ja19pZBgBIAEoCVIHYmxvY2tJZBIlCglyb3dfbWV0YXMYAiADKAsyCC5Sb3dNZXRhUghyb3dNZXRhcw==');
@$core.Deprecated('Use fieldMetaDescriptor instead')
const FieldMeta$json = const {
'1': 'FieldMeta',
@ -197,10 +197,10 @@ const BuildGridContext$json = const {
'1': 'BuildGridContext',
'2': const [
const {'1': 'field_metas', '3': 1, '4': 3, '5': 11, '6': '.FieldMeta', '10': 'fieldMetas'},
const {'1': 'grid_block', '3': 2, '4': 1, '5': 11, '6': '.GridBlock', '10': 'gridBlock'},
const {'1': 'grid_block_meta', '3': 3, '4': 1, '5': 11, '6': '.GridBlockMeta', '10': 'gridBlockMeta'},
const {'1': 'grid_block', '3': 2, '4': 1, '5': 11, '6': '.GridBlockMeta', '10': 'gridBlock'},
const {'1': 'grid_block_meta_data', '3': 3, '4': 1, '5': 11, '6': '.GridBlockMetaData', '10': 'gridBlockMetaData'},
],
};
/// Descriptor for `BuildGridContext`. Decode as a `google.protobuf.DescriptorProto`.
final $typed_data.Uint8List buildGridContextDescriptor = $convert.base64Decode('ChBCdWlsZEdyaWRDb250ZXh0EisKC2ZpZWxkX21ldGFzGAEgAygLMgouRmllbGRNZXRhUgpmaWVsZE1ldGFzEikKCmdyaWRfYmxvY2sYAiABKAsyCi5HcmlkQmxvY2tSCWdyaWRCbG9jaxI2Cg9ncmlkX2Jsb2NrX21ldGEYAyABKAsyDi5HcmlkQmxvY2tNZXRhUg1ncmlkQmxvY2tNZXRh');
final $typed_data.Uint8List buildGridContextDescriptor = $convert.base64Decode('ChBCdWlsZEdyaWRDb250ZXh0EisKC2ZpZWxkX21ldGFzGAEgAygLMgouRmllbGRNZXRhUgpmaWVsZE1ldGFzEi0KCmdyaWRfYmxvY2sYAiABKAsyDi5HcmlkQmxvY2tNZXRhUglncmlkQmxvY2sSQwoUZ3JpZF9ibG9ja19tZXRhX2RhdGEYAyABKAsyEi5HcmlkQmxvY2tNZXRhRGF0YVIRZ3JpZEJsb2NrTWV0YURhdGE=');

View File

@ -11,17 +11,13 @@ import 'package:protobuf/protobuf.dart' as $pb;
class GridNotification extends $pb.ProtobufEnum {
static const GridNotification Unknown = GridNotification._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'Unknown');
static const GridNotification GridDidCreateRows = GridNotification._(10, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidCreateRows');
static const GridNotification GridDidDeleteRow = GridNotification._(11, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidDeleteRow');
static const GridNotification GridDidUpdateRows = GridNotification._(12, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidUpdateRows');
static const GridNotification GridDidUpdateBlock = GridNotification._(10, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidUpdateBlock');
static const GridNotification GridDidUpdateCells = GridNotification._(20, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidUpdateCells');
static const GridNotification GridDidUpdateFields = GridNotification._(30, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GridDidUpdateFields');
static const $core.List<GridNotification> values = <GridNotification> [
Unknown,
GridDidCreateRows,
GridDidDeleteRow,
GridDidUpdateRows,
GridDidUpdateBlock,
GridDidUpdateCells,
GridDidUpdateFields,
];

View File

@ -13,13 +13,11 @@ const GridNotification$json = const {
'1': 'GridNotification',
'2': const [
const {'1': 'Unknown', '2': 0},
const {'1': 'GridDidCreateRows', '2': 10},
const {'1': 'GridDidDeleteRow', '2': 11},
const {'1': 'GridDidUpdateRows', '2': 12},
const {'1': 'GridDidUpdateBlock', '2': 10},
const {'1': 'GridDidUpdateCells', '2': 20},
const {'1': 'GridDidUpdateFields', '2': 30},
],
};
/// Descriptor for `GridNotification`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List gridNotificationDescriptor = $convert.base64Decode('ChBHcmlkTm90aWZpY2F0aW9uEgsKB1Vua25vd24QABIVChFHcmlkRGlkQ3JlYXRlUm93cxAKEhQKEEdyaWREaWREZWxldGVSb3cQCxIVChFHcmlkRGlkVXBkYXRlUm93cxAMEhYKEkdyaWREaWRVcGRhdGVDZWxscxAUEhcKE0dyaWREaWRVcGRhdGVGaWVsZHMQHg==');
final $typed_data.Uint8List gridNotificationDescriptor = $convert.base64Decode('ChBHcmlkTm90aWZpY2F0aW9uEgsKB1Vua25vd24QABIWChJHcmlkRGlkVXBkYXRlQmxvY2sQChIWChJHcmlkRGlkVXBkYXRlQ2VsbHMQFBIXChNHcmlkRGlkVXBkYXRlRmllbGRzEB4=');

View File

@ -11,14 +11,14 @@ import 'package:protobuf/protobuf.dart' as $pb;
class GridEvent extends $pb.ProtobufEnum {
static const GridEvent GetGridData = GridEvent._(0, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetGridData');
static const GridEvent GetRows = GridEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetRows');
static const GridEvent GetGridBlocks = GridEvent._(1, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetGridBlocks');
static const GridEvent GetFields = GridEvent._(2, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'GetFields');
static const GridEvent CreateRow = GridEvent._(3, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CreateRow');
static const GridEvent UpdateCell = GridEvent._(4, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateCell');
static const $core.List<GridEvent> values = <GridEvent> [
GetGridData,
GetRows,
GetGridBlocks,
GetFields,
CreateRow,
UpdateCell,

View File

@ -13,7 +13,7 @@ const GridEvent$json = const {
'1': 'GridEvent',
'2': const [
const {'1': 'GetGridData', '2': 0},
const {'1': 'GetRows', '2': 1},
const {'1': 'GetGridBlocks', '2': 1},
const {'1': 'GetFields', '2': 2},
const {'1': 'CreateRow', '2': 3},
const {'1': 'UpdateCell', '2': 4},
@ -21,4 +21,4 @@ const GridEvent$json = const {
};
/// Descriptor for `GridEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABILCgdHZXRSb3dzEAESDQoJR2V0RmllbGRzEAISDQoJQ3JlYXRlUm93EAMSDgoKVXBkYXRlQ2VsbBAE');
final $typed_data.Uint8List gridEventDescriptor = $convert.base64Decode('CglHcmlkRXZlbnQSDwoLR2V0R3JpZERhdGEQABIRCg1HZXRHcmlkQmxvY2tzEAESDQoJR2V0RmllbGRzEAISDQoJQ3JlYXRlUm93EAMSDgoKVXBkYXRlQ2VsbBAE');

View File

@ -5,9 +5,7 @@ const OBSERVABLE_CATEGORY: &str = "Grid";
#[derive(ProtoBuf_Enum, Debug)]
pub enum GridNotification {
Unknown = 0,
GridDidCreateRows = 10,
GridDidDeleteRow = 11,
GridDidUpdateRows = 12,
GridDidUpdateBlock = 10,
GridDidUpdateCells = 20,
GridDidUpdateFields = 30,

View File

@ -1,8 +1,8 @@
use crate::manager::GridManager;
use flowy_error::FlowyError;
use flowy_grid_data_model::entities::{
CellMetaChangeset, CreateRowPayload, Field, Grid, GridId, QueryFieldPayload, QueryRowPayload, RepeatedField,
RepeatedRow, Row,
CellMetaChangeset, CreateRowPayload, Field, Grid, GridId, QueryFieldPayload, QueryGridBlocksPayload, RepeatedField,
RepeatedGridBlock, Row,
};
use lib_dispatch::prelude::{data_result, AppData, Data, DataResult};
use std::sync::Arc;
@ -19,14 +19,14 @@ pub(crate) async fn get_grid_data_handler(
}
#[tracing::instrument(level = "debug", skip(data, manager), err)]
pub(crate) async fn get_rows_handler(
data: Data<QueryRowPayload>,
pub(crate) async fn get_grid_blocks_handler(
data: Data<QueryGridBlocksPayload>,
manager: AppData<Arc<GridManager>>,
) -> DataResult<RepeatedRow, FlowyError> {
let payload: QueryRowPayload = data.into_inner();
) -> DataResult<RepeatedGridBlock, FlowyError> {
let payload: QueryGridBlocksPayload = data.into_inner();
let editor = manager.get_grid_editor(&payload.grid_id)?;
let repeated_row: RepeatedRow = editor.get_rows(Some(payload.row_orders)).await?.into();
data_result(repeated_row)
let repeated_grid_block = editor.get_grid_blocks(Some(payload.blocks)).await?;
data_result(repeated_grid_block)
}
#[tracing::instrument(level = "debug", skip(data, manager), err)]

View File

@ -9,7 +9,7 @@ pub fn create(grid_manager: Arc<GridManager>) -> Module {
let mut module = Module::new().name(env!("CARGO_PKG_NAME")).data(grid_manager);
module = module
.event(GridEvent::GetGridData, get_grid_data_handler)
.event(GridEvent::GetRows, get_rows_handler)
.event(GridEvent::GetGridBlocks, get_grid_blocks_handler)
.event(GridEvent::GetFields, get_fields_handler)
.event(GridEvent::CreateRow, create_row_handler)
.event(GridEvent::UpdateCell, update_cell_handler);
@ -23,8 +23,8 @@ pub enum GridEvent {
#[event(input = "GridId", output = "Grid")]
GetGridData = 0,
#[event(input = "QueryRowPayload", output = "RepeatedRow")]
GetRows = 1,
#[event(input = "QueryGridBlocksPayload", output = "RepeatedGridBlock")]
GetGridBlocks = 1,
#[event(input = "QueryFieldPayload", output = "RepeatedField")]
GetFields = 2,

View File

@ -182,7 +182,7 @@ pub async fn make_grid_view_data(
grid_manager: Arc<GridManager>,
build_context: BuildGridContext,
) -> FlowyResult<Bytes> {
let block_id = build_context.grid_block.id.clone();
let block_id = build_context.grid_block.block_id.clone();
let grid_meta = GridMeta {
grid_id: view_id.to_string(),
fields: build_context.field_metas,
@ -195,7 +195,7 @@ pub async fn make_grid_view_data(
Revision::initial_revision(user_id, view_id, grid_delta_data.clone()).into();
let _ = grid_manager.create_grid(view_id, repeated_revision).await?;
let grid_block_meta_delta = make_block_meta_delta(&build_context.grid_block_meta);
let grid_block_meta_delta = make_block_meta_delta(&build_context.grid_block_meta_data);
let block_meta_delta_data = grid_block_meta_delta.to_delta_bytes();
let repeated_revision: RepeatedRevision =
Revision::initial_revision(user_id, &block_id, block_meta_delta_data).into();

View File

@ -26,9 +26,7 @@
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum GridNotification {
Unknown = 0,
GridDidCreateRows = 10,
GridDidDeleteRow = 11,
GridDidUpdateRows = 12,
GridDidUpdateBlock = 10,
GridDidUpdateCells = 20,
GridDidUpdateFields = 30,
}
@ -41,9 +39,7 @@ impl ::protobuf::ProtobufEnum for GridNotification {
fn from_i32(value: i32) -> ::std::option::Option<GridNotification> {
match value {
0 => ::std::option::Option::Some(GridNotification::Unknown),
10 => ::std::option::Option::Some(GridNotification::GridDidCreateRows),
11 => ::std::option::Option::Some(GridNotification::GridDidDeleteRow),
12 => ::std::option::Option::Some(GridNotification::GridDidUpdateRows),
10 => ::std::option::Option::Some(GridNotification::GridDidUpdateBlock),
20 => ::std::option::Option::Some(GridNotification::GridDidUpdateCells),
30 => ::std::option::Option::Some(GridNotification::GridDidUpdateFields),
_ => ::std::option::Option::None
@ -53,9 +49,7 @@ impl ::protobuf::ProtobufEnum for GridNotification {
fn values() -> &'static [Self] {
static values: &'static [GridNotification] = &[
GridNotification::Unknown,
GridNotification::GridDidCreateRows,
GridNotification::GridDidDeleteRow,
GridNotification::GridDidUpdateRows,
GridNotification::GridDidUpdateBlock,
GridNotification::GridDidUpdateCells,
GridNotification::GridDidUpdateFields,
];
@ -86,11 +80,9 @@ impl ::protobuf::reflect::ProtobufValue for GridNotification {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x17dart_notification.proto*\x94\x01\n\x10GridNotification\x12\x0b\n\
\x07Unknown\x10\0\x12\x15\n\x11GridDidCreateRows\x10\n\x12\x14\n\x10Grid\
DidDeleteRow\x10\x0b\x12\x15\n\x11GridDidUpdateRows\x10\x0c\x12\x16\n\
\x12GridDidUpdateCells\x10\x14\x12\x17\n\x13GridDidUpdateFields\x10\x1eb\
\x06proto3\
\n\x17dart_notification.proto*h\n\x10GridNotification\x12\x0b\n\x07Unkno\
wn\x10\0\x12\x16\n\x12GridDidUpdateBlock\x10\n\x12\x16\n\x12GridDidUpdat\
eCells\x10\x14\x12\x17\n\x13GridDidUpdateFields\x10\x1eb\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -26,7 +26,7 @@
#[derive(Clone,PartialEq,Eq,Debug,Hash)]
pub enum GridEvent {
GetGridData = 0,
GetRows = 1,
GetGridBlocks = 1,
GetFields = 2,
CreateRow = 3,
UpdateCell = 4,
@ -40,7 +40,7 @@ impl ::protobuf::ProtobufEnum for GridEvent {
fn from_i32(value: i32) -> ::std::option::Option<GridEvent> {
match value {
0 => ::std::option::Option::Some(GridEvent::GetGridData),
1 => ::std::option::Option::Some(GridEvent::GetRows),
1 => ::std::option::Option::Some(GridEvent::GetGridBlocks),
2 => ::std::option::Option::Some(GridEvent::GetFields),
3 => ::std::option::Option::Some(GridEvent::CreateRow),
4 => ::std::option::Option::Some(GridEvent::UpdateCell),
@ -51,7 +51,7 @@ impl ::protobuf::ProtobufEnum for GridEvent {
fn values() -> &'static [Self] {
static values: &'static [GridEvent] = &[
GridEvent::GetGridData,
GridEvent::GetRows,
GridEvent::GetGridBlocks,
GridEvent::GetFields,
GridEvent::CreateRow,
GridEvent::UpdateCell,
@ -83,9 +83,9 @@ impl ::protobuf::reflect::ProtobufValue for GridEvent {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0fevent_map.proto*W\n\tGridEvent\x12\x0f\n\x0bGetGridData\x10\0\x12\
\x0b\n\x07GetRows\x10\x01\x12\r\n\tGetFields\x10\x02\x12\r\n\tCreateRow\
\x10\x03\x12\x0e\n\nUpdateCell\x10\x04b\x06proto3\
\n\x0fevent_map.proto*]\n\tGridEvent\x12\x0f\n\x0bGetGridData\x10\0\x12\
\x11\n\rGetGridBlocks\x10\x01\x12\r\n\tGetFields\x10\x02\x12\r\n\tCreate\
Row\x10\x03\x12\x0e\n\nUpdateCell\x10\x04b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -2,9 +2,7 @@ syntax = "proto3";
enum GridNotification {
Unknown = 0;
GridDidCreateRows = 10;
GridDidDeleteRow = 11;
GridDidUpdateRows = 12;
GridDidUpdateBlock = 10;
GridDidUpdateCells = 20;
GridDidUpdateFields = 30;
}

View File

@ -2,7 +2,7 @@ syntax = "proto3";
enum GridEvent {
GetGridData = 0;
GetRows = 1;
GetGridBlocks = 1;
GetFields = 2;
CreateRow = 3;
UpdateCell = 4;

View File

@ -1,14 +1,14 @@
use crate::manager::GridUser;
use crate::services::row::{make_cell, make_row_ids_per_block, make_rows};
use crate::services::row::{make_cell, make_grid_blocks, make_row_ids_per_block, GridBlockMetaDataSnapshot};
use bytes::Bytes;
use dashmap::DashMap;
use flowy_collaboration::client_grid::{GridBlockMetaChange, GridBlockMetaPad};
use flowy_collaboration::client_grid::{GridBlockMetaDataChange, GridBlockMetaDataPad};
use flowy_collaboration::entities::revision::Revision;
use flowy_collaboration::util::make_delta_from_revisions;
use flowy_error::{FlowyError, FlowyResult};
use flowy_grid_data_model::entities::{
Cell, FieldMeta, GridBlock, GridBlockChangeset, RepeatedCell, RepeatedRow, RepeatedRowOrder, RowMeta,
Cell, FieldMeta, GridBlockId, GridBlockMeta, GridBlockMetaChangeset, RepeatedCell, RepeatedRowOrder, RowMeta,
RowMetaChangeset, RowOrder,
};
use flowy_sync::disk::SQLiteGridBlockMetaRevisionPersistence;
@ -30,12 +30,12 @@ type BlockId = String;
pub(crate) struct GridBlockMetaEditorManager {
grid_id: String,
user: Arc<dyn GridUser>,
editor_map: DashMap<String, Arc<ClientGridBlockMetaEditor>>,
editor_map: DashMap<String, Arc<ClientGridBlockMetaDataEditor>>,
block_id_by_row_id: DashMap<BlockId, RowId>,
}
impl GridBlockMetaEditorManager {
pub(crate) async fn new(grid_id: &str, user: &Arc<dyn GridUser>, blocks: Vec<GridBlock>) -> FlowyResult<Self> {
pub(crate) async fn new(grid_id: &str, user: &Arc<dyn GridUser>, blocks: Vec<GridBlockMeta>) -> FlowyResult<Self> {
let editor_map = make_block_meta_editor_map(user, blocks).await?;
let user = user.clone();
let block_id_by_row_id = DashMap::new();
@ -49,7 +49,7 @@ impl GridBlockMetaEditorManager {
Ok(manager)
}
pub(crate) async fn get_editor(&self, block_id: &str) -> FlowyResult<Arc<ClientGridBlockMetaEditor>> {
pub(crate) async fn get_editor(&self, block_id: &str) -> FlowyResult<Arc<ClientGridBlockMetaDataEditor>> {
match self.editor_map.get(block_id) {
None => {
tracing::error!("The is a fatal error, block is not exist");
@ -63,29 +63,22 @@ impl GridBlockMetaEditorManager {
pub(crate) async fn create_row(
&self,
field_metas: &[FieldMeta],
block_id: &str,
row_meta: RowMeta,
upper_row_id: Option<String>,
start_row_id: Option<String>,
) -> FlowyResult<i32> {
self.block_id_by_row_id
.insert(row_meta.id.clone(), row_meta.block_id.clone());
let editor = self.get_editor(&row_meta.block_id).await?;
let rows = make_rows(field_metas, vec![row_meta.clone().into()]);
send_dart_notification(&self.grid_id, GridNotification::GridDidCreateRows)
.payload(RepeatedRow::from(rows))
.send();
self.notify_did_create_rows(field_metas, vec![row_meta.clone()]);
editor.create_row(row_meta, upper_row_id).await
let row_count = editor.create_row(row_meta, start_row_id).await?;
self.notify_did_update_block(block_id).await?;
Ok(row_count)
}
pub(crate) async fn insert_row(
&self,
field_metas: &[FieldMeta],
rows_by_block_id: HashMap<String, Vec<RowMeta>>,
) -> FlowyResult<Vec<GridBlockChangeset>> {
) -> FlowyResult<Vec<GridBlockMetaChangeset>> {
let mut changesets = vec![];
for (block_id, row_metas) in rows_by_block_id {
let editor = self.get_editor(&block_id).await?;
@ -94,14 +87,14 @@ impl GridBlockMetaEditorManager {
self.block_id_by_row_id.insert(row.id.clone(), row.block_id.clone());
row_count = editor.create_row(row.clone(), None).await?;
}
changesets.push(GridBlockChangeset::from_row_count(&block_id, row_count));
self.notify_did_create_rows(field_metas, row_metas);
changesets.push(GridBlockMetaChangeset::from_row_count(&block_id, row_count));
let _ = self.notify_did_update_block(&block_id).await?;
}
Ok(changesets)
}
pub(crate) async fn delete_rows(&self, row_ids: Vec<String>) -> FlowyResult<Vec<GridBlockChangeset>> {
pub(crate) async fn delete_rows(&self, row_ids: Vec<String>) -> FlowyResult<Vec<GridBlockMetaChangeset>> {
let row_orders = row_ids
.into_iter()
.flat_map(|row_id| {
@ -117,7 +110,7 @@ impl GridBlockMetaEditorManager {
let editor = self.get_editor(&row_ids_per_block.block_id).await?;
let row_count = editor.delete_rows(row_ids_per_block.row_ids).await?;
let changeset = GridBlockChangeset::from_row_count(&row_ids_per_block.block_id, row_count);
let changeset = GridBlockMetaChangeset::from_row_count(&row_ids_per_block.block_id, row_count);
changesets.push(changeset);
}
@ -127,7 +120,7 @@ impl GridBlockMetaEditorManager {
pub async fn update_row(&self, changeset: RowMetaChangeset) -> FlowyResult<()> {
let editor = self.get_editor_from_row_id(&changeset.row_id).await?;
let _ = editor.update_row(changeset.clone()).await?;
let _ = self.notify_did_update_row()?;
let _ = self.notify_did_update_block(&editor.block_id).await?;
Ok(())
}
@ -138,48 +131,58 @@ impl GridBlockMetaEditorManager {
Ok(())
}
pub(crate) async fn get_all_rows(&self, grid_blocks: Vec<GridBlock>) -> FlowyResult<Vec<Arc<RowMeta>>> {
let mut row_metas = vec![];
pub(crate) async fn get_block_meta_snapshot_from_blocks(
&self,
grid_blocks: Vec<GridBlockMeta>,
) -> FlowyResult<Vec<GridBlockMetaDataSnapshot>> {
let mut snapshots = vec![];
for grid_block in grid_blocks {
let editor = self.get_editor(&grid_block.id).await?;
let new_row_metas = editor.get_row_metas(None).await?;
new_row_metas.iter().for_each(|row_meta| {
let editor = self.get_editor(&grid_block.block_id).await?;
let row_metas = editor.get_row_metas(None).await?;
row_metas.iter().for_each(|row_meta| {
self.block_id_by_row_id
.insert(row_meta.id.clone(), row_meta.block_id.clone());
});
row_metas.extend(new_row_metas);
snapshots.push(GridBlockMetaDataSnapshot {
block_id: grid_block.block_id,
row_metas,
});
}
Ok(row_metas)
Ok(snapshots)
}
pub(crate) async fn get_row_orders(&self, grid_blocks: Vec<GridBlock>) -> FlowyResult<Vec<RowOrder>> {
let mut row_orders = vec![];
for grid_block in grid_blocks {
let editor = self.get_editor(&grid_block.id).await?;
pub(crate) async fn get_block_meta_snapshot_from_row_orders(
&self,
grid_block_metas: &Vec<GridBlockMeta>,
) -> FlowyResult<Vec<GridBlockMetaDataSnapshot>> {
let mut snapshots = vec![];
for grid_block_meta in grid_block_metas {
let editor = self.get_editor(&grid_block_meta.block_id).await?;
let row_metas = editor.get_row_metas(None).await?;
let block_row_orders = row_metas.iter().map(RowOrder::from);
row_orders.extend(block_row_orders);
row_metas.iter().for_each(|row_meta| {
self.block_id_by_row_id
.insert(row_meta.id.clone(), row_meta.block_id.clone());
});
snapshots.push(GridBlockMetaDataSnapshot {
block_id: grid_block_meta.block_id.clone(),
row_metas,
});
}
Ok(snapshots)
}
pub(crate) async fn get_row_orders(&self, grid_block_ids: Vec<String>) -> FlowyResult<Vec<RowOrder>> {
let mut row_orders = vec![];
for grid_block_id in grid_block_ids {
let editor = self.get_editor(&grid_block_id).await?;
let new_row_order = editor.get_row_orders().await?;
row_orders.extend(new_row_order);
}
Ok(row_orders)
}
pub(crate) async fn get_rows(&self, row_orders: &RepeatedRowOrder) -> FlowyResult<Vec<Arc<RowMeta>>> {
let row_ids_per_blocks = make_row_ids_per_block(row_orders);
let mut row_metas = vec![];
for row_ids_per_block in row_ids_per_blocks {
let editor = self.get_editor(&row_ids_per_block.block_id).await?;
let new_row_metas = editor.get_row_metas(Some(row_ids_per_block.row_ids)).await?;
new_row_metas.iter().for_each(|row_meta| {
self.block_id_by_row_id
.insert(row_meta.id.clone(), row_meta.block_id.clone());
});
row_metas.extend(new_row_metas);
}
Ok(row_metas)
}
async fn get_editor_from_row_id(&self, row_id: &str) -> FlowyResult<Arc<ClientGridBlockMetaEditor>> {
async fn get_editor_from_row_id(&self, row_id: &str) -> FlowyResult<Arc<ClientGridBlockMetaDataEditor>> {
match self.block_id_by_row_id.get(row_id) {
None => {
let msg = format!(
@ -195,25 +198,14 @@ impl GridBlockMetaEditorManager {
}
}
fn notify_did_create_rows(&self, field_metas: &[FieldMeta], row_metas: Vec<RowMeta>) {
let rows = make_rows(
field_metas,
row_metas
.into_iter()
.map(|row_meta| Arc::new(row_meta))
.collect::<Vec<_>>(),
);
send_dart_notification(&self.grid_id, GridNotification::GridDidCreateRows)
.payload(RepeatedRow::from(rows))
async fn notify_did_update_block(&self, block_id: &str) -> FlowyResult<()> {
let block_id = GridBlockId {
value: block_id.to_owned(),
};
send_dart_notification(&self.grid_id, GridNotification::GridDidUpdateBlock)
.payload(block_id)
.send();
}
fn notify_did_update_row(&self) -> FlowyResult<()> {
// send_dart_notification(&changeset.row_id, GridNotification::GridDidUpdateRows)
// .payload(RepeatedRow::from(cells))
// .send();
todo!()
Ok(())
}
fn notify_did_update_cells(&self, changeset: RowMetaChangeset, field_metas: &[FieldMeta]) -> FlowyResult<()> {
@ -244,18 +236,21 @@ impl GridBlockMetaEditorManager {
async fn make_block_meta_editor_map(
user: &Arc<dyn GridUser>,
blocks: Vec<GridBlock>,
) -> FlowyResult<DashMap<String, Arc<ClientGridBlockMetaEditor>>> {
blocks: Vec<GridBlockMeta>,
) -> FlowyResult<DashMap<String, Arc<ClientGridBlockMetaDataEditor>>> {
let editor_map = DashMap::new();
for block in blocks {
let editor = make_block_meta_editor(user, &block.id).await?;
editor_map.insert(block.id, Arc::new(editor));
let editor = make_block_meta_editor(user, &block.block_id).await?;
editor_map.insert(block.block_id, Arc::new(editor));
}
Ok(editor_map)
}
async fn make_block_meta_editor(user: &Arc<dyn GridUser>, block_id: &str) -> FlowyResult<ClientGridBlockMetaEditor> {
async fn make_block_meta_editor(
user: &Arc<dyn GridUser>,
block_id: &str,
) -> FlowyResult<ClientGridBlockMetaDataEditor> {
let token = user.token()?;
let user_id = user.user_id()?;
let pool = user.db_pool()?;
@ -263,17 +258,17 @@ async fn make_block_meta_editor(user: &Arc<dyn GridUser>, block_id: &str) -> Flo
let disk_cache = Arc::new(SQLiteGridBlockMetaRevisionPersistence::new(&user_id, pool));
let rev_persistence = Arc::new(RevisionPersistence::new(&user_id, block_id, disk_cache));
let rev_manager = RevisionManager::new(&user_id, block_id, rev_persistence);
ClientGridBlockMetaEditor::new(&user_id, &token, block_id, rev_manager).await
ClientGridBlockMetaDataEditor::new(&user_id, &token, block_id, rev_manager).await
}
pub struct ClientGridBlockMetaEditor {
pub struct ClientGridBlockMetaDataEditor {
user_id: String,
pub block_id: String,
meta_pad: Arc<RwLock<GridBlockMetaPad>>,
pad: Arc<RwLock<GridBlockMetaDataPad>>,
rev_manager: Arc<RevisionManager>,
}
impl ClientGridBlockMetaEditor {
impl ClientGridBlockMetaDataEditor {
pub async fn new(
user_id: &str,
token: &str,
@ -284,23 +279,23 @@ impl ClientGridBlockMetaEditor {
token: token.to_owned(),
});
let block_meta_pad = rev_manager.load::<GridBlockMetaPadBuilder>(Some(cloud)).await?;
let meta_pad = Arc::new(RwLock::new(block_meta_pad));
let pad = Arc::new(RwLock::new(block_meta_pad));
let rev_manager = Arc::new(rev_manager);
let user_id = user_id.to_owned();
let block_id = block_id.to_owned();
Ok(Self {
user_id,
block_id,
meta_pad,
pad,
rev_manager,
})
}
async fn create_row(&self, row: RowMeta, upper_row_id: Option<String>) -> FlowyResult<i32> {
async fn create_row(&self, row: RowMeta, start_row_id: Option<String>) -> FlowyResult<i32> {
let mut row_count = 0;
let _ = self
.modify(|pad| {
let change = pad.add_row(row, upper_row_id)?;
let change = pad.add_row(row, start_row_id)?;
row_count = pad.number_of_rows();
Ok(change)
})
@ -327,13 +322,13 @@ impl ClientGridBlockMetaEditor {
}
pub async fn get_row_metas(&self, row_ids: Option<Vec<String>>) -> FlowyResult<Vec<Arc<RowMeta>>> {
let row_metas = self.meta_pad.read().await.get_rows(row_ids)?;
let row_metas = self.pad.read().await.get_rows(row_ids)?;
Ok(row_metas)
}
pub async fn get_row_orders(&self) -> FlowyResult<Vec<RowOrder>> {
let row_orders = self
.meta_pad
.pad
.read()
.await
.get_rows(None)?
@ -345,9 +340,9 @@ impl ClientGridBlockMetaEditor {
async fn modify<F>(&self, f: F) -> FlowyResult<()>
where
F: for<'a> FnOnce(&'a mut GridBlockMetaPad) -> FlowyResult<Option<GridBlockMetaChange>>,
F: for<'a> FnOnce(&'a mut GridBlockMetaDataPad) -> FlowyResult<Option<GridBlockMetaDataChange>>,
{
let mut write_guard = self.meta_pad.write().await;
let mut write_guard = self.pad.write().await;
match f(&mut *write_guard)? {
None => {}
Some(change) => {
@ -357,8 +352,8 @@ impl ClientGridBlockMetaEditor {
Ok(())
}
async fn apply_change(&self, change: GridBlockMetaChange) -> FlowyResult<()> {
let GridBlockMetaChange { delta, md5 } = change;
async fn apply_change(&self, change: GridBlockMetaDataChange) -> FlowyResult<()> {
let GridBlockMetaDataChange { delta, md5 } = change;
let user_id = self.user_id.clone();
let (base_rev_id, rev_id) = self.rev_manager.next_rev_id_pair();
let delta_data = delta.to_delta_bytes();
@ -392,10 +387,10 @@ impl RevisionCloudService for GridBlockMetaRevisionCloudService {
struct GridBlockMetaPadBuilder();
impl RevisionObjectBuilder for GridBlockMetaPadBuilder {
type Output = GridBlockMetaPad;
type Output = GridBlockMetaDataPad;
fn build_object(object_id: &str, revisions: Vec<Revision>) -> FlowyResult<Self::Output> {
let pad = GridBlockMetaPad::from_revisions(object_id, revisions)?;
let pad = GridBlockMetaDataPad::from_revisions(object_id, revisions)?;
Ok(pad)
}
}

View File

@ -6,14 +6,15 @@ use flowy_collaboration::entities::revision::Revision;
use flowy_collaboration::util::make_delta_from_revisions;
use flowy_error::{FlowyError, FlowyResult};
use flowy_grid_data_model::entities::{
Cell, CellMetaChangeset, Field, FieldChangeset, FieldMeta, Grid, GridBlock, GridBlockChangeset, RepeatedField,
RepeatedFieldOrder, RepeatedRow, RepeatedRowOrder, Row, RowMeta, RowMetaChangeset,
Cell, CellMetaChangeset, Field, FieldChangeset, FieldMeta, Grid, GridBlockMeta, GridBlockMetaChangeset,
RepeatedField, RepeatedFieldOrder, RepeatedGridBlock, RepeatedRowOrder, Row, RowMeta, RowMetaChangeset,
};
use std::collections::HashMap;
use crate::dart_notification::{send_dart_notification, GridNotification};
use crate::services::row::{
make_row_by_row_id, make_rows, row_meta_from_context, serialize_cell_data, RowMetaContext, RowMetaContextBuilder,
make_grid_block_from_block_metas, make_grid_blocks, make_row_ids_per_block, row_meta_from_context,
serialize_cell_data, GridBlockMetaDataSnapshot, RowMetaContext, RowMetaContextBuilder,
};
use flowy_sync::{RevisionCloudService, RevisionCompactor, RevisionManager, RevisionObjectBuilder};
use lib_infra::future::FutureResult;
@ -24,7 +25,7 @@ use tokio::sync::RwLock;
pub struct ClientGridEditor {
grid_id: String,
user: Arc<dyn GridUser>,
grid_meta_pad: Arc<RwLock<GridMetaPad>>,
pad: Arc<RwLock<GridMetaPad>>,
rev_manager: Arc<RevisionManager>,
block_meta_manager: Arc<GridBlockMetaEditorManager>,
}
@ -39,16 +40,15 @@ impl ClientGridEditor {
let cloud = Arc::new(GridRevisionCloudService { token });
let grid_pad = rev_manager.load::<GridPadBuilder>(Some(cloud)).await?;
let rev_manager = Arc::new(rev_manager);
let grid_meta_pad = Arc::new(RwLock::new(grid_pad));
let pad = Arc::new(RwLock::new(grid_pad));
let block_meta_manager = Arc::new(
GridBlockMetaEditorManager::new(grid_id, &user, grid_meta_pad.read().await.get_blocks().clone()).await?,
);
let block_meta_manager =
Arc::new(GridBlockMetaEditorManager::new(grid_id, &user, pad.read().await.get_blocks().clone()).await?);
Ok(Arc::new(Self {
grid_id: grid_id.to_owned(),
user,
grid_meta_pad,
pad,
rev_manager,
block_meta_manager,
}))
@ -61,7 +61,7 @@ impl ClientGridEditor {
}
pub async fn contain_field(&self, field_meta: &FieldMeta) -> bool {
self.grid_meta_pad.read().await.contain_field(&field_meta.id)
self.pad.read().await.contain_field(&field_meta.id)
}
pub async fn update_field(&self, change: FieldChangeset) -> FlowyResult<()> {
@ -74,19 +74,19 @@ impl ClientGridEditor {
Ok(())
}
pub async fn create_block(&self, grid_block: GridBlock) -> FlowyResult<()> {
pub async fn create_block(&self, grid_block: GridBlockMeta) -> FlowyResult<()> {
let _ = self.modify(|grid| Ok(grid.create_block(grid_block)?)).await?;
Ok(())
}
pub async fn update_block(&self, changeset: GridBlockChangeset) -> FlowyResult<()> {
pub async fn update_block(&self, changeset: GridBlockMetaChangeset) -> FlowyResult<()> {
let _ = self.modify(|grid| Ok(grid.update_block(changeset)?)).await?;
Ok(())
}
pub async fn create_row(&self, upper_row_id: Option<String>) -> FlowyResult<()> {
let field_metas = self.grid_meta_pad.read().await.get_field_metas(None)?;
let block_id = self.last_block_id().await?;
pub async fn create_row(&self, start_row_id: Option<String>) -> FlowyResult<()> {
let field_metas = self.pad.read().await.get_field_metas(None)?;
let block_id = self.block_id().await?;
// insert empty row below the row whose id is upper_row_id
let row_meta_ctx = RowMetaContextBuilder::new(&field_metas).build();
@ -95,18 +95,17 @@ impl ClientGridEditor {
// insert the row
let row_count = self
.block_meta_manager
.create_row(&field_metas, row_meta, upper_row_id)
.create_row(&block_id, row_meta, start_row_id)
.await?;
// update block row count
let changeset = GridBlockChangeset::from_row_count(&block_id, row_count);
let changeset = GridBlockMetaChangeset::from_row_count(&block_id, row_count);
let _ = self.update_block(changeset).await?;
Ok(())
}
pub async fn insert_rows(&self, contexts: Vec<RowMetaContext>) -> FlowyResult<()> {
let field_metas = self.grid_meta_pad.read().await.get_field_metas(None)?;
let block_id = self.last_block_id().await?;
let block_id = self.block_id().await?;
let mut rows_by_block_id: HashMap<String, Vec<RowMeta>> = HashMap::new();
for ctx in contexts {
let row_meta = row_meta_from_context(&block_id, ctx);
@ -115,10 +114,7 @@ impl ClientGridEditor {
.or_insert_with(Vec::new)
.push(row_meta);
}
let changesets = self
.block_meta_manager
.insert_row(&field_metas, rows_by_block_id)
.await?;
let changesets = self.block_meta_manager.insert_row(rows_by_block_id).await?;
for changeset in changesets {
let _ = self.update_block(changeset).await?;
}
@ -131,7 +127,7 @@ impl ClientGridEditor {
pub async fn update_cell(&self, changeset: CellMetaChangeset) -> FlowyResult<()> {
if let Some(cell_data) = changeset.data.as_ref() {
match self.grid_meta_pad.read().await.get_field(&changeset.field_id) {
match self.pad.read().await.get_field(&changeset.field_id) {
None => {
return Err(FlowyError::internal()
.context(format!("Can not find the field with id: {}", &changeset.field_id)));
@ -151,32 +147,39 @@ impl ClientGridEditor {
Ok(())
}
pub async fn get_rows(&self, row_orders: Option<RepeatedRowOrder>) -> FlowyResult<Vec<Row>> {
let row_metas = self.get_row_metas(row_orders.as_ref()).await?;
let field_meta = self.grid_meta_pad.read().await.get_field_metas(None)?;
match row_orders {
None => Ok(make_rows(&field_meta, row_metas)),
Some(row_orders) => {
let mut row_map: HashMap<String, Row> = make_row_by_row_id(&field_meta, row_metas);
let rows = row_orders
.iter()
.flat_map(|row_order| row_map.remove(&row_order.row_id))
.collect::<Vec<_>>();
Ok(rows)
pub async fn get_grid_blocks(
&self,
grid_block_metas: Option<Vec<GridBlockMeta>>,
) -> FlowyResult<RepeatedGridBlock> {
let grid_block_meta_snapshots = self.get_grid_block_meta_snapshots(grid_block_metas.as_ref()).await?;
let field_meta = self.pad.read().await.get_field_metas(None)?;
match grid_block_metas {
None => make_grid_blocks(&field_meta, grid_block_meta_snapshots),
Some(grid_block_metas) => {
make_grid_block_from_block_metas(&field_meta, grid_block_metas, grid_block_meta_snapshots)
}
}
}
pub async fn get_row_metas(&self, row_orders: Option<&RepeatedRowOrder>) -> FlowyResult<Vec<Arc<RowMeta>>> {
match row_orders {
pub(crate) async fn get_grid_block_meta_snapshots(
&self,
grid_block_infos: Option<&Vec<GridBlockMeta>>,
) -> FlowyResult<Vec<GridBlockMetaDataSnapshot>> {
match grid_block_infos {
None => {
let grid_blocks = self.grid_meta_pad.read().await.get_blocks();
let row_metas = self.block_meta_manager.get_all_rows(grid_blocks).await?;
Ok(row_metas)
let grid_blocks = self.pad.read().await.get_blocks();
let row_metas_per_block = self
.block_meta_manager
.get_block_meta_snapshot_from_blocks(grid_blocks)
.await?;
Ok(row_metas_per_block)
}
Some(row_orders) => {
let row_metas = self.block_meta_manager.get_rows(row_orders).await?;
Ok(row_metas)
Some(grid_block_infos) => {
let row_metas_per_block = self
.block_meta_manager
.get_block_meta_snapshot_from_row_orders(grid_block_infos)
.await?;
Ok(row_metas_per_block)
}
}
}
@ -190,35 +193,34 @@ impl ClientGridEditor {
}
pub async fn grid_data(&self) -> FlowyResult<Grid> {
let field_orders = self.grid_meta_pad.read().await.get_field_orders();
let grid_blocks = self.grid_meta_pad.read().await.get_blocks();
let row_orders = self.block_meta_manager.get_row_orders(grid_blocks).await?;
let field_orders = self.pad.read().await.get_field_orders();
let block_orders = self.pad.read().await.get_blocks();
Ok(Grid {
id: self.grid_id.clone(),
field_orders,
row_orders,
blocks: block_orders,
})
}
pub async fn get_field_metas(&self, field_orders: Option<RepeatedFieldOrder>) -> FlowyResult<Vec<FieldMeta>> {
let field_meta = self.grid_meta_pad.read().await.get_field_metas(field_orders)?;
let field_meta = self.pad.read().await.get_field_metas(field_orders)?;
Ok(field_meta)
}
pub async fn get_blocks(&self) -> FlowyResult<Vec<GridBlock>> {
let grid_blocks = self.grid_meta_pad.read().await.get_blocks();
pub async fn get_blocks(&self) -> FlowyResult<Vec<GridBlockMeta>> {
let grid_blocks = self.pad.read().await.get_blocks();
Ok(grid_blocks)
}
pub async fn delta_bytes(&self) -> Bytes {
self.grid_meta_pad.read().await.delta_bytes()
self.pad.read().await.delta_bytes()
}
async fn modify<F>(&self, f: F) -> FlowyResult<()>
where
F: for<'a> FnOnce(&'a mut GridMetaPad) -> FlowyResult<Option<GridChangeset>>,
{
let mut write_guard = self.grid_meta_pad.write().await;
let mut write_guard = self.pad.write().await;
match f(&mut *write_guard)? {
None => {}
Some(change) => {
@ -248,10 +250,10 @@ impl ClientGridEditor {
Ok(())
}
async fn last_block_id(&self) -> FlowyResult<String> {
match self.grid_meta_pad.read().await.get_blocks().last() {
async fn block_id(&self) -> FlowyResult<String> {
match self.pad.read().await.get_blocks().last() {
None => Err(FlowyError::internal().context("There is no grid block in this grid")),
Some(grid_block) => Ok(grid_block.id.clone()),
Some(grid_block) => Ok(grid_block.block_id.clone()),
}
}

View File

@ -1,5 +1,8 @@
use crate::services::row::deserialize_cell_data;
use flowy_grid_data_model::entities::{Cell, CellMeta, FieldMeta, Row, RowMeta, RowOrder};
use flowy_error::FlowyResult;
use flowy_grid_data_model::entities::{
Cell, CellMeta, FieldMeta, GridBlock, GridBlockMeta, RepeatedGridBlock, RepeatedRowOrder, Row, RowMeta, RowOrder,
};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use std::collections::HashMap;
use std::ops::Deref;
@ -10,41 +13,48 @@ pub(crate) struct RowIdsPerBlock {
pub(crate) row_ids: Vec<String>,
}
pub(crate) fn make_row_ids_per_block(row_orders: &[RowOrder]) -> Vec<RowIdsPerBlock> {
let mut map: HashMap<String, RowIdsPerBlock> = HashMap::new();
row_orders.iter().for_each(|row_order| {
let block_id = row_order.block_id.clone();
let entry = map.entry(block_id.clone()).or_insert(RowIdsPerBlock {
block_id,
impl RowIdsPerBlock {
pub fn new(block_id: &str) -> Self {
RowIdsPerBlock {
block_id: block_id.to_owned(),
row_ids: vec![],
});
entry.row_ids.push(row_order.row_id.clone());
}
}
}
pub(crate) struct GridBlockMetaDataSnapshot {
pub(crate) block_id: String,
pub(crate) row_metas: Vec<Arc<RowMeta>>,
}
pub(crate) fn make_row_ids_per_block(row_orders: &[RowOrder]) -> Vec<RowIdsPerBlock> {
let mut map: HashMap<&String, RowIdsPerBlock> = HashMap::new();
row_orders.iter().for_each(|row_order| {
let block_id = &row_order.block_id;
let row_id = row_order.row_id.clone();
map.entry(&block_id)
.or_insert_with(|| RowIdsPerBlock::new(&block_id))
.row_ids
.push(row_id);
});
map.into_values().collect::<Vec<_>>()
}
pub(crate) fn make_rows(fields: &[FieldMeta], row_metas: Vec<Arc<RowMeta>>) -> Vec<Row> {
let field_map = fields
.iter()
.map(|field| (&field.id, field))
.collect::<HashMap<&String, &FieldMeta>>();
let make_row = |row_meta: Arc<RowMeta>| {
let cell_by_field_id = row_meta
.cell_by_field_id
.clone()
.into_par_iter()
.flat_map(|(field_id, raw_cell)| make_cell(&field_map, field_id, raw_cell))
.collect::<HashMap<String, Cell>>();
Row {
id: row_meta.id.clone(),
cell_by_field_id,
height: row_meta.height,
}
};
row_metas.into_iter().map(make_row).collect::<Vec<Row>>()
pub(crate) fn make_grid_blocks(
field_metas: &[FieldMeta],
grid_block_meta_snapshots: Vec<GridBlockMetaDataSnapshot>,
) -> FlowyResult<RepeatedGridBlock> {
Ok(grid_block_meta_snapshots
.into_iter()
.map(|row_metas_per_block| {
let rows = make_rows_from_row_metas(field_metas, &row_metas_per_block.row_metas);
GridBlock {
block_id: row_metas_per_block.block_id,
rows,
}
})
.collect::<Vec<GridBlock>>()
.into())
}
#[inline(always)]
@ -66,13 +76,13 @@ pub fn make_cell(
}
}
pub(crate) fn make_row_by_row_id(fields: &[FieldMeta], row_metas: Vec<Arc<RowMeta>>) -> HashMap<String, Row> {
pub(crate) fn make_rows_from_row_metas(fields: &[FieldMeta], row_metas: &Vec<Arc<RowMeta>>) -> Vec<Row> {
let field_meta_map = fields
.iter()
.map(|field_meta| (&field_meta.id, field_meta))
.collect::<HashMap<&String, &FieldMeta>>();
let make_row = |row_meta: Arc<RowMeta>| {
let make_row = |row_meta: &Arc<RowMeta>| {
let cell_by_field_id = row_meta
.cell_by_field_id
.clone()
@ -80,16 +90,36 @@ pub(crate) fn make_row_by_row_id(fields: &[FieldMeta], row_metas: Vec<Arc<RowMet
.flat_map(|(field_id, raw_cell)| make_cell(&field_meta_map, field_id, raw_cell))
.collect::<HashMap<String, Cell>>();
let row = Row {
Row {
id: row_meta.id.clone(),
cell_by_field_id,
height: row_meta.height,
};
(row.id.clone(), row)
}
};
row_metas
.into_par_iter()
.map(make_row)
.collect::<HashMap<String, Row>>()
row_metas.into_iter().map(make_row).collect::<Vec<_>>()
}
pub(crate) fn make_grid_block_from_block_metas(
field_metas: &[FieldMeta],
grid_block_metas: Vec<GridBlockMeta>,
grid_block_meta_snapshots: Vec<GridBlockMetaDataSnapshot>,
) -> FlowyResult<RepeatedGridBlock> {
let block_meta_snapshot_map: HashMap<&String, &Vec<Arc<RowMeta>>> = grid_block_meta_snapshots
.iter()
.map(|snapshot| (&snapshot.block_id, &snapshot.row_metas))
.collect();
let mut grid_blocks = vec![];
for grid_block_meta in grid_block_metas {
match block_meta_snapshot_map.get(&grid_block_meta.block_id) {
None => {}
Some(row_metas) => {
let rows = make_rows_from_row_metas(&field_metas, row_metas);
grid_blocks.push(GridBlock::new(&grid_block_meta.block_id, rows));
}
}
}
Ok(grid_blocks.into())
}

View File

@ -4,7 +4,7 @@ use chrono::NaiveDateTime;
use flowy_grid::services::cell::*;
use flowy_grid::services::row::{deserialize_cell_data, serialize_cell_data, CellDataSerde, RowMetaContextBuilder};
use flowy_grid_data_model::entities::{
CellMetaChangeset, FieldChangeset, FieldType, GridBlock, GridBlockChangeset, RowMetaChangeset,
CellMetaChangeset, FieldChangeset, FieldType, GridBlockMeta, GridBlockMetaChangeset, RowMetaChangeset,
};
#[tokio::test]
@ -135,7 +135,7 @@ async fn grid_delete_field() {
#[tokio::test]
async fn grid_create_block() {
let grid_block = GridBlock::new();
let grid_block = GridBlockMeta::new();
let scripts = vec![
AssertBlockCount(1),
CreateBlock { block: grid_block },
@ -146,10 +146,10 @@ async fn grid_create_block() {
#[tokio::test]
async fn grid_update_block() {
let grid_block = GridBlock::new();
let grid_block = GridBlockMeta::new();
let mut cloned_grid_block = grid_block.clone();
let changeset = GridBlockChangeset {
block_id: grid_block.id.clone(),
let changeset = GridBlockMetaChangeset {
block_id: grid_block.block_id.clone(),
start_row_index: Some(2),
row_count: Some(10),
};
@ -377,7 +377,7 @@ async fn grid_cell_update() {
assert_eq!(row_metas.len(), 3);
assert_eq!(grid_blocks.len(), 1);
let block_id = &grid_blocks.first().unwrap().id;
let block_id = &grid_blocks.first().unwrap().block_id;
let mut scripts = vec![];
for (index, row_meta) in row_metas.iter().enumerate() {
for field_meta in field_metas {

View File

@ -6,8 +6,8 @@ use flowy_grid::services::field::*;
use flowy_grid::services::grid_editor::{ClientGridEditor, GridPadBuilder};
use flowy_grid::services::row::RowMetaContext;
use flowy_grid_data_model::entities::{
BuildGridContext, CellMetaChangeset, FieldChangeset, FieldMeta, FieldType, GridBlock, GridBlockChangeset, RowMeta,
RowMetaChangeset,
BuildGridContext, CellMetaChangeset, FieldChangeset, FieldMeta, FieldType, GridBlockMeta, GridBlockMetaChangeset,
RowMeta, RowMetaChangeset,
};
use flowy_sync::REVISION_WRITE_INTERVAL_IN_MILLIS;
use flowy_test::helper::ViewTest;
@ -33,10 +33,10 @@ pub enum EditorScript {
field_meta: FieldMeta,
},
CreateBlock {
block: GridBlock,
block: GridBlockMeta,
},
UpdateBlock {
changeset: GridBlockChangeset,
changeset: GridBlockMetaChangeset,
},
AssertBlockCount(usize),
AssertBlock {
@ -46,7 +46,7 @@ pub enum EditorScript {
},
AssertBlockEqual {
block_index: usize,
block: GridBlock,
block: GridBlockMeta,
},
CreateEmptyRow,
CreateRow {
@ -75,7 +75,7 @@ pub struct GridEditorTest {
pub grid_id: String,
pub editor: Arc<ClientGridEditor>,
pub field_metas: Vec<FieldMeta>,
pub grid_blocks: Vec<GridBlock>,
pub grid_blocks: Vec<GridBlockMeta>,
pub row_metas: Vec<Arc<RowMeta>>,
pub field_count: usize,
}
@ -90,7 +90,7 @@ impl GridEditorTest {
let editor = sdk.grid_manager.open_grid(&test.view.id).await.unwrap();
let field_metas = editor.get_field_metas(None).await.unwrap();
let grid_blocks = editor.get_blocks().await.unwrap();
let row_metas = editor.get_row_metas(None).await.unwrap();
let row_metas = editor.get_grid_block_meta_snapshots(None).await.unwrap();
let grid_id = test.view.id;
Self {
@ -173,18 +173,18 @@ impl GridEditorTest {
}
EditorScript::CreateEmptyRow => {
self.editor.create_row(None).await.unwrap();
self.row_metas = self.editor.get_row_metas(None).await.unwrap();
self.row_metas = self.editor.get_grid_block_meta_snapshots(None).await.unwrap();
self.grid_blocks = self.editor.get_blocks().await.unwrap();
}
EditorScript::CreateRow { context } => {
self.editor.insert_rows(vec![context]).await.unwrap();
self.row_metas = self.editor.get_row_metas(None).await.unwrap();
self.row_metas = self.editor.get_grid_block_meta_snapshots(None).await.unwrap();
self.grid_blocks = self.editor.get_blocks().await.unwrap();
}
EditorScript::UpdateRow { changeset: change } => self.editor.update_row(change).await.unwrap(),
EditorScript::DeleteRow { row_ids } => {
self.editor.delete_rows(row_ids).await.unwrap();
self.row_metas = self.editor.get_row_metas(None).await.unwrap();
self.row_metas = self.editor.get_grid_block_meta_snapshots(None).await.unwrap();
self.grid_blocks = self.editor.get_blocks().await.unwrap();
}
EditorScript::AssertRow { changeset } => {
@ -204,11 +204,11 @@ impl GridEditorTest {
assert!(result.is_err())
} else {
let _ = result.unwrap();
self.row_metas = self.editor.get_row_metas(None).await.unwrap();
self.row_metas = self.editor.get_grid_block_meta_snapshots(None).await.unwrap();
}
}
EditorScript::AssertRowCount(count) => {
assert_eq!(self.editor.get_rows(None).await.unwrap().len(), count);
assert_eq!(self.editor.get_grid_blocks(None).await.unwrap().len(), count);
}
EditorScript::AssertGridMetaPad => {
sleep(Duration::from_millis(2 * REVISION_WRITE_INTERVAL_IN_MILLIS)).await;

View File

@ -1,7 +1,7 @@
use crate::entities::revision::{md5, RepeatedRevision, Revision};
use crate::errors::{CollaborateError, CollaborateResult};
use crate::util::{cal_diff, make_delta_from_revisions};
use flowy_grid_data_model::entities::{GridBlockMeta, RowMeta, RowMetaChangeset};
use flowy_grid_data_model::entities::{GridBlockMetaData, RowMeta, RowMetaChangeset};
use lib_infra::uuid;
use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder};
use serde::{Deserialize, Serialize};
@ -12,7 +12,7 @@ pub type GridBlockMetaDelta = PlainTextDelta;
pub type GridBlockMetaDeltaBuilder = PlainTextDeltaBuilder;
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct GridBlockMetaPad {
pub struct GridBlockMetaDataPad {
block_id: String,
rows: Vec<Arc<RowMeta>>,
@ -20,14 +20,18 @@ pub struct GridBlockMetaPad {
pub(crate) delta: GridBlockMetaDelta,
}
impl GridBlockMetaPad {
impl GridBlockMetaDataPad {
pub fn from_delta(delta: GridBlockMetaDelta) -> CollaborateResult<Self> {
let s = delta.to_str()?;
let block_meta: GridBlockMeta = serde_json::from_str(&s).map_err(|e| {
let block_meta: GridBlockMetaData = serde_json::from_str(&s).map_err(|e| {
CollaborateError::internal().context(format!("Deserialize delta to block meta failed: {}", e))
})?;
let block_id = block_meta.block_id;
let rows = block_meta.rows.into_iter().map(Arc::new).collect::<Vec<Arc<RowMeta>>>();
let rows = block_meta
.row_metas
.into_iter()
.map(Arc::new)
.collect::<Vec<Arc<RowMeta>>>();
Ok(Self { block_id, rows, delta })
}
@ -39,10 +43,10 @@ impl GridBlockMetaPad {
pub fn add_row(
&mut self,
row: RowMeta,
upper_row_id: Option<String>,
) -> CollaborateResult<Option<GridBlockMetaChange>> {
start_row_id: Option<String>,
) -> CollaborateResult<Option<GridBlockMetaDataChange>> {
self.modify(|rows| {
if let Some(upper_row_id) = upper_row_id {
if let Some(upper_row_id) = start_row_id {
if upper_row_id.is_empty() {
rows.insert(0, Arc::new(row));
return Ok(Some(()));
@ -59,7 +63,7 @@ impl GridBlockMetaPad {
})
}
pub fn delete_rows(&mut self, row_ids: &[String]) -> CollaborateResult<Option<GridBlockMetaChange>> {
pub fn delete_rows(&mut self, row_ids: &[String]) -> CollaborateResult<Option<GridBlockMetaDataChange>> {
self.modify(|rows| {
rows.retain(|row| !row_ids.contains(&row.id));
Ok(Some(()))
@ -94,7 +98,7 @@ impl GridBlockMetaPad {
self.rows.len() as i32
}
pub fn update_row(&mut self, changeset: RowMetaChangeset) -> CollaborateResult<Option<GridBlockMetaChange>> {
pub fn update_row(&mut self, changeset: RowMetaChangeset) -> CollaborateResult<Option<GridBlockMetaDataChange>> {
let row_id = changeset.row_id.clone();
self.modify_row(&row_id, |row| {
let mut is_changed = None;
@ -119,7 +123,7 @@ impl GridBlockMetaPad {
})
}
pub fn modify<F>(&mut self, f: F) -> CollaborateResult<Option<GridBlockMetaChange>>
pub fn modify<F>(&mut self, f: F) -> CollaborateResult<Option<GridBlockMetaDataChange>>
where
F: for<'a> FnOnce(&'a mut Vec<Arc<RowMeta>>) -> CollaborateResult<Option<()>>,
{
@ -133,14 +137,14 @@ impl GridBlockMetaPad {
None => Ok(None),
Some(delta) => {
self.delta = self.delta.compose(&delta)?;
Ok(Some(GridBlockMetaChange { delta, md5: self.md5() }))
Ok(Some(GridBlockMetaDataChange { delta, md5: self.md5() }))
}
}
}
}
}
fn modify_row<F>(&mut self, row_id: &str, f: F) -> CollaborateResult<Option<GridBlockMetaChange>>
fn modify_row<F>(&mut self, row_id: &str, f: F) -> CollaborateResult<Option<GridBlockMetaDataChange>>
where
F: FnOnce(&mut RowMeta) -> CollaborateResult<Option<()>>,
{
@ -168,35 +172,35 @@ impl GridBlockMetaPad {
}
}
pub struct GridBlockMetaChange {
pub struct GridBlockMetaDataChange {
pub delta: GridBlockMetaDelta,
/// md5: the md5 of the grid after applying the change.
pub md5: String,
}
pub fn make_block_meta_delta(block_meta: &GridBlockMeta) -> GridBlockMetaDelta {
let json = serde_json::to_string(&block_meta).unwrap();
pub fn make_block_meta_delta(grid_block_meta_data: &GridBlockMetaData) -> GridBlockMetaDelta {
let json = serde_json::to_string(&grid_block_meta_data).unwrap();
PlainTextDeltaBuilder::new().insert(&json).build()
}
pub fn make_block_meta_revisions(user_id: &str, block_meta: &GridBlockMeta) -> RepeatedRevision {
let delta = make_block_meta_delta(block_meta);
pub fn make_block_meta_revisions(user_id: &str, grid_block_meta_data: &GridBlockMetaData) -> RepeatedRevision {
let delta = make_block_meta_delta(grid_block_meta_data);
let bytes = delta.to_delta_bytes();
let revision = Revision::initial_revision(user_id, &block_meta.block_id, bytes);
let revision = Revision::initial_revision(user_id, &grid_block_meta_data.block_id, bytes);
revision.into()
}
impl std::default::Default for GridBlockMetaPad {
impl std::default::Default for GridBlockMetaDataPad {
fn default() -> Self {
let block_meta = GridBlockMeta {
let block_meta_data = GridBlockMetaData {
block_id: uuid(),
rows: vec![],
row_metas: vec![],
};
let delta = make_block_meta_delta(&block_meta);
GridBlockMetaPad {
block_id: block_meta.block_id,
rows: block_meta.rows.into_iter().map(Arc::new).collect::<Vec<_>>(),
let delta = make_block_meta_delta(&block_meta_data);
GridBlockMetaDataPad {
block_id: block_meta_data.block_id,
rows: block_meta_data.row_metas.into_iter().map(Arc::new).collect::<Vec<_>>(),
delta,
}
}
@ -204,7 +208,7 @@ impl std::default::Default for GridBlockMetaPad {
#[cfg(test)]
mod tests {
use crate::client_grid::{GridBlockMetaDelta, GridBlockMetaPad};
use crate::client_grid::{GridBlockMetaDataPad, GridBlockMetaDelta};
use flowy_grid_data_model::entities::{RowMeta, RowMetaChangeset};
#[test]
@ -255,7 +259,7 @@ mod tests {
assert_eq!(*pad.rows[2], row_2);
}
fn test_row_meta(id: &str, pad: &GridBlockMetaPad) -> RowMeta {
fn test_row_meta(id: &str, pad: &GridBlockMetaDataPad) -> RowMeta {
RowMeta {
id: id.to_string(),
block_id: pad.block_id.clone(),
@ -351,8 +355,8 @@ mod tests {
);
}
fn test_pad() -> GridBlockMetaPad {
fn test_pad() -> GridBlockMetaDataPad {
let delta = GridBlockMetaDelta::from_delta_str(r#"[{"insert":"{\"block_id\":\"1\",\"rows\":[]}"}]"#).unwrap();
GridBlockMetaPad::from_delta(delta).unwrap()
GridBlockMetaDataPad::from_delta(delta).unwrap()
}
}

View File

@ -13,8 +13,8 @@ impl GridBuilder {
}
pub fn add_empty_row(mut self) -> Self {
let row = RowMeta::new(&self.build_context.grid_block.id);
self.build_context.grid_block_meta.rows.push(row);
let row = RowMeta::new(&self.build_context.grid_block.block_id);
self.build_context.grid_block_meta_data.row_metas.push(row);
self.build_context.grid_block.row_count += 1;
self
}
@ -41,7 +41,7 @@ fn check_rows(fields: &[FieldMeta], rows: &[RowMeta]) -> CollaborateResult<()> {
mod tests {
use crate::client_grid::{make_block_meta_delta, make_grid_delta, GridBuilder};
use flowy_grid_data_model::entities::{FieldMeta, FieldType, GridBlockMeta, GridMeta};
use flowy_grid_data_model::entities::{FieldMeta, FieldType, GridBlockMetaData, GridMeta};
#[test]
fn create_default_grid_test() {
@ -63,7 +63,7 @@ mod tests {
let grid_meta_delta = make_grid_delta(&grid_meta);
let _: GridMeta = serde_json::from_str(&grid_meta_delta.to_str().unwrap()).unwrap();
let grid_block_meta_delta = make_block_meta_delta(&build_context.grid_block_meta);
let _: GridBlockMeta = serde_json::from_str(&grid_block_meta_delta.to_str().unwrap()).unwrap();
let grid_block_meta_delta = make_block_meta_delta(&build_context.grid_block_meta_data);
let _: GridBlockMetaData = serde_json::from_str(&grid_block_meta_delta.to_str().unwrap()).unwrap();
}
}

View File

@ -3,7 +3,7 @@ use crate::errors::{internal_error, CollaborateError, CollaborateResult};
use crate::util::{cal_diff, make_delta_from_revisions};
use bytes::Bytes;
use flowy_grid_data_model::entities::{
FieldChangeset, FieldMeta, FieldOrder, GridBlock, GridBlockChangeset, GridMeta, RepeatedFieldOrder,
FieldChangeset, FieldMeta, FieldOrder, GridBlockMeta, GridBlockMetaChangeset, GridMeta, RepeatedFieldOrder,
};
use lib_infra::uuid;
use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta, PlainTextDeltaBuilder};
@ -138,9 +138,9 @@ impl GridMetaPad {
})
}
pub fn create_block(&mut self, block: GridBlock) -> CollaborateResult<Option<GridChangeset>> {
pub fn create_block(&mut self, block: GridBlockMeta) -> CollaborateResult<Option<GridChangeset>> {
self.modify_grid(|grid| {
if grid.blocks.iter().any(|b| b.id == block.id) {
if grid.blocks.iter().any(|b| b.block_id == block.block_id) {
tracing::warn!("Duplicate grid block");
Ok(None)
} else {
@ -161,11 +161,11 @@ impl GridMetaPad {
})
}
pub fn get_blocks(&self) -> Vec<GridBlock> {
pub fn get_blocks(&self) -> Vec<GridBlockMeta> {
self.grid_meta.blocks.clone()
}
pub fn update_block(&mut self, changeset: GridBlockChangeset) -> CollaborateResult<Option<GridChangeset>> {
pub fn update_block(&mut self, changeset: GridBlockMetaChangeset) -> CollaborateResult<Option<GridChangeset>> {
let block_id = changeset.block_id.clone();
self.modify_block(&block_id, |block| {
let mut is_changed = None;
@ -223,15 +223,17 @@ impl GridMetaPad {
pub fn modify_block<F>(&mut self, block_id: &str, f: F) -> CollaborateResult<Option<GridChangeset>>
where
F: FnOnce(&mut GridBlock) -> CollaborateResult<Option<()>>,
F: FnOnce(&mut GridBlockMeta) -> CollaborateResult<Option<()>>,
{
self.modify_grid(|grid| match grid.blocks.iter().position(|block| block.id == block_id) {
None => {
tracing::warn!("[GridMetaPad]: Can't find any block with id: {}", block_id);
Ok(None)
}
Some(index) => f(&mut grid.blocks[index]),
})
self.modify_grid(
|grid| match grid.blocks.iter().position(|block| block.block_id == block_id) {
None => {
tracing::warn!("[GridMetaPad]: Can't find any block with id: {}", block_id);
Ok(None)
}
Some(index) => f(&mut grid.blocks[index]),
},
)
}
pub fn modify_field<F>(&mut self, field_id: &str, f: F) -> CollaborateResult<Option<GridChangeset>>

View File

@ -1,7 +1,7 @@
mod block_pad;
mod grid_block_meta_data_pad;
mod grid_builder;
mod grid_meta_pad;
pub use block_pad::*;
pub use grid_block_meta_data_pad::*;
pub use grid_builder::*;
pub use grid_meta_pad::*;

View File

@ -1,6 +1,7 @@
use crate::entities::{FieldMeta, FieldType, RowMeta};
use crate::entities::{FieldMeta, FieldType, GridBlockMeta, RowMeta};
use flowy_derive::ProtoBuf;
use std::collections::HashMap;
use std::hash::Hash;
use std::sync::Arc;
#[derive(Debug, Clone, Default, ProtoBuf)]
@ -12,7 +13,7 @@ pub struct Grid {
pub field_orders: Vec<FieldOrder>,
#[pb(index = 3)]
pub row_orders: Vec<RowOrder>,
pub blocks: Vec<GridBlockMeta>,
}
#[derive(Debug, Clone, Default, ProtoBuf)]
@ -150,6 +151,12 @@ impl std::ops::DerefMut for RepeatedRowOrder {
}
}
impl std::convert::From<Vec<RowOrder>> for RepeatedRowOrder {
fn from(items: Vec<RowOrder>) -> Self {
Self { items }
}
}
#[derive(Debug, Default, ProtoBuf)]
pub struct Row {
#[pb(index = 1)]
@ -163,29 +170,35 @@ pub struct Row {
}
#[derive(Debug, Default, ProtoBuf)]
pub struct RepeatedRow {
pub struct RepeatedGridBlock {
#[pb(index = 1)]
pub items: Vec<Row>,
pub items: Vec<GridBlock>,
}
impl std::ops::Deref for RepeatedRow {
type Target = Vec<Row>;
fn deref(&self) -> &Self::Target {
&self.items
}
}
impl std::ops::DerefMut for RepeatedRow {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.items
}
}
impl std::convert::From<Vec<Row>> for RepeatedRow {
fn from(items: Vec<Row>) -> Self {
impl std::convert::From<Vec<GridBlock>> for RepeatedGridBlock {
fn from(items: Vec<GridBlock>) -> Self {
Self { items }
}
}
#[derive(Debug, Default, ProtoBuf)]
pub struct GridBlock {
#[pb(index = 1)]
pub block_id: String,
#[pb(index = 2)]
pub rows: Vec<Row>,
}
impl GridBlock {
pub fn new(block_id: &str, rows: Vec<Row>) -> Self {
Self {
block_id: block_id.to_owned(),
rows,
}
}
}
#[derive(Debug, Default, ProtoBuf)]
pub struct Cell {
#[pb(index = 1)]
@ -247,6 +260,18 @@ impl AsRef<str> for GridId {
}
}
#[derive(Clone, ProtoBuf, Default, Debug)]
pub struct GridBlockId {
#[pb(index = 1)]
pub value: String,
}
impl AsRef<str> for GridBlockId {
fn as_ref(&self) -> &str {
&self.value
}
}
#[derive(ProtoBuf, Default)]
pub struct CreateRowPayload {
#[pb(index = 1)]
@ -266,10 +291,10 @@ pub struct QueryFieldPayload {
}
#[derive(ProtoBuf, Default)]
pub struct QueryRowPayload {
pub struct QueryGridBlocksPayload {
#[pb(index = 1)]
pub grid_id: String,
#[pb(index = 2)]
pub row_orders: RepeatedRowOrder,
pub blocks: Vec<GridBlockMeta>,
}

View File

@ -16,13 +16,13 @@ pub struct GridMeta {
pub fields: Vec<FieldMeta>,
#[pb(index = 3)]
pub blocks: Vec<GridBlock>,
pub blocks: Vec<GridBlockMeta>,
}
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, ProtoBuf)]
pub struct GridBlock {
pub struct GridBlockMeta {
#[pb(index = 1)]
pub id: String,
pub block_id: String,
#[pb(index = 2)]
pub start_row_index: i32,
@ -31,7 +31,7 @@ pub struct GridBlock {
pub row_count: i32,
}
impl GridBlock {
impl GridBlockMeta {
pub fn len(&self) -> i32 {
self.start_row_index + self.row_count
}
@ -41,22 +41,22 @@ impl GridBlock {
}
}
impl GridBlock {
impl GridBlockMeta {
pub fn new() -> Self {
GridBlock {
id: uuid::Uuid::new_v4().to_string(),
GridBlockMeta {
block_id: uuid::Uuid::new_v4().to_string(),
..Default::default()
}
}
}
pub struct GridBlockChangeset {
pub struct GridBlockMetaChangeset {
pub block_id: String,
pub start_row_index: Option<i32>,
pub row_count: Option<i32>,
}
impl GridBlockChangeset {
impl GridBlockMetaChangeset {
pub fn from_row_count(block_id: &str, row_count: i32) -> Self {
Self {
block_id: block_id.to_string(),
@ -67,12 +67,12 @@ impl GridBlockChangeset {
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, ProtoBuf)]
pub struct GridBlockMeta {
pub struct GridBlockMetaData {
#[pb(index = 1)]
pub block_id: String,
#[pb(index = 2)]
pub rows: Vec<RowMeta>,
pub row_metas: Vec<RowMeta>,
}
#[derive(Debug, Clone, Default, Serialize, Deserialize, ProtoBuf, PartialEq, Eq)]
@ -329,24 +329,24 @@ pub struct BuildGridContext {
pub field_metas: Vec<FieldMeta>,
#[pb(index = 2)]
pub grid_block: GridBlock,
pub grid_block: GridBlockMeta,
#[pb(index = 3)]
pub grid_block_meta: GridBlockMeta,
pub grid_block_meta_data: GridBlockMetaData,
}
impl std::default::Default for BuildGridContext {
fn default() -> Self {
let grid_block = GridBlock::new();
let grid_block_meta = GridBlockMeta {
block_id: grid_block.id.clone(),
rows: vec![],
let grid_block = GridBlockMeta::new();
let grid_block_meta_data = GridBlockMetaData {
block_id: grid_block.block_id.clone(),
row_metas: vec![],
};
Self {
field_metas: vec![],
grid_block,
grid_block_meta,
grid_block_meta_data,
}
}
}

View File

@ -28,7 +28,7 @@ pub struct Grid {
// message fields
pub id: ::std::string::String,
pub field_orders: ::protobuf::RepeatedField<FieldOrder>,
pub row_orders: ::protobuf::RepeatedField<RowOrder>,
pub blocks: ::protobuf::RepeatedField<super::meta::GridBlockMeta>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -96,29 +96,29 @@ impl Grid {
::std::mem::replace(&mut self.field_orders, ::protobuf::RepeatedField::new())
}
// repeated .RowOrder row_orders = 3;
// repeated .GridBlockMeta blocks = 3;
pub fn get_row_orders(&self) -> &[RowOrder] {
&self.row_orders
pub fn get_blocks(&self) -> &[super::meta::GridBlockMeta] {
&self.blocks
}
pub fn clear_row_orders(&mut self) {
self.row_orders.clear();
pub fn clear_blocks(&mut self) {
self.blocks.clear();
}
// Param is passed by value, moved
pub fn set_row_orders(&mut self, v: ::protobuf::RepeatedField<RowOrder>) {
self.row_orders = v;
pub fn set_blocks(&mut self, v: ::protobuf::RepeatedField<super::meta::GridBlockMeta>) {
self.blocks = v;
}
// Mutable pointer to the field.
pub fn mut_row_orders(&mut self) -> &mut ::protobuf::RepeatedField<RowOrder> {
&mut self.row_orders
pub fn mut_blocks(&mut self) -> &mut ::protobuf::RepeatedField<super::meta::GridBlockMeta> {
&mut self.blocks
}
// Take field
pub fn take_row_orders(&mut self) -> ::protobuf::RepeatedField<RowOrder> {
::std::mem::replace(&mut self.row_orders, ::protobuf::RepeatedField::new())
pub fn take_blocks(&mut self) -> ::protobuf::RepeatedField<super::meta::GridBlockMeta> {
::std::mem::replace(&mut self.blocks, ::protobuf::RepeatedField::new())
}
}
@ -129,7 +129,7 @@ impl ::protobuf::Message for Grid {
return false;
}
};
for v in &self.row_orders {
for v in &self.blocks {
if !v.is_initialized() {
return false;
}
@ -148,7 +148,7 @@ impl ::protobuf::Message for Grid {
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.field_orders)?;
},
3 => {
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.row_orders)?;
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.blocks)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -169,7 +169,7 @@ impl ::protobuf::Message for Grid {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
};
for value in &self.row_orders {
for value in &self.blocks {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
};
@ -187,7 +187,7 @@ impl ::protobuf::Message for Grid {
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
};
for v in &self.row_orders {
for v in &self.blocks {
os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
@ -240,10 +240,10 @@ impl ::protobuf::Message for Grid {
|m: &Grid| { &m.field_orders },
|m: &mut Grid| { &mut m.field_orders },
));
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<RowOrder>>(
"row_orders",
|m: &Grid| { &m.row_orders },
|m: &mut Grid| { &mut m.row_orders },
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::meta::GridBlockMeta>>(
"blocks",
|m: &Grid| { &m.blocks },
|m: &mut Grid| { &mut m.blocks },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<Grid>(
"Grid",
@ -263,7 +263,7 @@ impl ::protobuf::Clear for Grid {
fn clear(&mut self) {
self.id.clear();
self.field_orders.clear();
self.row_orders.clear();
self.blocks.clear();
self.unknown_fields.clear();
}
}
@ -1749,29 +1749,29 @@ impl ::protobuf::reflect::ProtobufValue for Row {
}
#[derive(PartialEq,Clone,Default)]
pub struct RepeatedRow {
pub struct RepeatedGridBlock {
// message fields
pub items: ::protobuf::RepeatedField<Row>,
pub items: ::protobuf::RepeatedField<GridBlock>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a RepeatedRow {
fn default() -> &'a RepeatedRow {
<RepeatedRow as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a RepeatedGridBlock {
fn default() -> &'a RepeatedGridBlock {
<RepeatedGridBlock as ::protobuf::Message>::default_instance()
}
}
impl RepeatedRow {
pub fn new() -> RepeatedRow {
impl RepeatedGridBlock {
pub fn new() -> RepeatedGridBlock {
::std::default::Default::default()
}
// repeated .Row items = 1;
// repeated .GridBlock items = 1;
pub fn get_items(&self) -> &[Row] {
pub fn get_items(&self) -> &[GridBlock] {
&self.items
}
pub fn clear_items(&mut self) {
@ -1779,22 +1779,22 @@ impl RepeatedRow {
}
// Param is passed by value, moved
pub fn set_items(&mut self, v: ::protobuf::RepeatedField<Row>) {
pub fn set_items(&mut self, v: ::protobuf::RepeatedField<GridBlock>) {
self.items = v;
}
// Mutable pointer to the field.
pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<Row> {
pub fn mut_items(&mut self) -> &mut ::protobuf::RepeatedField<GridBlock> {
&mut self.items
}
// Take field
pub fn take_items(&mut self) -> ::protobuf::RepeatedField<Row> {
pub fn take_items(&mut self) -> ::protobuf::RepeatedField<GridBlock> {
::std::mem::replace(&mut self.items, ::protobuf::RepeatedField::new())
}
}
impl ::protobuf::Message for RepeatedRow {
impl ::protobuf::Message for RepeatedGridBlock {
fn is_initialized(&self) -> bool {
for v in &self.items {
if !v.is_initialized() {
@ -1868,47 +1868,255 @@ impl ::protobuf::Message for RepeatedRow {
Self::descriptor_static()
}
fn new() -> RepeatedRow {
RepeatedRow::new()
fn new() -> RepeatedGridBlock {
RepeatedGridBlock::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Row>>(
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlock>>(
"items",
|m: &RepeatedRow| { &m.items },
|m: &mut RepeatedRow| { &mut m.items },
|m: &RepeatedGridBlock| { &m.items },
|m: &mut RepeatedGridBlock| { &mut m.items },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<RepeatedRow>(
"RepeatedRow",
::protobuf::reflect::MessageDescriptor::new_pb_name::<RepeatedGridBlock>(
"RepeatedGridBlock",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static RepeatedRow {
static instance: ::protobuf::rt::LazyV2<RepeatedRow> = ::protobuf::rt::LazyV2::INIT;
instance.get(RepeatedRow::new)
fn default_instance() -> &'static RepeatedGridBlock {
static instance: ::protobuf::rt::LazyV2<RepeatedGridBlock> = ::protobuf::rt::LazyV2::INIT;
instance.get(RepeatedGridBlock::new)
}
}
impl ::protobuf::Clear for RepeatedRow {
impl ::protobuf::Clear for RepeatedGridBlock {
fn clear(&mut self) {
self.items.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for RepeatedRow {
impl ::std::fmt::Debug for RepeatedGridBlock {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for RepeatedRow {
impl ::protobuf::reflect::ProtobufValue for RepeatedGridBlock {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct GridBlock {
// message fields
pub block_id: ::std::string::String,
pub rows: ::protobuf::RepeatedField<Row>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a GridBlock {
fn default() -> &'a GridBlock {
<GridBlock as ::protobuf::Message>::default_instance()
}
}
impl GridBlock {
pub fn new() -> GridBlock {
::std::default::Default::default()
}
// string block_id = 1;
pub fn get_block_id(&self) -> &str {
&self.block_id
}
pub fn clear_block_id(&mut self) {
self.block_id.clear();
}
// Param is passed by value, moved
pub fn set_block_id(&mut self, v: ::std::string::String) {
self.block_id = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_block_id(&mut self) -> &mut ::std::string::String {
&mut self.block_id
}
// Take field
pub fn take_block_id(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.block_id, ::std::string::String::new())
}
// repeated .Row rows = 2;
pub fn get_rows(&self) -> &[Row] {
&self.rows
}
pub fn clear_rows(&mut self) {
self.rows.clear();
}
// Param is passed by value, moved
pub fn set_rows(&mut self, v: ::protobuf::RepeatedField<Row>) {
self.rows = v;
}
// Mutable pointer to the field.
pub fn mut_rows(&mut self) -> &mut ::protobuf::RepeatedField<Row> {
&mut self.rows
}
// Take field
pub fn take_rows(&mut self) -> ::protobuf::RepeatedField<Row> {
::std::mem::replace(&mut self.rows, ::protobuf::RepeatedField::new())
}
}
impl ::protobuf::Message for GridBlock {
fn is_initialized(&self) -> bool {
for v in &self.rows {
if !v.is_initialized() {
return false;
}
};
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.block_id)?;
},
2 => {
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.rows)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if !self.block_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.block_id);
}
for value in &self.rows {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
};
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.block_id.is_empty() {
os.write_string(1, &self.block_id)?;
}
for v in &self.rows {
os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
};
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> GridBlock {
GridBlock::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"block_id",
|m: &GridBlock| { &m.block_id },
|m: &mut GridBlock| { &mut m.block_id },
));
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<Row>>(
"rows",
|m: &GridBlock| { &m.rows },
|m: &mut GridBlock| { &mut m.rows },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<GridBlock>(
"GridBlock",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static GridBlock {
static instance: ::protobuf::rt::LazyV2<GridBlock> = ::protobuf::rt::LazyV2::INIT;
instance.get(GridBlock::new)
}
}
impl ::protobuf::Clear for GridBlock {
fn clear(&mut self) {
self.block_id.clear();
self.rows.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for GridBlock {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for GridBlock {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
@ -2599,6 +2807,165 @@ impl ::protobuf::reflect::ProtobufValue for GridId {
}
}
#[derive(PartialEq,Clone,Default)]
pub struct GridBlockId {
// message fields
pub value: ::std::string::String,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a GridBlockId {
fn default() -> &'a GridBlockId {
<GridBlockId as ::protobuf::Message>::default_instance()
}
}
impl GridBlockId {
pub fn new() -> GridBlockId {
::std::default::Default::default()
}
// string value = 1;
pub fn get_value(&self) -> &str {
&self.value
}
pub fn clear_value(&mut self) {
self.value.clear();
}
// Param is passed by value, moved
pub fn set_value(&mut self, v: ::std::string::String) {
self.value = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_value(&mut self) -> &mut ::std::string::String {
&mut self.value
}
// Take field
pub fn take_value(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.value, ::std::string::String::new())
}
}
impl ::protobuf::Message for GridBlockId {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.value)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if !self.value.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.value);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.value.is_empty() {
os.write_string(1, &self.value)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> GridBlockId {
GridBlockId::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"value",
|m: &GridBlockId| { &m.value },
|m: &mut GridBlockId| { &mut m.value },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<GridBlockId>(
"GridBlockId",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static GridBlockId {
static instance: ::protobuf::rt::LazyV2<GridBlockId> = ::protobuf::rt::LazyV2::INIT;
instance.get(GridBlockId::new)
}
}
impl ::protobuf::Clear for GridBlockId {
fn clear(&mut self) {
self.value.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for GridBlockId {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for GridBlockId {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct CreateRowPayload {
// message fields
@ -3057,23 +3424,23 @@ impl ::protobuf::reflect::ProtobufValue for QueryFieldPayload {
}
#[derive(PartialEq,Clone,Default)]
pub struct QueryRowPayload {
pub struct QueryGridBlocksPayload {
// message fields
pub grid_id: ::std::string::String,
pub row_orders: ::protobuf::SingularPtrField<RepeatedRowOrder>,
pub blocks: ::protobuf::RepeatedField<super::meta::GridBlockMeta>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a QueryRowPayload {
fn default() -> &'a QueryRowPayload {
<QueryRowPayload as ::protobuf::Message>::default_instance()
impl<'a> ::std::default::Default for &'a QueryGridBlocksPayload {
fn default() -> &'a QueryGridBlocksPayload {
<QueryGridBlocksPayload as ::protobuf::Message>::default_instance()
}
}
impl QueryRowPayload {
pub fn new() -> QueryRowPayload {
impl QueryGridBlocksPayload {
pub fn new() -> QueryGridBlocksPayload {
::std::default::Default::default()
}
@ -3103,43 +3470,35 @@ impl QueryRowPayload {
::std::mem::replace(&mut self.grid_id, ::std::string::String::new())
}
// .RepeatedRowOrder row_orders = 2;
// repeated .GridBlockMeta blocks = 2;
pub fn get_row_orders(&self) -> &RepeatedRowOrder {
self.row_orders.as_ref().unwrap_or_else(|| <RepeatedRowOrder as ::protobuf::Message>::default_instance())
pub fn get_blocks(&self) -> &[super::meta::GridBlockMeta] {
&self.blocks
}
pub fn clear_row_orders(&mut self) {
self.row_orders.clear();
}
pub fn has_row_orders(&self) -> bool {
self.row_orders.is_some()
pub fn clear_blocks(&mut self) {
self.blocks.clear();
}
// Param is passed by value, moved
pub fn set_row_orders(&mut self, v: RepeatedRowOrder) {
self.row_orders = ::protobuf::SingularPtrField::some(v);
pub fn set_blocks(&mut self, v: ::protobuf::RepeatedField<super::meta::GridBlockMeta>) {
self.blocks = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_row_orders(&mut self) -> &mut RepeatedRowOrder {
if self.row_orders.is_none() {
self.row_orders.set_default();
}
self.row_orders.as_mut().unwrap()
pub fn mut_blocks(&mut self) -> &mut ::protobuf::RepeatedField<super::meta::GridBlockMeta> {
&mut self.blocks
}
// Take field
pub fn take_row_orders(&mut self) -> RepeatedRowOrder {
self.row_orders.take().unwrap_or_else(|| RepeatedRowOrder::new())
pub fn take_blocks(&mut self) -> ::protobuf::RepeatedField<super::meta::GridBlockMeta> {
::std::mem::replace(&mut self.blocks, ::protobuf::RepeatedField::new())
}
}
impl ::protobuf::Message for QueryRowPayload {
impl ::protobuf::Message for QueryGridBlocksPayload {
fn is_initialized(&self) -> bool {
for v in &self.row_orders {
for v in &self.blocks {
if !v.is_initialized() {
return false;
}
@ -3155,7 +3514,7 @@ impl ::protobuf::Message for QueryRowPayload {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.grid_id)?;
},
2 => {
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.row_orders)?;
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.blocks)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -3172,10 +3531,10 @@ impl ::protobuf::Message for QueryRowPayload {
if !self.grid_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.grid_id);
}
if let Some(ref v) = self.row_orders.as_ref() {
let len = v.compute_size();
for value in &self.blocks {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
}
};
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
@ -3185,11 +3544,11 @@ impl ::protobuf::Message for QueryRowPayload {
if !self.grid_id.is_empty() {
os.write_string(1, &self.grid_id)?;
}
if let Some(ref v) = self.row_orders.as_ref() {
for v in &self.blocks {
os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
}
};
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
@ -3220,8 +3579,8 @@ impl ::protobuf::Message for QueryRowPayload {
Self::descriptor_static()
}
fn new() -> QueryRowPayload {
QueryRowPayload::new()
fn new() -> QueryGridBlocksPayload {
QueryGridBlocksPayload::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
@ -3230,59 +3589,59 @@ impl ::protobuf::Message for QueryRowPayload {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"grid_id",
|m: &QueryRowPayload| { &m.grid_id },
|m: &mut QueryRowPayload| { &mut m.grid_id },
|m: &QueryGridBlocksPayload| { &m.grid_id },
|m: &mut QueryGridBlocksPayload| { &mut m.grid_id },
));
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<RepeatedRowOrder>>(
"row_orders",
|m: &QueryRowPayload| { &m.row_orders },
|m: &mut QueryRowPayload| { &mut m.row_orders },
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::meta::GridBlockMeta>>(
"blocks",
|m: &QueryGridBlocksPayload| { &m.blocks },
|m: &mut QueryGridBlocksPayload| { &mut m.blocks },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryRowPayload>(
"QueryRowPayload",
::protobuf::reflect::MessageDescriptor::new_pb_name::<QueryGridBlocksPayload>(
"QueryGridBlocksPayload",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static QueryRowPayload {
static instance: ::protobuf::rt::LazyV2<QueryRowPayload> = ::protobuf::rt::LazyV2::INIT;
instance.get(QueryRowPayload::new)
fn default_instance() -> &'static QueryGridBlocksPayload {
static instance: ::protobuf::rt::LazyV2<QueryGridBlocksPayload> = ::protobuf::rt::LazyV2::INIT;
instance.get(QueryGridBlocksPayload::new)
}
}
impl ::protobuf::Clear for QueryRowPayload {
impl ::protobuf::Clear for QueryGridBlocksPayload {
fn clear(&mut self) {
self.grid_id.clear();
self.row_orders.clear();
self.blocks.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for QueryRowPayload {
impl ::std::fmt::Debug for QueryGridBlocksPayload {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for QueryRowPayload {
impl ::protobuf::reflect::ProtobufValue for QueryGridBlocksPayload {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\ngrid.proto\x1a\nmeta.proto\"p\n\x04Grid\x12\x0e\n\x02id\x18\x01\x20\
\n\ngrid.proto\x1a\nmeta.proto\"n\n\x04Grid\x12\x0e\n\x02id\x18\x01\x20\
\x01(\tR\x02id\x12.\n\x0cfield_orders\x18\x02\x20\x03(\x0b2\x0b.FieldOrd\
erR\x0bfieldOrders\x12(\n\nrow_orders\x18\x03\x20\x03(\x0b2\t.RowOrderR\
\trowOrders\"\xb8\x01\n\x05Field\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02\
id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\x18\
\x03\x20\x01(\tR\x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n.Fiel\
dTypeR\tfieldType\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06frozen\
\x12\x1e\n\nvisibility\x18\x06\x20\x01(\x08R\nvisibility\x12\x14\n\x05wi\
dth\x18\x07\x20\x01(\x05R\x05width\"'\n\nFieldOrder\x12\x19\n\x08field_i\
d\x18\x01\x20\x01(\tR\x07fieldId\"-\n\rRepeatedField\x12\x1c\n\x05items\
erR\x0bfieldOrders\x12&\n\x06blocks\x18\x03\x20\x03(\x0b2\x0e.GridBlockM\
etaR\x06blocks\"\xb8\x01\n\x05Field\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\
\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04desc\
\x18\x03\x20\x01(\tR\x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n.\
FieldTypeR\tfieldType\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06froze\
n\x12\x1e\n\nvisibility\x18\x06\x20\x01(\x08R\nvisibility\x12\x14\n\x05w\
idth\x18\x07\x20\x01(\x05R\x05width\"'\n\nFieldOrder\x12\x19\n\x08field_\
id\x18\x01\x20\x01(\tR\x07fieldId\"-\n\rRepeatedField\x12\x1c\n\x05items\
\x18\x01\x20\x03(\x0b2\x06.FieldR\x05items\"7\n\x12RepeatedFieldOrder\
\x12!\n\x05items\x18\x01\x20\x03(\x0b2\x0b.FieldOrderR\x05items\"<\n\x08\
RowOrder\x12\x15\n\x06row_id\x18\x01\x20\x01(\tR\x05rowId\x12\x19\n\x08b\
@ -3292,20 +3651,23 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x18\x02\x20\x03(\x0b2\x17.Row.CellByFieldIdEntryR\rcellByFieldId\x12\
\x16\n\x06height\x18\x03\x20\x01(\x05R\x06height\x1aG\n\x12CellByFieldId\
Entry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x1b\n\x05value\x18\
\x02\x20\x01(\x0b2\x05.CellR\x05value:\x028\x01\")\n\x0bRepeatedRow\x12\
\x1a\n\x05items\x18\x01\x20\x03(\x0b2\x04.RowR\x05items\";\n\x04Cell\x12\
\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x18\n\x07content\
\x18\x02\x20\x01(\tR\x07content\"+\n\x0cRepeatedCell\x12\x1b\n\x05items\
\x18\x01\x20\x03(\x0b2\x05.CellR\x05items\"'\n\x11CreateGridPayload\x12\
\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\"\x1e\n\x06GridId\x12\x14\n\
\x05value\x18\x01\x20\x01(\tR\x05value\"f\n\x10CreateRowPayload\x12\x17\
\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\"\n\x0cupper_row_id\x18\
\x02\x20\x01(\tH\0R\nupperRowIdB\x15\n\x13one_of_upper_row_id\"d\n\x11Qu\
eryFieldPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x126\
\n\x0cfield_orders\x18\x02\x20\x01(\x0b2\x13.RepeatedFieldOrderR\x0bfiel\
dOrders\"\\\n\x0fQueryRowPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\t\
R\x06gridId\x120\n\nrow_orders\x18\x02\x20\x01(\x0b2\x11.RepeatedRowOrde\
rR\trowOrdersb\x06proto3\
\x02\x20\x01(\x0b2\x05.CellR\x05value:\x028\x01\"5\n\x11RepeatedGridBloc\
k\x12\x20\n\x05items\x18\x01\x20\x03(\x0b2\n.GridBlockR\x05items\"@\n\tG\
ridBlock\x12\x19\n\x08block_id\x18\x01\x20\x01(\tR\x07blockId\x12\x18\n\
\x04rows\x18\x02\x20\x03(\x0b2\x04.RowR\x04rows\";\n\x04Cell\x12\x19\n\
\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x18\n\x07content\x18\x02\
\x20\x01(\tR\x07content\"+\n\x0cRepeatedCell\x12\x1b\n\x05items\x18\x01\
\x20\x03(\x0b2\x05.CellR\x05items\"'\n\x11CreateGridPayload\x12\x12\n\
\x04name\x18\x01\x20\x01(\tR\x04name\"\x1e\n\x06GridId\x12\x14\n\x05valu\
e\x18\x01\x20\x01(\tR\x05value\"#\n\x0bGridBlockId\x12\x14\n\x05value\
\x18\x01\x20\x01(\tR\x05value\"f\n\x10CreateRowPayload\x12\x17\n\x07grid\
_id\x18\x01\x20\x01(\tR\x06gridId\x12\"\n\x0cupper_row_id\x18\x02\x20\
\x01(\tH\0R\nupperRowIdB\x15\n\x13one_of_upper_row_id\"d\n\x11QueryField\
Payload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x126\n\x0cfie\
ld_orders\x18\x02\x20\x01(\x0b2\x13.RepeatedFieldOrderR\x0bfieldOrders\"\
Y\n\x16QueryGridBlocksPayload\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\
\x06gridId\x12&\n\x06blocks\x18\x02\x20\x03(\x0b2\x0e.GridBlockMetaR\x06\
blocksb\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -28,7 +28,7 @@ pub struct GridMeta {
// message fields
pub grid_id: ::std::string::String,
pub fields: ::protobuf::RepeatedField<FieldMeta>,
pub blocks: ::protobuf::RepeatedField<GridBlock>,
pub blocks: ::protobuf::RepeatedField<GridBlockMeta>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -96,10 +96,10 @@ impl GridMeta {
::std::mem::replace(&mut self.fields, ::protobuf::RepeatedField::new())
}
// repeated .GridBlock blocks = 3;
// repeated .GridBlockMeta blocks = 3;
pub fn get_blocks(&self) -> &[GridBlock] {
pub fn get_blocks(&self) -> &[GridBlockMeta] {
&self.blocks
}
pub fn clear_blocks(&mut self) {
@ -107,17 +107,17 @@ impl GridMeta {
}
// Param is passed by value, moved
pub fn set_blocks(&mut self, v: ::protobuf::RepeatedField<GridBlock>) {
pub fn set_blocks(&mut self, v: ::protobuf::RepeatedField<GridBlockMeta>) {
self.blocks = v;
}
// Mutable pointer to the field.
pub fn mut_blocks(&mut self) -> &mut ::protobuf::RepeatedField<GridBlock> {
pub fn mut_blocks(&mut self) -> &mut ::protobuf::RepeatedField<GridBlockMeta> {
&mut self.blocks
}
// Take field
pub fn take_blocks(&mut self) -> ::protobuf::RepeatedField<GridBlock> {
pub fn take_blocks(&mut self) -> ::protobuf::RepeatedField<GridBlockMeta> {
::std::mem::replace(&mut self.blocks, ::protobuf::RepeatedField::new())
}
}
@ -240,7 +240,7 @@ impl ::protobuf::Message for GridMeta {
|m: &GridMeta| { &m.fields },
|m: &mut GridMeta| { &mut m.fields },
));
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlock>>(
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlockMeta>>(
"blocks",
|m: &GridMeta| { &m.blocks },
|m: &mut GridMeta| { &mut m.blocks },
@ -280,240 +280,12 @@ impl ::protobuf::reflect::ProtobufValue for GridMeta {
}
}
#[derive(PartialEq,Clone,Default)]
pub struct GridBlock {
// message fields
pub id: ::std::string::String,
pub start_row_index: i32,
pub row_count: i32,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a GridBlock {
fn default() -> &'a GridBlock {
<GridBlock as ::protobuf::Message>::default_instance()
}
}
impl GridBlock {
pub fn new() -> GridBlock {
::std::default::Default::default()
}
// string id = 1;
pub fn get_id(&self) -> &str {
&self.id
}
pub fn clear_id(&mut self) {
self.id.clear();
}
// Param is passed by value, moved
pub fn set_id(&mut self, v: ::std::string::String) {
self.id = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_id(&mut self) -> &mut ::std::string::String {
&mut self.id
}
// Take field
pub fn take_id(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.id, ::std::string::String::new())
}
// int32 start_row_index = 2;
pub fn get_start_row_index(&self) -> i32 {
self.start_row_index
}
pub fn clear_start_row_index(&mut self) {
self.start_row_index = 0;
}
// Param is passed by value, moved
pub fn set_start_row_index(&mut self, v: i32) {
self.start_row_index = v;
}
// int32 row_count = 3;
pub fn get_row_count(&self) -> i32 {
self.row_count
}
pub fn clear_row_count(&mut self) {
self.row_count = 0;
}
// Param is passed by value, moved
pub fn set_row_count(&mut self, v: i32) {
self.row_count = v;
}
}
impl ::protobuf::Message for GridBlock {
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.id)?;
},
2 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_int32()?;
self.start_row_index = tmp;
},
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_int32()?;
self.row_count = tmp;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if !self.id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.id);
}
if self.start_row_index != 0 {
my_size += ::protobuf::rt::value_size(2, self.start_row_index, ::protobuf::wire_format::WireTypeVarint);
}
if self.row_count != 0 {
my_size += ::protobuf::rt::value_size(3, self.row_count, ::protobuf::wire_format::WireTypeVarint);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.id.is_empty() {
os.write_string(1, &self.id)?;
}
if self.start_row_index != 0 {
os.write_int32(2, self.start_row_index)?;
}
if self.row_count != 0 {
os.write_int32(3, self.row_count)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> GridBlock {
GridBlock::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"id",
|m: &GridBlock| { &m.id },
|m: &mut GridBlock| { &mut m.id },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
"start_row_index",
|m: &GridBlock| { &m.start_row_index },
|m: &mut GridBlock| { &mut m.start_row_index },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
"row_count",
|m: &GridBlock| { &m.row_count },
|m: &mut GridBlock| { &mut m.row_count },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<GridBlock>(
"GridBlock",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static GridBlock {
static instance: ::protobuf::rt::LazyV2<GridBlock> = ::protobuf::rt::LazyV2::INIT;
instance.get(GridBlock::new)
}
}
impl ::protobuf::Clear for GridBlock {
fn clear(&mut self) {
self.id.clear();
self.start_row_index = 0;
self.row_count = 0;
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for GridBlock {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for GridBlock {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct GridBlockMeta {
// message fields
pub block_id: ::std::string::String,
pub rows: ::protobuf::RepeatedField<RowMeta>,
pub start_row_index: i32,
pub row_count: i32,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -556,39 +328,39 @@ impl GridBlockMeta {
::std::mem::replace(&mut self.block_id, ::std::string::String::new())
}
// repeated .RowMeta rows = 2;
// int32 start_row_index = 2;
pub fn get_rows(&self) -> &[RowMeta] {
&self.rows
pub fn get_start_row_index(&self) -> i32 {
self.start_row_index
}
pub fn clear_rows(&mut self) {
self.rows.clear();
pub fn clear_start_row_index(&mut self) {
self.start_row_index = 0;
}
// Param is passed by value, moved
pub fn set_rows(&mut self, v: ::protobuf::RepeatedField<RowMeta>) {
self.rows = v;
pub fn set_start_row_index(&mut self, v: i32) {
self.start_row_index = v;
}
// Mutable pointer to the field.
pub fn mut_rows(&mut self) -> &mut ::protobuf::RepeatedField<RowMeta> {
&mut self.rows
// int32 row_count = 3;
pub fn get_row_count(&self) -> i32 {
self.row_count
}
pub fn clear_row_count(&mut self) {
self.row_count = 0;
}
// Take field
pub fn take_rows(&mut self) -> ::protobuf::RepeatedField<RowMeta> {
::std::mem::replace(&mut self.rows, ::protobuf::RepeatedField::new())
// Param is passed by value, moved
pub fn set_row_count(&mut self, v: i32) {
self.row_count = v;
}
}
impl ::protobuf::Message for GridBlockMeta {
fn is_initialized(&self) -> bool {
for v in &self.rows {
if !v.is_initialized() {
return false;
}
};
true
}
@ -600,7 +372,18 @@ impl ::protobuf::Message for GridBlockMeta {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.block_id)?;
},
2 => {
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.rows)?;
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_int32()?;
self.start_row_index = tmp;
},
3 => {
if wire_type != ::protobuf::wire_format::WireTypeVarint {
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type));
}
let tmp = is.read_int32()?;
self.row_count = tmp;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -617,10 +400,12 @@ impl ::protobuf::Message for GridBlockMeta {
if !self.block_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.block_id);
}
for value in &self.rows {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
};
if self.start_row_index != 0 {
my_size += ::protobuf::rt::value_size(2, self.start_row_index, ::protobuf::wire_format::WireTypeVarint);
}
if self.row_count != 0 {
my_size += ::protobuf::rt::value_size(3, self.row_count, ::protobuf::wire_format::WireTypeVarint);
}
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
@ -630,11 +415,12 @@ impl ::protobuf::Message for GridBlockMeta {
if !self.block_id.is_empty() {
os.write_string(1, &self.block_id)?;
}
for v in &self.rows {
os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
};
if self.start_row_index != 0 {
os.write_int32(2, self.start_row_index)?;
}
if self.row_count != 0 {
os.write_int32(3, self.row_count)?;
}
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
@ -678,10 +464,15 @@ impl ::protobuf::Message for GridBlockMeta {
|m: &GridBlockMeta| { &m.block_id },
|m: &mut GridBlockMeta| { &mut m.block_id },
));
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<RowMeta>>(
"rows",
|m: &GridBlockMeta| { &m.rows },
|m: &mut GridBlockMeta| { &mut m.rows },
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
"start_row_index",
|m: &GridBlockMeta| { &m.start_row_index },
|m: &mut GridBlockMeta| { &mut m.start_row_index },
));
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>(
"row_count",
|m: &GridBlockMeta| { &m.row_count },
|m: &mut GridBlockMeta| { &mut m.row_count },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<GridBlockMeta>(
"GridBlockMeta",
@ -700,7 +491,8 @@ impl ::protobuf::Message for GridBlockMeta {
impl ::protobuf::Clear for GridBlockMeta {
fn clear(&mut self) {
self.block_id.clear();
self.rows.clear();
self.start_row_index = 0;
self.row_count = 0;
self.unknown_fields.clear();
}
}
@ -717,6 +509,214 @@ impl ::protobuf::reflect::ProtobufValue for GridBlockMeta {
}
}
#[derive(PartialEq,Clone,Default)]
pub struct GridBlockMetaData {
// message fields
pub block_id: ::std::string::String,
pub row_metas: ::protobuf::RepeatedField<RowMeta>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
}
impl<'a> ::std::default::Default for &'a GridBlockMetaData {
fn default() -> &'a GridBlockMetaData {
<GridBlockMetaData as ::protobuf::Message>::default_instance()
}
}
impl GridBlockMetaData {
pub fn new() -> GridBlockMetaData {
::std::default::Default::default()
}
// string block_id = 1;
pub fn get_block_id(&self) -> &str {
&self.block_id
}
pub fn clear_block_id(&mut self) {
self.block_id.clear();
}
// Param is passed by value, moved
pub fn set_block_id(&mut self, v: ::std::string::String) {
self.block_id = v;
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_block_id(&mut self) -> &mut ::std::string::String {
&mut self.block_id
}
// Take field
pub fn take_block_id(&mut self) -> ::std::string::String {
::std::mem::replace(&mut self.block_id, ::std::string::String::new())
}
// repeated .RowMeta row_metas = 2;
pub fn get_row_metas(&self) -> &[RowMeta] {
&self.row_metas
}
pub fn clear_row_metas(&mut self) {
self.row_metas.clear();
}
// Param is passed by value, moved
pub fn set_row_metas(&mut self, v: ::protobuf::RepeatedField<RowMeta>) {
self.row_metas = v;
}
// Mutable pointer to the field.
pub fn mut_row_metas(&mut self) -> &mut ::protobuf::RepeatedField<RowMeta> {
&mut self.row_metas
}
// Take field
pub fn take_row_metas(&mut self) -> ::protobuf::RepeatedField<RowMeta> {
::std::mem::replace(&mut self.row_metas, ::protobuf::RepeatedField::new())
}
}
impl ::protobuf::Message for GridBlockMetaData {
fn is_initialized(&self) -> bool {
for v in &self.row_metas {
if !v.is_initialized() {
return false;
}
};
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
while !is.eof()? {
let (field_number, wire_type) = is.read_tag_unpack()?;
match field_number {
1 => {
::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.block_id)?;
},
2 => {
::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.row_metas)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u32 {
let mut my_size = 0;
if !self.block_id.is_empty() {
my_size += ::protobuf::rt::string_size(1, &self.block_id);
}
for value in &self.row_metas {
let len = value.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
};
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
self.cached_size.set(my_size);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
if !self.block_id.is_empty() {
os.write_string(1, &self.block_id)?;
}
for v in &self.row_metas {
os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
};
os.write_unknown_fields(self.get_unknown_fields())?;
::std::result::Result::Ok(())
}
fn get_cached_size(&self) -> u32 {
self.cached_size.get()
}
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
&self.unknown_fields
}
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
&mut self.unknown_fields
}
fn as_any(&self) -> &dyn (::std::any::Any) {
self as &dyn (::std::any::Any)
}
fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
self as &mut dyn (::std::any::Any)
}
fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
self
}
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
Self::descriptor_static()
}
fn new() -> GridBlockMetaData {
GridBlockMetaData::new()
}
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::LazyV2<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::LazyV2::INIT;
descriptor.get(|| {
let mut fields = ::std::vec::Vec::new();
fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
"block_id",
|m: &GridBlockMetaData| { &m.block_id },
|m: &mut GridBlockMetaData| { &mut m.block_id },
));
fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<RowMeta>>(
"row_metas",
|m: &GridBlockMetaData| { &m.row_metas },
|m: &mut GridBlockMetaData| { &mut m.row_metas },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<GridBlockMetaData>(
"GridBlockMetaData",
fields,
file_descriptor_proto()
)
})
}
fn default_instance() -> &'static GridBlockMetaData {
static instance: ::protobuf::rt::LazyV2<GridBlockMetaData> = ::protobuf::rt::LazyV2::INIT;
instance.get(GridBlockMetaData::new)
}
}
impl ::protobuf::Clear for GridBlockMetaData {
fn clear(&mut self) {
self.block_id.clear();
self.row_metas.clear();
self.unknown_fields.clear();
}
}
impl ::std::fmt::Debug for GridBlockMetaData {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for GridBlockMetaData {
fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
::protobuf::reflect::ReflectValueRef::Message(self)
}
}
#[derive(PartialEq,Clone,Default)]
pub struct FieldMeta {
// message fields
@ -3119,8 +3119,8 @@ impl ::protobuf::reflect::ProtobufValue for CellMetaChangeset {
pub struct BuildGridContext {
// message fields
pub field_metas: ::protobuf::RepeatedField<FieldMeta>,
pub grid_block: ::protobuf::SingularPtrField<GridBlock>,
pub grid_block_meta: ::protobuf::SingularPtrField<GridBlockMeta>,
pub grid_block: ::protobuf::SingularPtrField<GridBlockMeta>,
pub grid_block_meta_data: ::protobuf::SingularPtrField<GridBlockMetaData>,
// special fields
pub unknown_fields: ::protobuf::UnknownFields,
pub cached_size: ::protobuf::CachedSize,
@ -3162,11 +3162,11 @@ impl BuildGridContext {
::std::mem::replace(&mut self.field_metas, ::protobuf::RepeatedField::new())
}
// .GridBlock grid_block = 2;
// .GridBlockMeta grid_block = 2;
pub fn get_grid_block(&self) -> &GridBlock {
self.grid_block.as_ref().unwrap_or_else(|| <GridBlock as ::protobuf::Message>::default_instance())
pub fn get_grid_block(&self) -> &GridBlockMeta {
self.grid_block.as_ref().unwrap_or_else(|| <GridBlockMeta as ::protobuf::Message>::default_instance())
}
pub fn clear_grid_block(&mut self) {
self.grid_block.clear();
@ -3177,13 +3177,13 @@ impl BuildGridContext {
}
// Param is passed by value, moved
pub fn set_grid_block(&mut self, v: GridBlock) {
pub fn set_grid_block(&mut self, v: GridBlockMeta) {
self.grid_block = ::protobuf::SingularPtrField::some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_grid_block(&mut self) -> &mut GridBlock {
pub fn mut_grid_block(&mut self) -> &mut GridBlockMeta {
if self.grid_block.is_none() {
self.grid_block.set_default();
}
@ -3191,41 +3191,41 @@ impl BuildGridContext {
}
// Take field
pub fn take_grid_block(&mut self) -> GridBlock {
self.grid_block.take().unwrap_or_else(|| GridBlock::new())
pub fn take_grid_block(&mut self) -> GridBlockMeta {
self.grid_block.take().unwrap_or_else(|| GridBlockMeta::new())
}
// .GridBlockMeta grid_block_meta = 3;
// .GridBlockMetaData grid_block_meta_data = 3;
pub fn get_grid_block_meta(&self) -> &GridBlockMeta {
self.grid_block_meta.as_ref().unwrap_or_else(|| <GridBlockMeta as ::protobuf::Message>::default_instance())
pub fn get_grid_block_meta_data(&self) -> &GridBlockMetaData {
self.grid_block_meta_data.as_ref().unwrap_or_else(|| <GridBlockMetaData as ::protobuf::Message>::default_instance())
}
pub fn clear_grid_block_meta(&mut self) {
self.grid_block_meta.clear();
pub fn clear_grid_block_meta_data(&mut self) {
self.grid_block_meta_data.clear();
}
pub fn has_grid_block_meta(&self) -> bool {
self.grid_block_meta.is_some()
pub fn has_grid_block_meta_data(&self) -> bool {
self.grid_block_meta_data.is_some()
}
// Param is passed by value, moved
pub fn set_grid_block_meta(&mut self, v: GridBlockMeta) {
self.grid_block_meta = ::protobuf::SingularPtrField::some(v);
pub fn set_grid_block_meta_data(&mut self, v: GridBlockMetaData) {
self.grid_block_meta_data = ::protobuf::SingularPtrField::some(v);
}
// Mutable pointer to the field.
// If field is not initialized, it is initialized with default value first.
pub fn mut_grid_block_meta(&mut self) -> &mut GridBlockMeta {
if self.grid_block_meta.is_none() {
self.grid_block_meta.set_default();
pub fn mut_grid_block_meta_data(&mut self) -> &mut GridBlockMetaData {
if self.grid_block_meta_data.is_none() {
self.grid_block_meta_data.set_default();
}
self.grid_block_meta.as_mut().unwrap()
self.grid_block_meta_data.as_mut().unwrap()
}
// Take field
pub fn take_grid_block_meta(&mut self) -> GridBlockMeta {
self.grid_block_meta.take().unwrap_or_else(|| GridBlockMeta::new())
pub fn take_grid_block_meta_data(&mut self) -> GridBlockMetaData {
self.grid_block_meta_data.take().unwrap_or_else(|| GridBlockMetaData::new())
}
}
@ -3241,7 +3241,7 @@ impl ::protobuf::Message for BuildGridContext {
return false;
}
};
for v in &self.grid_block_meta {
for v in &self.grid_block_meta_data {
if !v.is_initialized() {
return false;
}
@ -3260,7 +3260,7 @@ impl ::protobuf::Message for BuildGridContext {
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grid_block)?;
},
3 => {
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grid_block_meta)?;
::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.grid_block_meta_data)?;
},
_ => {
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
@ -3282,7 +3282,7 @@ impl ::protobuf::Message for BuildGridContext {
let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
}
if let Some(ref v) = self.grid_block_meta.as_ref() {
if let Some(ref v) = self.grid_block_meta_data.as_ref() {
let len = v.compute_size();
my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
}
@ -3302,7 +3302,7 @@ impl ::protobuf::Message for BuildGridContext {
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
}
if let Some(ref v) = self.grid_block_meta.as_ref() {
if let Some(ref v) = self.grid_block_meta_data.as_ref() {
os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?;
os.write_raw_varint32(v.get_cached_size())?;
v.write_to_with_cached_sizes(os)?;
@ -3350,15 +3350,15 @@ impl ::protobuf::Message for BuildGridContext {
|m: &BuildGridContext| { &m.field_metas },
|m: &mut BuildGridContext| { &mut m.field_metas },
));
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlock>>(
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlockMeta>>(
"grid_block",
|m: &BuildGridContext| { &m.grid_block },
|m: &mut BuildGridContext| { &mut m.grid_block },
));
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlockMeta>>(
"grid_block_meta",
|m: &BuildGridContext| { &m.grid_block_meta },
|m: &mut BuildGridContext| { &mut m.grid_block_meta },
fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<GridBlockMetaData>>(
"grid_block_meta_data",
|m: &BuildGridContext| { &m.grid_block_meta_data },
|m: &mut BuildGridContext| { &mut m.grid_block_meta_data },
));
::protobuf::reflect::MessageDescriptor::new_pb_name::<BuildGridContext>(
"BuildGridContext",
@ -3378,7 +3378,7 @@ impl ::protobuf::Clear for BuildGridContext {
fn clear(&mut self) {
self.field_metas.clear();
self.grid_block.clear();
self.grid_block_meta.clear();
self.grid_block_meta_data.clear();
self.unknown_fields.clear();
}
}
@ -3458,56 +3458,57 @@ impl ::protobuf::reflect::ProtobufValue for FieldType {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\nmeta.proto\"k\n\x08GridMeta\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\
\n\nmeta.proto\"o\n\x08GridMeta\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\
\x06gridId\x12\"\n\x06fields\x18\x02\x20\x03(\x0b2\n.FieldMetaR\x06field\
s\x12\"\n\x06blocks\x18\x03\x20\x03(\x0b2\n.GridBlockR\x06blocks\"`\n\tG\
ridBlock\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12&\n\x0fstart_row_i\
ndex\x18\x02\x20\x01(\x05R\rstartRowIndex\x12\x1b\n\trow_count\x18\x03\
\x20\x01(\x05R\x08rowCount\"H\n\rGridBlockMeta\x12\x19\n\x08block_id\x18\
\x01\x20\x01(\tR\x07blockId\x12\x1c\n\x04rows\x18\x02\x20\x03(\x0b2\x08.\
RowMetaR\x04rows\"\xdf\x01\n\tFieldMeta\x12\x0e\n\x02id\x18\x01\x20\x01(\
\tR\x02id\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12\x12\n\x04des\
c\x18\x03\x20\x01(\tR\x04desc\x12)\n\nfield_type\x18\x04\x20\x01(\x0e2\n\
.FieldTypeR\tfieldType\x12\x16\n\x06frozen\x18\x05\x20\x01(\x08R\x06froz\
en\x12\x1e\n\nvisibility\x18\x06\x20\x01(\x08R\nvisibility\x12\x14\n\x05\
width\x18\x07\x20\x01(\x05R\x05width\x12!\n\x0ctype_options\x18\x08\x20\
\x01(\tR\x0btypeOptions\"\xfd\x02\n\x0eFieldChangeset\x12\x19\n\x08field\
_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x14\n\x04name\x18\x02\x20\x01(\tH\
\0R\x04name\x12\x14\n\x04desc\x18\x03\x20\x01(\tH\x01R\x04desc\x12+\n\nf\
ield_type\x18\x04\x20\x01(\x0e2\n.FieldTypeH\x02R\tfieldType\x12\x18\n\
\x06frozen\x18\x05\x20\x01(\x08H\x03R\x06frozen\x12\x20\n\nvisibility\
\x18\x06\x20\x01(\x08H\x04R\nvisibility\x12\x16\n\x05width\x18\x07\x20\
\x01(\x05H\x05R\x05width\x12#\n\x0ctype_options\x18\x08\x20\x01(\tH\x06R\
\x0btypeOptionsB\r\n\x0bone_of_nameB\r\n\x0bone_of_descB\x13\n\x11one_of\
_field_typeB\x0f\n\rone_of_frozenB\x13\n\x11one_of_visibilityB\x0e\n\x0c\
one_of_widthB\x15\n\x13one_of_type_options\"8\n\x07AnyData\x12\x17\n\x07\
type_id\x18\x01\x20\x01(\tR\x06typeId\x12\x14\n\x05value\x18\x02\x20\x01\
(\x0cR\x05value\"\xff\x01\n\x07RowMeta\x12\x0e\n\x02id\x18\x01\x20\x01(\
\tR\x02id\x12\x19\n\x08block_id\x18\x02\x20\x01(\tR\x07blockId\x12D\n\
\x10cell_by_field_id\x18\x03\x20\x03(\x0b2\x1b.RowMeta.CellByFieldIdEntr\
yR\rcellByFieldId\x12\x16\n\x06height\x18\x04\x20\x01(\x05R\x06height\
\x12\x1e\n\nvisibility\x18\x05\x20\x01(\x08R\nvisibility\x1aK\n\x12CellB\
yFieldIdEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\x1f\n\x05v\
alue\x18\x02\x20\x01(\x0b2\t.CellMetaR\x05value:\x028\x01\"\xa7\x02\n\
\x10RowMetaChangeset\x12\x15\n\x06row_id\x18\x01\x20\x01(\tR\x05rowId\
\x12\x18\n\x06height\x18\x02\x20\x01(\x05H\0R\x06height\x12\x20\n\nvisib\
ility\x18\x03\x20\x01(\x08H\x01R\nvisibility\x12M\n\x10cell_by_field_id\
\x18\x04\x20\x03(\x0b2$.RowMetaChangeset.CellByFieldIdEntryR\rcellByFiel\
dId\x1aK\n\x12CellByFieldIdEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\
\x03key\x12\x1f\n\x05value\x18\x02\x20\x01(\x0b2\t.CellMetaR\x05value:\
\x028\x01B\x0f\n\rone_of_heightB\x13\n\x11one_of_visibility\"9\n\x08Cell\
Meta\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\x12\x12\n\x04d\
ata\x18\x02\x20\x01(\tR\x04data\"\x83\x01\n\x11CellMetaChangeset\x12\x17\
\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\x12\x15\n\x06row_id\x18\x02\
\x20\x01(\tR\x05rowId\x12\x19\n\x08field_id\x18\x03\x20\x01(\tR\x07field\
Id\x12\x14\n\x04data\x18\x04\x20\x01(\tH\0R\x04dataB\r\n\x0bone_of_data\
\"\xa2\x01\n\x10BuildGridContext\x12+\n\x0bfield_metas\x18\x01\x20\x03(\
\x0b2\n.FieldMetaR\nfieldMetas\x12)\n\ngrid_block\x18\x02\x20\x01(\x0b2\
\n.GridBlockR\tgridBlock\x126\n\x0fgrid_block_meta\x18\x03\x20\x01(\x0b2\
\x0e.GridBlockMetaR\rgridBlockMeta*d\n\tFieldType\x12\x0c\n\x08RichText\
\x10\0\x12\n\n\x06Number\x10\x01\x12\x0c\n\x08DateTime\x10\x02\x12\x10\n\
\x0cSingleSelect\x10\x03\x12\x0f\n\x0bMultiSelect\x10\x04\x12\x0c\n\x08C\
heckbox\x10\x05b\x06proto3\
s\x12&\n\x06blocks\x18\x03\x20\x03(\x0b2\x0e.GridBlockMetaR\x06blocks\"o\
\n\rGridBlockMeta\x12\x19\n\x08block_id\x18\x01\x20\x01(\tR\x07blockId\
\x12&\n\x0fstart_row_index\x18\x02\x20\x01(\x05R\rstartRowIndex\x12\x1b\
\n\trow_count\x18\x03\x20\x01(\x05R\x08rowCount\"U\n\x11GridBlockMetaDat\
a\x12\x19\n\x08block_id\x18\x01\x20\x01(\tR\x07blockId\x12%\n\trow_metas\
\x18\x02\x20\x03(\x0b2\x08.RowMetaR\x08rowMetas\"\xdf\x01\n\tFieldMeta\
\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x12\n\x04name\x18\x02\x20\
\x01(\tR\x04name\x12\x12\n\x04desc\x18\x03\x20\x01(\tR\x04desc\x12)\n\nf\
ield_type\x18\x04\x20\x01(\x0e2\n.FieldTypeR\tfieldType\x12\x16\n\x06fro\
zen\x18\x05\x20\x01(\x08R\x06frozen\x12\x1e\n\nvisibility\x18\x06\x20\
\x01(\x08R\nvisibility\x12\x14\n\x05width\x18\x07\x20\x01(\x05R\x05width\
\x12!\n\x0ctype_options\x18\x08\x20\x01(\tR\x0btypeOptions\"\xfd\x02\n\
\x0eFieldChangeset\x12\x19\n\x08field_id\x18\x01\x20\x01(\tR\x07fieldId\
\x12\x14\n\x04name\x18\x02\x20\x01(\tH\0R\x04name\x12\x14\n\x04desc\x18\
\x03\x20\x01(\tH\x01R\x04desc\x12+\n\nfield_type\x18\x04\x20\x01(\x0e2\n\
.FieldTypeH\x02R\tfieldType\x12\x18\n\x06frozen\x18\x05\x20\x01(\x08H\
\x03R\x06frozen\x12\x20\n\nvisibility\x18\x06\x20\x01(\x08H\x04R\nvisibi\
lity\x12\x16\n\x05width\x18\x07\x20\x01(\x05H\x05R\x05width\x12#\n\x0cty\
pe_options\x18\x08\x20\x01(\tH\x06R\x0btypeOptionsB\r\n\x0bone_of_nameB\
\r\n\x0bone_of_descB\x13\n\x11one_of_field_typeB\x0f\n\rone_of_frozenB\
\x13\n\x11one_of_visibilityB\x0e\n\x0cone_of_widthB\x15\n\x13one_of_type\
_options\"8\n\x07AnyData\x12\x17\n\x07type_id\x18\x01\x20\x01(\tR\x06typ\
eId\x12\x14\n\x05value\x18\x02\x20\x01(\x0cR\x05value\"\xff\x01\n\x07Row\
Meta\x12\x0e\n\x02id\x18\x01\x20\x01(\tR\x02id\x12\x19\n\x08block_id\x18\
\x02\x20\x01(\tR\x07blockId\x12D\n\x10cell_by_field_id\x18\x03\x20\x03(\
\x0b2\x1b.RowMeta.CellByFieldIdEntryR\rcellByFieldId\x12\x16\n\x06height\
\x18\x04\x20\x01(\x05R\x06height\x12\x1e\n\nvisibility\x18\x05\x20\x01(\
\x08R\nvisibility\x1aK\n\x12CellByFieldIdEntry\x12\x10\n\x03key\x18\x01\
\x20\x01(\tR\x03key\x12\x1f\n\x05value\x18\x02\x20\x01(\x0b2\t.CellMetaR\
\x05value:\x028\x01\"\xa7\x02\n\x10RowMetaChangeset\x12\x15\n\x06row_id\
\x18\x01\x20\x01(\tR\x05rowId\x12\x18\n\x06height\x18\x02\x20\x01(\x05H\
\0R\x06height\x12\x20\n\nvisibility\x18\x03\x20\x01(\x08H\x01R\nvisibili\
ty\x12M\n\x10cell_by_field_id\x18\x04\x20\x03(\x0b2$.RowMetaChangeset.Ce\
llByFieldIdEntryR\rcellByFieldId\x1aK\n\x12CellByFieldIdEntry\x12\x10\n\
\x03key\x18\x01\x20\x01(\tR\x03key\x12\x1f\n\x05value\x18\x02\x20\x01(\
\x0b2\t.CellMetaR\x05value:\x028\x01B\x0f\n\rone_of_heightB\x13\n\x11one\
_of_visibility\"9\n\x08CellMeta\x12\x19\n\x08field_id\x18\x01\x20\x01(\t\
R\x07fieldId\x12\x12\n\x04data\x18\x02\x20\x01(\tR\x04data\"\x83\x01\n\
\x11CellMetaChangeset\x12\x17\n\x07grid_id\x18\x01\x20\x01(\tR\x06gridId\
\x12\x15\n\x06row_id\x18\x02\x20\x01(\tR\x05rowId\x12\x19\n\x08field_id\
\x18\x03\x20\x01(\tR\x07fieldId\x12\x14\n\x04data\x18\x04\x20\x01(\tH\0R\
\x04dataB\r\n\x0bone_of_data\"\xb3\x01\n\x10BuildGridContext\x12+\n\x0bf\
ield_metas\x18\x01\x20\x03(\x0b2\n.FieldMetaR\nfieldMetas\x12-\n\ngrid_b\
lock\x18\x02\x20\x01(\x0b2\x0e.GridBlockMetaR\tgridBlock\x12C\n\x14grid_\
block_meta_data\x18\x03\x20\x01(\x0b2\x12.GridBlockMetaDataR\x11gridBloc\
kMetaData*d\n\tFieldType\x12\x0c\n\x08RichText\x10\0\x12\n\n\x06Number\
\x10\x01\x12\x0c\n\x08DateTime\x10\x02\x12\x10\n\x0cSingleSelect\x10\x03\
\x12\x0f\n\x0bMultiSelect\x10\x04\x12\x0c\n\x08Checkbox\x10\x05b\x06prot\
o3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -4,7 +4,7 @@ import "meta.proto";
message Grid {
string id = 1;
repeated FieldOrder field_orders = 2;
repeated RowOrder row_orders = 3;
repeated GridBlockMeta blocks = 3;
}
message Field {
string id = 1;
@ -36,8 +36,12 @@ message Row {
map<string, Cell> cell_by_field_id = 2;
int32 height = 3;
}
message RepeatedRow {
repeated Row items = 1;
message RepeatedGridBlock {
repeated GridBlock items = 1;
}
message GridBlock {
string block_id = 1;
repeated Row rows = 2;
}
message Cell {
string field_id = 1;
@ -52,6 +56,9 @@ message CreateGridPayload {
message GridId {
string value = 1;
}
message GridBlockId {
string value = 1;
}
message CreateRowPayload {
string grid_id = 1;
oneof one_of_upper_row_id { string upper_row_id = 2; };
@ -60,7 +67,7 @@ message QueryFieldPayload {
string grid_id = 1;
RepeatedFieldOrder field_orders = 2;
}
message QueryRowPayload {
message QueryGridBlocksPayload {
string grid_id = 1;
RepeatedRowOrder row_orders = 2;
repeated GridBlockMeta blocks = 2;
}

View File

@ -3,16 +3,16 @@ syntax = "proto3";
message GridMeta {
string grid_id = 1;
repeated FieldMeta fields = 2;
repeated GridBlock blocks = 3;
}
message GridBlock {
string id = 1;
int32 start_row_index = 2;
int32 row_count = 3;
repeated GridBlockMeta blocks = 3;
}
message GridBlockMeta {
string block_id = 1;
repeated RowMeta rows = 2;
int32 start_row_index = 2;
int32 row_count = 3;
}
message GridBlockMetaData {
string block_id = 1;
repeated RowMeta row_metas = 2;
}
message FieldMeta {
string id = 1;
@ -63,8 +63,8 @@ message CellMetaChangeset {
}
message BuildGridContext {
repeated FieldMeta field_metas = 1;
GridBlock grid_block = 2;
GridBlockMeta grid_block_meta = 3;
GridBlockMeta grid_block = 2;
GridBlockMetaData grid_block_meta_data = 3;
}
enum FieldType {
RichText = 0;