@@ -24,17 +24,17 @@ pub enum Operation {
2424}
2525
2626#[ derive( Debug , Clone , Deserialize , Serialize , PartialEq ) ]
27- pub struct StoreValue ( pub Option < Vec < u8 > > ) ;
27+ pub struct Value ( pub Option < Vec < u8 > > ) ;
2828
29- impl From < & str > for StoreValue {
29+ impl From < & str > for Value {
3030 fn from ( value : & str ) -> Self {
31- StoreValue ( Some ( value. into ( ) ) )
31+ Value ( Some ( value. into ( ) ) )
3232 }
3333}
3434
35- impl From < String > for StoreValue {
35+ impl From < String > for Value {
3636 fn from ( value : String ) -> Self {
37- StoreValue ( Some ( value. into_bytes ( ) ) )
37+ Value ( Some ( value. into_bytes ( ) ) )
3838 }
3939}
4040
@@ -92,7 +92,7 @@ struct LogEntry {
9292 /// the entry with the most recent timestamp wins.
9393 timestamp : i64 ,
9494 key : String ,
95- value : Option < StoreValue > ,
95+ value : Option < Value > ,
9696}
9797
9898#[ derive( Debug , Clone , Deserialize , Serialize ) ]
@@ -118,7 +118,7 @@ struct StoreConfig {
118118
119119impl KvsEngine for KvStore {
120120 /// Set the value of a key by inserting the value into the store for the given key.
121- async fn set ( & self , key : String , value : StoreValue ) -> Result < ( ) > {
121+ async fn set ( & self , key : String , value : Value ) -> Result < ( ) > {
122122 debug ! ( key, "Setting key" ) ;
123123 let timestamp = chrono:: Utc :: now ( ) . timestamp ( ) ;
124124 let entry = LogEntry {
@@ -165,7 +165,7 @@ impl KvsEngine for KvStore {
165165 ///
166166 /// The timestamp is typically used with replication, as the value acts as
167167 /// a version number and conflict resolution mechanism.
168- async fn get ( & self , key : String ) -> Result < Option < StoreValue > > {
168+ async fn get ( & self , key : String ) -> Result < Option < Value > > {
169169 debug ! ( key, "Getting key" ) ;
170170 match self . keydir . get ( & key) {
171171 Some ( entry) => {
0 commit comments