Chain db ORM, 存储方式 table: { key: :value }

ChainStore

head

head_header

get_header_head

get_sync_head

get_block

block_exists

get_block_header

is_on_current_chain

    // We are on the current chain if -
    // * the header by height index matches the header, and
    // * we are not ahead of the current head

get_header_by_height

get_output_pos

build_block_input_bitmap

build_and_cache_block_input_bitmap

get_block_input_bitmap

    // the full block from the db (if the block is found).
    // (bool, Bitmap) : (false if bitmap was built and not found in db)

batch

/// Builds a new batch to be used with this store.

Batch

save_head

save_body_head

save_header_head

save_sync_head

init_sync_head

reset_head

// Reset both header_head and sync_head to the current head of the body chain

get_block

/// get block

save_block

/// Save the block and its header

delete_block

    /// Delete a full block. Does not delete any record associated with a block
    /// header.

save_block_header

save_header_height

delete_header_by_height

save_output_pos

get_output_pos

delete_output_pos

get_block_header_db

save_block_input_bitmap

delete_block_input_bitmap

setup_height

    /// Maintain consistency of the "header_by_height" index by traversing back
    /// through the current chain and updating "header_by_height" until we reach
    /// a block_header that is consistent with its height (everything prior to
    /// this will be consistent).
    /// We need to handle the case where we have no index entry for a given
    /// height to account for the case where we just switched to a new fork and
    /// the height jumped beyond current chain height.

build_by_height_index

commit

    /// Commits this batch. If it's a child batch, it will be merged with the
    /// parent, otherwise the batch is written to db.

child

    /// Creates a child of this batch. It will be merged with its parent on
    /// commit, abandoned otherwise.

results matching ""

    No results matching ""