Skip to main content

CowBTree

Struct CowBTree 

Source
pub struct CowBTree {
    root_sector: u32,
}
Expand description

ディスク上のCOW B-Treeインデックスマネージャ

Fields§

§root_sector: u32

Implementations§

Source§

impl CowBTree

Source

pub fn new(root_sector: u32) -> Self

Source

pub fn get_root(&self) -> u32

Source

pub fn search<B: BlockDevice>( &self, device: &mut MirroredBlockDevice<B>, key: &[u8; 16], ) -> Option<u32>

指定したキーを B-Tree から検索します (O(log N) 探索) 成功すると、指し示されているファイルメタデータセクタ番号を返します。

Source

pub fn insert<B: BlockDevice>( &mut self, device: &mut MirroredBlockDevice<B>, key: &[u8; 16], val_sector: u32, alloc_sector_fn: &mut dyn FnMut() -> u32, ) -> Result<u32, &'static str>

インデックスへ新しいキーとセクタのペアを挿入します (COWによる再帰的ツリー更新) 更新された新しいルートノードのセクタ番号を返します。

Source

pub fn collect_leaf_entries<B: BlockDevice>( &self, device: &mut MirroredBlockDevice<B>, out: &mut Vec<([u8; 16], u32)>, )

すべての葉ノードエントリ (key, value_sector) を収集

Source

fn collect_from_node<B: BlockDevice>( &self, device: &mut MirroredBlockDevice<B>, sector: u32, out: &mut Vec<([u8; 16], u32)>, visited: &mut Vec<u32>, )

Source

fn insert_recursive<B: BlockDevice>( &self, device: &mut MirroredBlockDevice<B>, curr_sector: u32, key: &[u8; 16], val_sector: u32, alloc_sector_fn: &mut dyn FnMut() -> u32, ) -> Result<InsertResult, &'static str>

COW を保ちつつ、B-Treeに再帰的に挿入を行います。

Source

fn split_node<B: BlockDevice>( &self, device: &mut MirroredBlockDevice<B>, node: &mut BTreeNode, new_sector: u32, alloc_sector_fn: &mut dyn FnMut() -> u32, ) -> Result<InsertResult, &'static str>

ノードの半分を別の新しいセクタに分割し、親への引き上げ情報を返します (COW対応)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.