Remove unused re-exports of database types and related dead code (#6490)
This commit is contained in:
		
				
					committed by
					
						
						Greg Fitzgerald
					
				
			
			
				
	
			
			
			
						parent
						
							f80a5b8c34
						
					
				
				
					commit
					75d68edfe7
				
			@@ -37,13 +37,12 @@ use solana_sdk::clock::Slot;
 | 
			
		||||
mod db;
 | 
			
		||||
mod meta;
 | 
			
		||||
 | 
			
		||||
pub use db::columns;
 | 
			
		||||
use db::{columns as cf, Column, IteratorDirection, IteratorMode};
 | 
			
		||||
use rocksdb::DBRawIterator;
 | 
			
		||||
 | 
			
		||||
pub type Database = db::Database;
 | 
			
		||||
pub type LedgerColumn<C> = db::LedgerColumn<C>;
 | 
			
		||||
pub type WriteBatch = db::WriteBatch;
 | 
			
		||||
type Database = db::Database;
 | 
			
		||||
type LedgerColumn<C> = db::LedgerColumn<C>;
 | 
			
		||||
type WriteBatch = db::WriteBatch;
 | 
			
		||||
type BatchProcessor = db::BatchProcessor;
 | 
			
		||||
 | 
			
		||||
pub const BLOCKTREE_DIRECTORY: &str = "rocksdb";
 | 
			
		||||
 
 | 
			
		||||
@@ -31,6 +31,7 @@ pub enum IteratorMode<Index> {
 | 
			
		||||
    From(Index, IteratorDirection),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[allow(dead_code)]
 | 
			
		||||
pub enum IteratorDirection {
 | 
			
		||||
    Forward,
 | 
			
		||||
    Reverse,
 | 
			
		||||
@@ -158,11 +159,6 @@ impl Rocks {
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn delete_cf(&self, cf: ColumnFamily, key: &[u8]) -> Result<()> {
 | 
			
		||||
        self.0.delete_cf(cf, key)?;
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fn iterator_cf(
 | 
			
		||||
        &self,
 | 
			
		||||
        cf: ColumnFamily,
 | 
			
		||||
@@ -467,30 +463,6 @@ impl Database {
 | 
			
		||||
        Ok(())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn get_bytes<C>(&self, key: C::Index) -> Result<Option<Vec<u8>>>
 | 
			
		||||
    where
 | 
			
		||||
        C: Column,
 | 
			
		||||
    {
 | 
			
		||||
        self.backend
 | 
			
		||||
            .get_cf(self.cf_handle::<C>(), C::key(key).borrow())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn put_bytes<C>(&self, key: C::Index, data: &[u8]) -> Result<()>
 | 
			
		||||
    where
 | 
			
		||||
        C: Column,
 | 
			
		||||
    {
 | 
			
		||||
        self.backend
 | 
			
		||||
            .put_cf(self.cf_handle::<C>(), C::key(key).borrow(), data)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn delete<C>(&self, key: C::Index) -> Result<()>
 | 
			
		||||
    where
 | 
			
		||||
        C: Column,
 | 
			
		||||
    {
 | 
			
		||||
        self.backend
 | 
			
		||||
            .delete_cf(self.cf_handle::<C>(), C::key(key).borrow())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn get<C>(&self, key: C::Index) -> Result<Option<C::Type>>
 | 
			
		||||
    where
 | 
			
		||||
        C: TypedColumn,
 | 
			
		||||
@@ -507,19 +479,6 @@ impl Database {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn put<C>(&self, key: C::Index, value: &C::Type) -> Result<()>
 | 
			
		||||
    where
 | 
			
		||||
        C: TypedColumn,
 | 
			
		||||
    {
 | 
			
		||||
        let serialized_value = serialize(value)?;
 | 
			
		||||
 | 
			
		||||
        self.backend.put_cf(
 | 
			
		||||
            self.cf_handle::<C>(),
 | 
			
		||||
            C::key(key).borrow(),
 | 
			
		||||
            &serialized_value,
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn iter<C>(
 | 
			
		||||
        &self,
 | 
			
		||||
        iterator_mode: IteratorMode<C::Index>,
 | 
			
		||||
@@ -673,6 +632,7 @@ where
 | 
			
		||||
        self.backend.cf_handle(C::NAME)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[cfg(test)]
 | 
			
		||||
    pub fn is_empty(&self) -> Result<bool> {
 | 
			
		||||
        let mut iter = self.backend.raw_iterator_cf(self.handle())?;
 | 
			
		||||
        iter.seek_to_first();
 | 
			
		||||
@@ -683,10 +643,6 @@ where
 | 
			
		||||
        self.backend
 | 
			
		||||
            .put_cf(self.handle(), C::key(key).borrow(), value)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    pub fn delete(&self, key: C::Index) -> Result<()> {
 | 
			
		||||
        self.backend.delete_cf(self.handle(), C::key(key).borrow())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<C> LedgerColumn<C>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user