mirror of
https://github.com/loro-dev/loro.git
synced 2025-01-22 21:07:43 +00:00
feat: change cfg api
This commit is contained in:
parent
e603a42f28
commit
b15602307e
2 changed files with 50 additions and 7 deletions
|
@ -222,13 +222,6 @@ impl LogStore {
|
|||
&self.frontiers
|
||||
}
|
||||
|
||||
fn get_change_merge_cfg(&self) -> ChangeMergeCfg {
|
||||
ChangeMergeCfg {
|
||||
max_change_length: self.cfg.change.max_change_length,
|
||||
max_change_interval: self.cfg.change.max_change_interval,
|
||||
}
|
||||
}
|
||||
|
||||
/// this method would not get the container and apply op
|
||||
pub fn append_local_ops(&mut self, ops: &[Op]) -> (SmallVec<[ID; 2]>, &[ID]) {
|
||||
let old_version = self.frontiers.clone();
|
||||
|
@ -304,6 +297,29 @@ impl LogStore {
|
|||
&self.vv
|
||||
}
|
||||
|
||||
fn get_change_merge_cfg(&self) -> ChangeMergeCfg {
|
||||
ChangeMergeCfg {
|
||||
max_change_length: self.cfg.change.max_change_length,
|
||||
max_change_interval: self.cfg.change.max_change_interval,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn max_change_length(&mut self, max_change_length: usize) {
|
||||
self.cfg.change.max_change_length = max_change_length
|
||||
}
|
||||
|
||||
pub(crate) fn max_change_interval(&mut self, max_change_interval: usize) {
|
||||
self.cfg.change.max_change_interval = max_change_interval
|
||||
}
|
||||
|
||||
pub(crate) fn gc(&mut self, gc: bool) {
|
||||
self.cfg.gc.gc = gc;
|
||||
}
|
||||
|
||||
pub(crate) fn snapshot_interval(&mut self, snapshot_interval: u64) {
|
||||
self.cfg.gc.snapshot_interval = snapshot_interval;
|
||||
}
|
||||
|
||||
#[cfg(feature = "test_utils")]
|
||||
pub fn debug_inspect(&mut self) {
|
||||
println!(
|
||||
|
|
|
@ -148,4 +148,31 @@ impl LoroCore {
|
|||
pub fn notify(&self, events: Vec<RawEvent>) {
|
||||
Hierarchy::send_notifications_without_lock(self.hierarchy.clone(), events)
|
||||
}
|
||||
|
||||
// config
|
||||
|
||||
pub fn max_change_length(&mut self, max_change_length: usize) {
|
||||
self.log_store
|
||||
.write()
|
||||
.unwrap()
|
||||
.max_change_length(max_change_length);
|
||||
}
|
||||
|
||||
pub fn max_change_interval(&mut self, max_change_interval: usize) {
|
||||
self.log_store
|
||||
.write()
|
||||
.unwrap()
|
||||
.max_change_interval(max_change_interval);
|
||||
}
|
||||
|
||||
pub fn gc(&mut self, gc: bool) {
|
||||
self.log_store.write().unwrap().gc(gc)
|
||||
}
|
||||
|
||||
pub fn snapshot_interval(&mut self, snapshot_interval: u64) {
|
||||
self.log_store
|
||||
.write()
|
||||
.unwrap()
|
||||
.snapshot_interval(snapshot_interval);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue