@@ -4,39 +4,46 @@ use crate::persist::error::CommitPersistError;
44pub enum CommitStrategy {
55 /// Args without the use of a lookup table
66 #[ default]
7- Args ,
7+ StateArgs ,
88 /// Args with the use of a lookup table
9- ArgsWithLookupTable ,
9+ StateArgsWithLookupTable ,
1010 /// Buffer and chunks which has the most overhead
11- FromBuffer ,
11+ StateBuffer ,
1212 /// Buffer and chunks with the use of a lookup table
13- FromBufferWithLookupTable ,
13+ StateBufferWithLookupTable ,
14+
15+ /// Args without the use of a lookup table
16+ DiffArgs ,
17+ /// Args with the use of a lookup table
18+ DiffArgsWithLookupTable ,
19+ /// Buffer and chunks which has the most overhead
20+ DiffBuffer ,
21+ /// Buffer and chunks with the use of a lookup table
22+ DiffBufferWithLookupTable ,
1423}
1524
1625impl CommitStrategy {
17- pub fn args ( use_lookup : bool ) -> Self {
18- if use_lookup {
19- Self :: ArgsWithLookupTable
20- } else {
21- Self :: Args
22- }
23- }
24-
2526 pub fn as_str ( & self ) -> & str {
2627 use CommitStrategy :: * ;
2728 match self {
28- Args => "Args" ,
29- ArgsWithLookupTable => "ArgsWithLookupTable" ,
30- FromBuffer => "FromBuffer" ,
31- FromBufferWithLookupTable => "FromBufferWithLookupTable" ,
29+ StateArgs => "StateArgs" ,
30+ StateArgsWithLookupTable => "StateArgsWithLookupTable" ,
31+ StateBuffer => "StateBuffer" ,
32+ StateBufferWithLookupTable => "StateBufferWithLookupTable" ,
33+ DiffArgs => "DiffArgs" ,
34+ DiffArgsWithLookupTable => "DiffArgsWithLookupTable" ,
35+ DiffBuffer => "DiffBuffer" ,
36+ DiffBufferWithLookupTable => "DiffBufferWithLookupTable" ,
3237 }
3338 }
3439
3540 pub fn uses_lookup ( & self ) -> bool {
3641 matches ! (
3742 self ,
38- CommitStrategy :: ArgsWithLookupTable
39- | CommitStrategy :: FromBufferWithLookupTable
43+ CommitStrategy :: StateArgsWithLookupTable
44+ | CommitStrategy :: StateBufferWithLookupTable
45+ | CommitStrategy :: DiffArgsWithLookupTable
46+ | CommitStrategy :: DiffBufferWithLookupTable
4047 )
4148 }
4249}
@@ -45,10 +52,18 @@ impl TryFrom<&str> for CommitStrategy {
4552 type Error = CommitPersistError ;
4653 fn try_from ( value : & str ) -> Result < Self , CommitPersistError > {
4754 match value {
48- "Args" => Ok ( Self :: Args ) ,
49- "ArgsWithLookupTable" => Ok ( Self :: ArgsWithLookupTable ) ,
50- "FromBuffer" => Ok ( Self :: FromBuffer ) ,
51- "FromBufferWithLookupTable" => Ok ( Self :: FromBufferWithLookupTable ) ,
55+ "Args" | "StateArgs" => Ok ( Self :: StateArgs ) ,
56+ "ArgsWithLookupTable" | "StateArgsWithLookupTable" => {
57+ Ok ( Self :: StateArgsWithLookupTable )
58+ }
59+ "FromBuffer" | "StateBuffer" => Ok ( Self :: StateBuffer ) ,
60+ "FromBufferWithLookupTable" | "StateBufferWithLookupTable" => {
61+ Ok ( Self :: StateBufferWithLookupTable )
62+ }
63+ "DiffArgs" => Ok ( Self :: DiffArgs ) ,
64+ "DiffArgsWithLookupTable" => Ok ( Self :: DiffArgsWithLookupTable ) ,
65+ "DiffBuffer" => Ok ( Self :: DiffBuffer ) ,
66+ "DiffBufferWithLookupTable" => Ok ( Self :: DiffBufferWithLookupTable ) ,
5267 _ => Err ( CommitPersistError :: InvalidCommitStrategy (
5368 value. to_string ( ) ,
5469 ) ) ,
0 commit comments