当前位置: 首页 > news >正文

HarmonyOS分布式数据库深度应用

1. 分布式数据库架构解析

HarmonyOS分布式数据库(Distributed DataStore)是支撑跨设备数据同步的核心组件,它基于底层分布式软总线能力,为应用程序提供跨设备数据访问和同步功能。

1.1 整体架构设计

分布式数据库采用分层架构设计,从上至下包括:

  • 数据访问层:提供标准的数据操作API,支持KV数据模型和关系型数据操作
  • 同步引擎层:负责设备间数据同步,冲突解决策略管理
  • 存储引擎层:本地数据存储和管理,支持多种存储后端
  • 通信适配层:基于分布式软总线实现设备间安全通信

这种架构使得应用程序能够以统一的方式访问本地和远端设备数据,无需关心底层的网络通信和数据同步细节。

1.2 数据分布与同步机制

分布式数据库通过以下机制实现高效的数据分布和同步:

数据分片策略:根据设备能力和数据特性智能分片,关键数据多设备备份,非关键数据按需分布。

增量同步:仅同步发生变化的数据项,大幅减少网络传输量,采用操作转换(OT)算法解决并发冲突。

最终一致性保证:在网络分区恢复后自动达成数据一致性,支持自定义冲突解决策略。

2. 分布式数据库基础操作

2.1 数据库初始化与配置

首先需要在应用中初始化分布式数据库,并配置相关参数:

import relationalStore from '@ohos.data.relationalStore';
import distributedDeviceManager from '@ohos.distributedDeviceManager';class DistributedDatabaseManager {private rdbStore: relationalStore.RdbStore | null = null;private context: Context | null = null;// 初始化数据库async initDatabase(context: Context): Promise<void> {this.context = context;const config: relationalStore.StoreConfig = {name: 'DistributedAppDB.db',securityLevel: relationalStore.SecurityLevel.S1};try {// 创建或打开本地数据库this.rdbStore = await relationalStore.getRdbStore(context, config);// 配置分布式同步参数await this.setupDistributedConfig();console.info('分布式数据库初始化成功');} catch (error) {console.error('数据库初始化失败:', error);throw error;}}// 配置分布式同步private async setupDistributedConfig(): Promise<void> {if (!this.rdbStore) return;const distributedConfig: relationalStore.DistributedConfig = {autoSync: true, // 启用自动同步encryption: true, // 启用数据加密syncMode: relationalStore.SyncMode.PUSH_PULL, // 推拉同步模式securityLevel: relationalStore.SecurityLevel.S2};await this.rdbStore.setDistributedTables(distributedConfig, ['UserPreferences', 'DocumentData', 'ApplicationState']);}// 创建数据表async createTables(): Promise<void> {if (!this.rdbStore) throw new Error('数据库未初始化');const userTableSql = `CREATE TABLE IF NOT EXISTS UserPreferences (id INTEGER PRIMARY KEY AUTOINCREMENT,key TEXT NOT NULL UNIQUE,value TEXT,device_id TEXT,timestamp INTEGER,is_synced INTEGER DEFAULT 0)`;const documentTableSql = `CREATE TABLE IF NOT EXISTS DocumentData (id INTEGER PRIMARY KEY AUTOINCREMENT,doc_id TEXT NOT NULL,title TEXT,content TEXT,last_modified INTEGER,version INTEGER DEFAULT 1,device_id TEXT,conflict_version INTEGER DEFAULT 0)`;await this.rdbStore.executeSql(userTableSql);await this.rdbStore.executeSql(documentTableSql);// 创建索引提升查询性能await this.rdbStore.executeSql('CREATE INDEX IF NOT EXISTS idx_doc_id ON DocumentData(doc_id)');await this.rdbStore.executeSql('CREATE INDEX IF NOT EXISTS idx_timestamp ON UserPreferences(timestamp)');}
}

2.2 基础数据操作

实现分布式环境下的CRUD操作,需特别处理同步状态和冲突检测:

class DistributedDataOperations {private rdbStore: relationalStore.RdbStore;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;}// 插入数据并标记需要同步async insertData(table: string, data: ValuesBucket): Promise<number> {try {// 添加分布式元数据data.putString('device_id', this.getLocalDeviceId());data.putLong('timestamp', Date.now());data.putBoolean('is_synced', false);const rowId = await this.rdbStore.insert(table, data);console.info(`数据插入成功,行ID: ${rowId}`);// 触发数据同步await this.triggerSync();return rowId;} catch (error) {console.error(`插入数据到表 ${table} 失败:`, error);throw error;}}// 查询数据(支持跨设备查询)async queryData(table: string, columns: string[], predicates: relationalStore.RdbPredicates): Promise<relationalStore.ResultSet> {try {const resultSet = await this.rdbStore.query(predicates, columns);console.info(`查询到 ${resultSet.rowCount} 条记录`);return resultSet;} catch (error) {console.error(`查询表 ${table} 失败:`, error);throw error;}}// 更新数据并处理版本冲突async updateDataWithConflictResolution(table: string,predicates: relationalStore.RdbPredicates,data: ValuesBucket): Promise<boolean> {try {// 检查版本冲突const currentVersion = await this.getCurrentVersion(predicates);const newVersion = currentVersion + 1;data.putLong('version', newVersion);data.putBoolean('is_synced', false);const affectedRows = await this.rdbStore.update(data, predicates);if (affectedRows > 0) {await this.triggerSync();return true;}// 处理更新冲突return await this.handleUpdateConflict(table, predicates, data, currentVersion);} catch (error) {console.error('更新数据失败:', error);return false;}}// 获取本地设备IDprivate getLocalDeviceId(): string {// 实际实现中应从设备管理服务获取return 'local_device_001';}// 触发数据同步private async triggerSync(): Promise<void> {try {if (this.rdbStore.sync) {await this.rdbStore.sync({mode: relationalStore.SyncMode.PUSH,devices: [] // 空数组表示同步到所有可信设备});}} catch (error) {console.error('触发同步失败:', error);}}
}

3. 跨设备数据同步实战

3.1 同步策略配置

配置不同的同步策略以满足业务需求:

class SyncStrategyManager {private rdbStore: relationalStore.RdbStore;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;}// 配置实时同步策略(用于重要数据)setupRealtimeSync(tables: string[]): void {tables.forEach(async (table) => {await this.rdbStore.setSyncConfig(table, {mode: relationalStore.SyncMode.PUSH_PULL,triggerCondition: relationalStore.TriggerCondition.ON_DATA_CHANGE,delay: 0, // 立即同步retryCount: 3,retryDelay: 1000});});}// 配置延迟同步策略(用于非关键数据)setupLazySync(tables: string[]): void {tables.forEach(async (table) => {await this.rdbStore.setSyncConfig(table, {mode: relationalStore.SyncMode.PUSH,triggerCondition: relationalStore.TriggerCondition.ON_APP_FOREGROUND,delay: 5000, // 5秒延迟retryCount: 1});});}// 手动触发同步async manualSync(devices: string[]): Promise<boolean> {try {const syncResult = await this.rdbStore.sync({mode: relationalStore.SyncMode.PUSH_PULL,devices: devices,timeout: 30000 // 30秒超时});console.info(`同步完成,成功设备: ${syncResult.successDevices}, 失败设备: ${syncResult.failDevices}`);return syncResult.failDevices.length === 0;} catch (error) {console.error('手动同步失败:', error);return false;}}// 订阅同步状态变化subscribeSyncStatus(): void {this.rdbStore.on('dataChange', (event: relationalStore.SyncEvent) => {switch (event.eventType) {case relationalStore.SyncEventType.SYNC_COMPLETE:this.handleSyncComplete(event);break;case relationalStore.SyncEventType.SYNC_FAIL:this.handleSyncFailure(event);break;case relationalStore.SyncEventType.DATA_PUSHED:this.handleDataPushed(event);break;}});}private handleSyncComplete(event: relationalStore.SyncEvent): void {console.info(`同步完成,设备: ${event.deviceId}, 表: ${event.table}`);// 更新本地同步状态this.markDataAsSynced(event.table, event.deviceId);}private handleSyncFailure(event: relationalStore.SyncEvent): void {console.error(`同步失败,设备: ${event.deviceId}, 错误: ${event.error}`);// 实现重试逻辑this.retrySync(event);}
}

3.2 冲突检测与解决

实现多设备并发修改时的冲突解决机制:

class ConflictResolutionManager {private rdbStore: relationalStore.RdbStore;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;}// 检测并解决冲突async detectAndResolveConflicts(table: string): Promise<void> {const conflicts = await this.detectConflicts(table);for (const conflict of conflicts) {const resolution = await this.resolveConflict(conflict);await this.applyResolution(conflict, resolution);}}// 检测数据冲突private async detectConflicts(table: string): Promise<Conflict[]> {const conflicts: Conflict[] = [];// 查询存在版本冲突的记录const predicates = new relationalStore.RdbPredicates(table);predicates.greaterThan('conflict_version', 0);const resultSet = await this.rdbStore.query(predicates, ['id', 'doc_id', 'version', 'conflict_version', 'device_id']);while (resultSet.goToNextRow()) {conflicts.push({id: resultSet.getLong(resultSet.getColumnIndex('id')),docId: resultSet.getString(resultSet.getColumnIndex('doc_id')),version: resultSet.getLong(resultSet.getColumnIndex('version')),conflictVersion: resultSet.getLong(resultSet.getColumnIndex('conflict_version')),deviceId: resultSet.getString(resultSet.getColumnIndex('device_id'))});}resultSet.close();return conflicts;}// 解决冲突(支持多种策略)private async resolveConflict(conflict: Conflict): Promise<ConflictResolution> {// 基于时间戳的解决策略(最后写入获胜)if (this.useTimestampStrategy(conflict)) {return await this.timestampBasedResolution(conflict);}// 基于设备优先级的解决策略if (this.useDevicePriorityStrategy(conflict)) {return await this.devicePriorityBasedResolution(conflict);}// 自定义业务逻辑解决策略return await this.customBusinessResolution(conflict);}// 时间戳解决策略private async timestampBasedResolution(conflict: Conflict): Promise<ConflictResolution> {// 获取各设备的最新时间戳const timestamps = await this.getConflictTimestamps(conflict);const latestEntry = this.getLatestTimestampEntry(timestamps);return {winningVersion: latestEntry.version,resolutionType: 'TIMESTAMP_BASED',mergedData: latestEntry.data};}// 应用解决方案private async applyResolution(conflict: Conflict, resolution: ConflictResolution): Promise<void> {const predicates = new relationalStore.RdbPredicates('DocumentData');predicates.equalTo('id', conflict.id);const values: ValuesBucket = new ValuesBucket();values.putLong('version', resolution.winningVersion);values.putLong('conflict_version', 0); // 清除冲突标记values.putBoolean('is_synced', false);if (resolution.mergedData) {// 应用合并后的数据Object.keys(resolution.mergedData).forEach(key => {values.putObject(key, resolution.mergedData[key]);});}await this.rdbStore.update(values, predicates);console.info(`冲突解决完成,记录ID: ${conflict.id}`);}
}

4. 分布式数据查询优化

4.1 跨设备联合查询

实现高效的多设备数据查询和聚合:

class DistributedQueryEngine {private rdbStore: relationalStore.RdbStore;private deviceManager: distributedDeviceManager.DeviceManager;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;}// 执行跨设备联合查询async executeDistributedQuery(query: DistributedQuery): Promise<QueryResult> {const localResults = await this.executeLocalQuery(query);const remoteResults = await this.executeRemoteQueries(query);// 合并结果return this.mergeResults(localResults, remoteResults, query.mergeStrategy);}// 执行本地查询private async executeLocalQuery(query: DistributedQuery): Promise<any[]> {const predicates = this.buildPredicates(query);const resultSet = await this.rdbStore.query(predicates, query.columns);const results: any[] = [];while (resultSet.goToNextRow()) {results.push(this.extractRowData(resultSet, query.columns));}resultSet.close();return results;}// 执行远程设备查询private async executeRemoteQueries(query: DistributedQuery): Promise<RemoteResult[]> {const trustedDevices = await this.getTrustedDevices();const remoteResults: RemoteResult[] = [];// 并行查询所有可信设备const queryPromises = trustedDevices.map(device => this.queryRemoteDevice(device, query));const results = await Promise.allSettled(queryPromises);results.forEach((result, index) => {if (result.status === 'fulfilled') {remoteResults.push({deviceId: trustedDevices[index],data: result.value,timestamp: Date.now()});}});return remoteResults;}// 构建查询条件private buildPredicates(query: DistributedQuery): relationalStore.RdbPredicates {const predicates = new relationalStore.RdbPredicates(query.table);if (query.filters) {query.filters.forEach(filter => {switch (filter.operator) {case 'EQ':predicates.equalTo(filter.field, filter.value);break;case 'GT':predicates.greaterThan(filter.field, filter.value);break;case 'LT':predicates.lessThan(filter.field, filter.value);break;}});}if (query.orderBy) {predicates.orderBy(query.orderBy.field, query.orderBy.descending);}if (query.limit) {predicates.limit(query.limit);}return predicates;}// 合并本地和远程结果private mergeResults(localResults: any[], remoteResults: RemoteResult[], strategy: MergeStrategy): QueryResult {switch (strategy) {case 'UNION_ALL':return this.unionAllMerge(localResults, remoteResults);case 'LATEST_FIRST':return this.latestFirstMerge(localResults, remoteResults);case 'DEVICE_PRIORITY':return this.devicePriorityMerge(localResults, remoteResults);default:return this.defaultMerge(localResults, remoteResults);}}
}

4.2 查询性能优化

实现查询缓存和索引优化:

class QueryOptimizationManager {private queryCache: Map<string, CacheEntry>;private maxCacheSize: number = 1000;constructor() {this.queryCache = new Map();}// 带缓存的查询async queryWithCache(predicates: relationalStore.RdbPredicates, columns: string[]): Promise<any[]> {const cacheKey = this.generateCacheKey(predicates, columns);// 检查缓存const cachedResult = this.getFromCache(cacheKey);if (cachedResult && !this.isCacheExpired(cachedResult)) {console.info('缓存命中');return cachedResult.data;}// 执行查询并缓存结果const result = await this.executeAndCacheQuery(predicates, columns, cacheKey);return result;}// 生成缓存键private generateCacheKey(predicates: relationalStore.RdbPredicates, columns: string[]): string {const predicateString = predicates.getWhereClause();const columnString = columns.sort().join(',');return `${predicateString}|${columnString}`;}// 执行查询并缓存private async executeAndCacheQuery(predicates: relationalStore.RdbPredicates,columns: string[],cacheKey: string): Promise<any[]> {const startTime = Date.now();// 使用事务提升查询性能const result = await this.executeQueryInTransaction(predicates, columns);const queryTime = Date.now() - startTime;console.info(`查询执行时间: ${queryTime}ms`);// 缓存结果this.addToCache(cacheKey, result, queryTime);return result;}// 在事务中执行查询private async executeQueryInTransaction(predicates: relationalStore.RdbPredicates,columns: string[]): Promise<any[]> {// 开始事务await this.rdbStore.beginTransaction();try {const resultSet = await this.rdbStore.query(predicates, columns);const results: any[] = [];while (resultSet.goToNextRow()) {results.push(this.extractRowData(resultSet, columns));}resultSet.close();await this.rdbStore.commit(); // 提交事务return results;} catch (error) {await this.rdbStore.rollback(); // 回滚事务throw error;}}// 清理过期缓存private cleanupExpiredCache(): void {const now = Date.now();for (const [key, entry] of this.queryCache.entries()) {if (now - entry.timestamp > this.cacheTTL) {this.queryCache.delete(key);}}}
}

5. 实战案例:分布式笔记应用

下面通过一个完整的分布式笔记应用案例,展示分布式数据库的实际应用。

5.1 数据模型设计

class DistributedNoteApp {private dbManager: DistributedDatabaseManager;private syncManager: SyncStrategyManager;private conflictManager: ConflictResolutionManager;// 初始化笔记应用async initialize(context: Context): Promise<void> {this.dbManager = new DistributedDatabaseManager();await this.dbManager.initDatabase(context);await this.dbManager.createTables();this.syncManager = new SyncStrategyManager(this.dbManager.getRdbStore());this.conflictManager = new ConflictResolutionManager(this.dbManager.getRdbStore());// 配置同步策略this.setupSyncStrategies();// 订阅数据变更事件this.subscribeToDataChanges();}// 创建新笔记async createNote(noteData: NoteData): Promise<string> {const noteId = this.generateNoteId();const values: ValuesBucket = new ValuesBucket();values.putString('note_id', noteId);values.putString('title', noteData.title);values.putString('content', noteData.content);values.putLong('created_time', Date.now());values.putLong('modified_time', Date.now());values.putLong('version', 1);values.putString('device_id', this.getLocalDeviceId());await this.dbManager.insertData('DocumentData', values);// 立即同步到其他设备await this.syncManager.manualSync([]);return noteId;}// 更新笔记内容async updateNote(noteId: string, newContent: string): Promise<boolean> {const predicates = new relationalStore.RdbPredicates('DocumentData');predicates.equalTo('note_id', noteId);const values: ValuesBucket = new ValuesBucket();values.putString('content', newContent);values.putLong('modified_time', Date.now());return await this.dbManager.updateDataWithConflictResolution('DocumentData', predicates, values);}// 获取所有笔记(包括其他设备的笔记)async getAllNotes(): Promise<Note[]> {const query: DistributedQuery = {table: 'DocumentData',columns: ['note_id', 'title', 'content', 'modified_time', 'device_id'],filters: [],orderBy: { field: 'modified_time', descending: true },mergeStrategy: 'LATEST_FIRST'};const queryEngine = new DistributedQueryEngine(this.dbManager.getRdbStore());const results = await queryEngine.executeDistributedQuery(query);return this.transformToNotes(results);}// 处理笔记冲突async handleNoteConflicts(): Promise<void> {await this.conflictManager.detectAndResolveConflicts('DocumentData');// 重新同步解决冲突后的数据await this.syncManager.manualSync([]);}
}

5.2 高级同步特性

实现智能同步和离线支持:

class AdvancedSyncFeatures {private rdbStore: relationalStore.RdbStore;private isOnline: boolean = true;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;this.monitorNetworkStatus();}// 监控网络状态private monitorNetworkStatus(): void {// 监听网络状态变化network.getDefaultNet().on('netAvailable', () => {this.isOnline = true;this.processPendingSyncs();});network.getDefaultNet().on('netLost', () => {this.isOnline = false;});}// 处理待同步队列private async processPendingSyncs(): Promise<void> {if (!this.isOnline) return;const pendingSyncs = await this.getPendingSyncs();for (const sync of pendingSyncs) {try {await this.executeSync(sync);await this.markSyncCompleted(sync.id);} catch (error) {console.error(`同步失败: ${sync.id}`, error);await this.recordSyncFailure(sync.id, error);}}}// 智能同步策略async intelligentSync(strategy: SyncStrategy): Promise<void> {const syncConfig = this.buildSyncConfig(strategy);switch (strategy.priority) {case 'HIGH':// 高优先级:立即同步,重试多次await this.immediateSync(syncConfig);break;case 'NORMAL':// 普通优先级:批量同步,适当延迟await this.batchSync(syncConfig);break;case 'LOW':// 低优先级:仅在WiFi环境下同步await this.wifiOnlySync(syncConfig);break;}}// 数据压缩传输private async compressDataForSync(data: any): Promise<Uint8Array> {const jsonString = JSON.stringify(data);const encoder = new TextEncoder();const encodedData = encoder.encode(jsonString);// 简单的压缩实现(实际应使用更高效的压缩算法)return this.simpleCompress(encodedData);}// 同步状态监控private setupSyncMonitoring(): void {this.rdbStore.on('syncProgress', (progress: SyncProgress) => {this.updateSyncUI(progress);if (progress.totalBytes > 1024 * 1024) { // 大于1MBthis.showLargeSyncWarning(progress);}});}
}

6. 安全与性能优化

6.1 数据安全保护

class DataSecurityManager {private rdbStore: relationalStore.RdbStore;constructor(rdbStore: relationalStore.RdbStore) {this.rdbStore = rdbStore;}// 加密敏感数据async encryptSensitiveData(table: string, sensitiveFields: string[]): Promise<void> {const predicates = new relationalStore.RdbPredicates(table);const resultSet = await this.rdbStore.query(predicates, ['id', ...sensitiveFields]);while (resultSet.goToNextRow()) {const updateValues = new ValuesBucket();const id = resultSet.getLong(resultSet.getColumnIndex('id'));for (const field of sensitiveFields) {const plainText = resultSet.getString(resultSet.getColumnIndex(field));const encryptedText = await this.encrypt(plainText);updateValues.putString(field, encryptedText);}const updatePredicates = new relationalStore.RdbPredicates(table);updatePredicates.equalTo('id', id);await this.rdbStore.update(updateValues, updatePredicates);}resultSet.close();}// 设备访问控制setupDeviceAccessControl(): void {this.rdbStore.on('deviceAccessRequest', async (request: DeviceAccessRequest) => {const isTrusted = await this.verifyDeviceTrust(request.deviceId);const hasPermission = await this.checkDataAccessPermission(request.deviceId, request.table, request.operation);return isTrusted && hasPermission;});}// 数据访问审计async logDataAccess(deviceId: string, table: string, operation: string, recordId: number): Promise<void> {const auditValues: ValuesBucket = new ValuesBucket();auditValues.putString('device_id', deviceId);auditValues.putString('table_name', table);auditValues.putString('operation', operation);auditValues.putLong('record_id', recordId);auditValues.putLong('access_time', Date.now());await this.rdbStore.insert('DataAccessAudit', auditValues);}
}

总结

HarmonyOS分布式数据库通过精心的架构设计和优化策略,为开发者提供了强大的跨设备数据管理能力。关键技术和最佳实践包括:

核心架构优势

  • 统一的数据访问接口,简化跨设备数据操作
  • 智能同步策略,平衡性能和数据一致性要求
  • 灵活的冲突解决机制,支持多种业务场景

性能优化关键

  • 增量同步减少网络传输量
  • 智能缓存提升查询性能
  • 事务处理保证数据一致性

安全可靠性

  • 端到端数据加密保障隐私安全
  • 设备认证和访问控制机制
  • 完善的错误处理和恢复策略

通过本文的实战案例和代码示例,开发者可以快速掌握HarmonyOS分布式数据库的开发技巧,构建出高效可靠的跨设备应用。

http://www.dtcms.com/a/524555.html

相关文章:

  • 南阳网站优化费用方太产品站网站建设
  • 从 rt.jar 到模块化:JDK9 类加载机制的全面演进
  • 列举一些数据仓库面向主题的设计的实际案例
  • 网站托管服务适合wordpress上传视频黑屏
  • MongoDB 8.x 制作一键部署安装包文档分享(Linux / Windows )
  • Data Warehouse简介
  • 若依 - idea集成docker一键部署springboot项目(docker-compose)
  • 2025 年 MathorCup 大数据建模竞赛 AB 题:高质量全方案・成品资料速取(含双代码 + 论文)
  • 为什么 idea 建议去掉 StringBuilder,使用“+”拼接字符串
  • 2025年数字人语音合成师专业能力测试
  • 门户网站建设思维导图wordpress表格显示图片
  • 【案例实战】基于 AGC 云开发与元服务构建智能待办应用
  • 【第五章:计算机视觉-项目实战之推荐/广告系统】2.粗排算法-(3)理解粗排模型之在线部分:在线架构及对双塔的应用
  • Spring Boot 起步:自动装配的魔法
  • 嵌入式软件架构--显示界面2(呼叫界面,密码界面)
  • 购物网站制作怎么做wordpress移动自媒体
  • 酒店网站做的比较好的钓鱼网站的制作教程
  • 从理论到实战:生成对抗网络(GAN)在图像生成中的关键技巧与完整代码剖析
  • 在K8S中部署MySQL主从
  • go strconv包介绍
  • 论文阅读12——基于学习的具有扩散行为的人流量预测方法
  • 对于随机变量x1, …, xn,其和的范数平方的期望不超过n倍各随机变量范数平方的期望之和
  • ARM《3》_学习c和汇编的混合编程
  • 硬件工程师11月实战项目-10G高速数字示波器开发
  • FPGA Debug:Vivado程序综合卡在了Run Synthesis
  • 免费网站建设推广服务什么样的公司愿意做网站
  • 世隆科技:无人船——开启水上智能作业新时代
  • 网站后台模板关联自己做的网站电商网站楼层 设计
  • 【北京迅为】iTOP-4412精英版使用手册-第六十八章 U-boot基础知识
  • 关于函数调用其实是函数指针+传参+解引用的一些思考