libxr  1.0
Want to be the best embedded framework
Loading...
Searching...
No Matches
LibXR::DatabaseRaw< MinWriteSize >::FlashInfo Struct Reference

Flash 存储的块信息结构 (Structure representing a Flash storage block). More...

Collaboration diagram for LibXR::DatabaseRaw< MinWriteSize >::FlashInfo:
[legend]

Public Member Functions

 FlashInfo ()
 构造一个擦除态 FlashInfo 缓冲对象 (Construct one erased-state FlashInfo buffer object).
 

Data Fields

union { 
 
   uint32_t   header 
 Flash 块头签名 / Flash block-header signature. More...
 
   uint8_t   padding [MinWriteSize] 
 按最小写入单元对齐的原始块前缀 / Raw block prefix aligned to one minimum write unit. More...
 
};  
 让块前缀既能按签名读取,也能按最小写入单元整体写入 / Expose the block prefix both as a signature field and as one full minimum-write-unit write span
 
KeyInfo key
 紧跟在块头后的首个键头 / First key header stored right after the block header.
 

Detailed Description

template<size_t MinWriteSize>
struct LibXR::DatabaseRaw< MinWriteSize >::FlashInfo

Flash 存储的块信息结构 (Structure representing a Flash storage block).

Definition at line 163 of file raw.hpp.

Constructor & Destructor Documentation

◆ FlashInfo()

template<size_t MinWriteSize>
LibXR::DatabaseRaw< MinWriteSize >::FlashInfo::FlashInfo ( )
inline

构造一个擦除态 FlashInfo 缓冲对象 (Construct one erased-state FlashInfo buffer object).

Definition at line 169 of file raw.hpp.

178{
179
203template <size_t MinWriteSize>
204class DatabaseRaw : public Database
205{
215 static constexpr uint32_t FLASH_HEADER =
216 0x12345678 + LIBXR_DATABASE_VERSION;
217
226 static constexpr uint32_t CHECKSUM_BYTE = 0x9abcedf0;
227
228 // 存储布局定义:块角色、位图编码、键头与块头。
229 // Storage layout definitions: block roles, bitmap encodings, key headers,
230 // and block headers.
231#include "layout.hpp"
232
237 size_t recycle_threshold_ = 0;
238
243 Flash& flash_;
244
249 uint32_t block_size_;
250
259 uint8_t write_buffer_[MinWriteSize];
260
261 // 底层 Flash 读写辅助:按最小写入单元对齐、补齐、复制。
262 // Low-level Flash I/O helpers: minimum-write-unit alignment, tail padding,
263 // and raw copying.
264#include "flash_io.hpp"
265
266 // 块级语义:初始化、校验、失效、已用空间计算和块间复制。
267 // Block-level semantics: initialization, validation, invalidation,
268 // used-space accounting, and block-to-block copying.
269#include "block_ops.hpp"
270
271 // 键级语义:查找、追加、逻辑更新、条目地址计算。
272 // Key-level semantics: lookup, append, logical replacement, and entry
273 // address calculations.
274#include "key_ops.hpp"
275
280 public:
281 // 对外生命周期与主流程:构造、初始化、读写、恢复、回收。
282 // Public lifecycle and main flow: construction, initialization, read/write,
283 // restore, and recycle.
284#include "lifecycle.hpp"
285};
286
287} // namespace LibXR
DatabaseRaw(Flash &flash, size_t recycle_threshold=128)
构造函数,初始化 Flash 存储和缓冲区 (Constructor to initialize Flash storage and buffer).
Definition raw.hpp:71

Field Documentation

◆ header

template<size_t MinWriteSize>
uint32_t LibXR::DatabaseRaw< MinWriteSize >::FlashInfo::header

Flash 块头签名 / Flash block-header signature.

Definition at line 182 of file raw.hpp.

◆ key

template<size_t MinWriteSize>
KeyInfo LibXR::DatabaseRaw< MinWriteSize >::FlashInfo::key

紧跟在块头后的首个键头 / First key header stored right after the block header.

Definition at line 185 of file raw.hpp.

◆ padding

template<size_t MinWriteSize>
uint8_t LibXR::DatabaseRaw< MinWriteSize >::FlashInfo::padding[MinWriteSize]

按最小写入单元对齐的原始块前缀 / Raw block prefix aligned to one minimum write unit.

Definition at line 183 of file raw.hpp.


The documentation for this struct was generated from the following file: