@@ -5,7 +5,6 @@ use loro_common::{HasCounterSpan, HasIdSpan, HasLamportSpan, TreeID};
5
5
use rle:: { HasLength , RleVec , Sliceable } ;
6
6
use serde_columnar:: { columnar, iter_from_bytes, to_vec} ;
7
7
use std:: { borrow:: Cow , ops:: Deref , sync:: Arc } ;
8
- use zerovec:: { vecs:: Index32 , VarZeroVec } ;
9
8
10
9
use crate :: {
11
10
change:: { Change , Timestamp } ,
@@ -27,12 +26,9 @@ use crate::{
27
26
28
27
type PeerIdx = u32 ;
29
28
30
- #[ zerovec:: make_varule( RootContainerULE ) ]
31
- #[ zerovec:: derive( Serialize , Deserialize ) ]
32
29
#[ derive( Debug , Clone , PartialEq , Eq , PartialOrd , Ord , serde:: Serialize , serde:: Deserialize ) ]
33
- struct RootContainer < ' a > {
34
- #[ serde( borrow) ]
35
- name : Cow < ' a , str > ,
30
+ struct RootContainer {
31
+ name : InternalString ,
36
32
type_ : ContainerType ,
37
33
}
38
34
@@ -149,8 +145,7 @@ struct DocEncoding<'a> {
149
145
style_info : Cow < ' a , [ u8 ] > ,
150
146
style_key : Vec < usize > ,
151
147
style_values : Vec < LoroValue > ,
152
- #[ columnar( borrow) ]
153
- root_containers : VarZeroVec < ' a , RootContainerULE , Index32 > ,
148
+ root_containers : Vec < RootContainer > ,
154
149
start_counter : Vec < Counter > ,
155
150
values : Vec < Option < LoroValue > > ,
156
151
clients : Vec < PeerID > ,
@@ -379,7 +374,7 @@ pub fn encode_oplog_v2(oplog: &OpLog, vv: &VersionVector) -> Vec<u8> {
379
374
clients : peers,
380
375
keys,
381
376
start_counter,
382
- root_containers : VarZeroVec :: from ( & root_containers ) ,
377
+ root_containers,
383
378
normal_containers,
384
379
values,
385
380
style_key : style_key_idx,
@@ -401,7 +396,7 @@ fn extract_containers(
401
396
peer_id_to_idx : & mut FxHashMap < PeerID , PeerIdx > ,
402
397
peers : & mut Vec < PeerID > ,
403
398
) -> (
404
- Vec < RootContainer < ' static > > ,
399
+ Vec < RootContainer > ,
405
400
FxHashMap < ContainerIdx , usize > ,
406
401
Vec < NormalContainer > ,
407
402
) {
@@ -427,7 +422,7 @@ fn extract_containers(
427
422
} => {
428
423
container_idx2index. insert ( container, root_containers. len ( ) ) ;
429
424
root_containers. push ( RootContainer {
430
- name : Cow :: Owned ( name . to_string ( ) ) ,
425
+ name,
431
426
type_ : container_type,
432
427
} ) ;
433
428
}
@@ -505,8 +500,8 @@ pub fn decode_oplog_v2(oplog: &mut OpLog, input: &[u8]) -> Result<(), LoroError>
505
500
return None ;
506
501
} ;
507
502
Some ( ContainerID :: Root {
508
- name : container. name . into ( ) ,
509
- container_type : ContainerType :: from_u8 ( container. type_ ) ,
503
+ name : container. name . clone ( ) ,
504
+ container_type : container. type_ ,
510
505
} )
511
506
} else {
512
507
let Some ( container) = normal_containers. get ( idx - root_containers. len ( ) ) else {
0 commit comments