ghassmo 4 лет назад
Родитель
Сommit
4e76f008f8
1 измененных файлов с 7 добавлено и 0 удалено
  1. 7 0
      src/blockchain/slabstore.rs

+ 7 - 0
src/blockchain/slabstore.rs

@@ -1,11 +1,14 @@
 use std::sync::Arc;
 use std::sync::Arc;
 
 
+use log::debug;
+
 use crate::serial::{deserialize, serialize};
 use crate::serial::{deserialize, serialize};
 use crate::Result;
 use crate::Result;
 
 
 use super::rocks::{columns, IteratorMode, RocksColumn};
 use super::rocks::{columns, IteratorMode, RocksColumn};
 use super::slab::Slab;
 use super::slab::Slab;
 
 
+
 pub struct SlabStore {
 pub struct SlabStore {
     rocks: RocksColumn<columns::Slabs>,
     rocks: RocksColumn<columns::Slabs>,
 }
 }
@@ -16,11 +19,13 @@ impl SlabStore {
     }
     }
 
 
     pub fn get(&self, key: Vec<u8>) -> Result<Option<Vec<u8>>> {
     pub fn get(&self, key: Vec<u8>) -> Result<Option<Vec<u8>>> {
+        debug!(target: "SLABSTORE", "get value");
         let value = self.rocks.get(key)?;
         let value = self.rocks.get(key)?;
         Ok(value)
         Ok(value)
     }
     }
 
 
     pub fn put(&self, slab: Slab) -> Result<Option<u64>> {
     pub fn put(&self, slab: Slab) -> Result<Option<u64>> {
+        debug!(target: "SLABSTORE", "Put slab");
         let last_index = self.get_last_index()?;
         let last_index = self.get_last_index()?;
         let key = last_index + 1;
         let key = last_index + 1;
 
 
@@ -37,6 +42,7 @@ impl SlabStore {
     }
     }
 
 
     pub fn get_last_index(&self) -> Result<u64> {
     pub fn get_last_index(&self) -> Result<u64> {
+        debug!(target: "SLABSTORE", "Get last index");
         let last_index = self.rocks.iterator(IteratorMode::End)?.next();
         let last_index = self.rocks.iterator(IteratorMode::End)?.next();
         match last_index {
         match last_index {
             Some((index, _)) => Ok(deserialize(&index)?),
             Some((index, _)) => Ok(deserialize(&index)?),
@@ -45,6 +51,7 @@ impl SlabStore {
     }
     }
 
 
     pub fn get_last_index_as_bytes(&self) -> Result<Vec<u8>> {
     pub fn get_last_index_as_bytes(&self) -> Result<Vec<u8>> {
+        debug!(target: "SLABSTORE", "Get last index as bytes");
         let last_index = self.rocks.iterator(IteratorMode::End)?.next();
         let last_index = self.rocks.iterator(IteratorMode::End)?.next();
         match last_index {
         match last_index {
             Some((index, _)) => Ok(index.to_vec()),
             Some((index, _)) => Ok(index.to_vec()),