Logo
中文版
详情联系: neusar-support@reachauto.com
API 文档

1 引言

1.1 目的(Goal)

本文主要描述A核存储管理模块的公用接口,以便软件软件测试人员、应用开发人员使用模块进行测试或应用开发。

1.2 范围(Scope)

本文主要提供给模块的测试人员、使用模块的开发人员。

1.3 参考文档(Reference)

编号(No.)SVN路径/文档名(Document Name)文档版本(Revision)
1https://neusarsvn.in.reachauto.com/svn/SDC-EOS-aCore/02.Develop/02.SoftwareDevelopment/11.DeliveryDocument/02.NeuSAR aCore平台用户手册/01.NeuSAR aCore使用手册/PER/ NeuSAR aCore_API文档_PER.docx8.0

1.4 术语及缩略语(Term and abbreviations)

编号(No.)缩写 Term/Abbreviation说明 Description
1PERPersistency,持久化
2KVKey Value,键值(存储)

2 Header Files

File PathDescription
midware/per_wrapper/compress_method.h定义压缩解压接口。
midware/per_wrapper/file_storage_wrapper.h包含文件存储库管理的接口定义、类定义。
midware/per_wrapper/key_value_storage_proxy.h提供A核应用核内共享存储、A核应用访问M核数据的代理的接口定义、类定义。
midware/per_wrapper/kvs_wrapper.h包含键值存储的接口定义、类定义。
midware/per_wrapper/read_accessor_wrapper.h提供只读文件操作的类定义。
midware/per_wrapper/read_write_accessor_wrapper.h提供可读可写文件操作的类定义。
midware/per_wrapper/storage_capacity.h提供应用存储容量查询类定义。
midware/per_wrapper/strategy.h提供存储策略的定义。
midware/per_wrapper/partition_capactity_wrapper.h提供磁盘分区容量查询的接口定义、类定义。
midware/per_wrapper/per_wrapper_common_define.h提供一些通用结构体定义。

3 DataType

3.1 Key-Value Storage

本节的类型为Key-Value键值存储的操作服务,其中定义的存储策略相关的宏也服务于File Storage。

3.1.1 Class KeyValueStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-KVS-001
ASILQM
NameKeyValueStorageWrapper
Kindclass
Description定义键值存储的操作类,封装并增强ara::per::KeyValueStorage的功能。
Symbolmidware::perwrapper::KeyValueStorageWrapper
Scopemidware::perwrapper
Syntaxclass KeyValueStorageWrapper {…};
Header file#include "midware/per_wrapper/kvs_wrapper.h"
Note代码示例及类句柄的获取说明:
auto result = OpenKeyValueStorageWrapper(StringView("pathname"));
if(!result) {
//打开键值库系统失败,错误信息为:result.Error().Message();
//相应的处理
}
auto kv = std::move(result).Value();
此kv即为此类的对象指针。

3.1.2 Macro Storage Strategy

Interface IDSWSD-STPR-WRAPPER-API-CRON-001
ASILQM
Name
Kindmacro
Description定义文件、键值库的存储策略。
Symbol
Scope
Syntax#define S_NONE         0x00 #define S_IMMEDIATELY  0x01 #define S_CYCLE        0x02 #define S_CLOSED       0x04
Values:S_NONE = 0x00不增加其它存储策略
S_IMMEDIATELY= 0x01在有写入的操作时立即存储
S_CYCLE= 0x02根据设置的时间间隔周期存储
S_CLOSED = 0x04下电存储,会在存储对象析构时存储
Header file#include "midware/per_wrapper/strategy.h"

3.2 Key-Value Storage Proxy

本节的类型服务于核内共享、核间共享的操作。

3.2.1 Class KeyValueStorageProxy

Interface IDSWSD-STPR-WRAPPER-API- KV.PROXY-001
ASILQM
NameFileStorageWrapper
Kindclass
Description定义键值存储代理(核内共享、A核访问M核数据)的操作类。
Symbolmidware::perwrapper::KeyValueStorageProxy
Scopemidware::perwrapper
Syntaxclass KeyValueStorageProxy {…};
Header file#include "midware/per_wrapper/key_value_storage_proxy.h"
Note代码示例及类句柄的获取说明: auto result = OpenKeyValueStorageProxy(StringView("pathname")); if(!result) { //打开键值库系统失败,错误信息为:result.Error().Message(); //相应的处理 } auto proxy = std::move(result).Value(); 此proxy即为此类的对象指针。

3.3 File Storage

本节的类型服务于文件存储操作。

3.3.1 Class FileStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-FS-001
ASILQM
NameFileStorageWrapper
Kindclass
Description定义文件库的操作类,封装并增强ara::per::FileStorage的功能。
Symbolmidware::perwrapper::FileStorageWrapper
Scopemidware::perwrapper
Syntaxclass FileStorageWrapper {…};
Header file#include "midware/per_wrapper/file_storage_wrapper.h"
Note代码示例及类句柄的获取说明:
auto result = OpenFileStorageWrapper(StringView("pathname"));
if(!result) {
//打开文件系统失败,错误信息为:result.Error().Message();
//相应的处理
}
auto fileStroage = std::move(result).Value();
此fileStroage即为此类的对象指针。

3.3.2 Class ReadAccessorWrapper

Interface IDSWSD-STPR-WRAPPER-API-FS-002
ASILQM
NameReadAccessorWrapper
Kindclass
Description定义只读文件操作类,封装并增强ara::per::ReadAccessor的功能。
Symbolmidware::perwrapper::ReadAccessorWrapper
Scopemidware::perwrapper
Syntaxclass ReadAccessorWrapper {…};
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note代码示例及类句柄的获取说明:
见class FileStorageWrapper相应的示例获取的fileStroage句柄。
auto accessor = fileStroage->OpenFileReadOnly(StringView("filename"));
if(!accessor) {
//以只读方式打开文件失败,信息为:accessor.Error().Message();
//相应处理
}
auto ac = std::move(accessor).Value();
ac即为此类的对象指针。

3.3.3 Class ReadWriteAccessorWrapper

Interface IDSWSD-STPR-WRAPPER-API-FS-003
ASILQM
NameReadWriteAccessorWrapper
Kindclass
Description定义可读可写文件操作类,封装增强ara::per::ReadWriteAccessor的功能。
Symbolmidware::perwrapper::ReadAccessorWrapper
Scopemidware::perwrapper
Syntaxclass ReadWriteAccessorWrapper : public ReadAccessorWrapper {…};
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note代码示例及类句柄的获取说明:
见class FileStorageWrapper相应的示例获取的fileStroage句柄。
auto accessor = fileStroage->OpenFileReadWrite(StringView("filename"));
if(!accessor) {
//以可读可写方式打开文件失败,信息为:accessor.Error().Message();
//相应处理
}
auto ac = std::move(accessor).Value();
ac即为此类的指针。

3.4 APP Storage Capacity

本节的类型服务于设置、获取应用存储容量。

3.4.1 Class StorageCapacity

Interface IDSWSD-STPR-WRAPPER-API-APP.CAP-001
ASILQM
NameStorageCapacity
Kindclass
Description定义应用存储空间查询操作类。
Symbolmidware::perwrapper::StorageCapacity
Scopemidware::perwrapper
Syntaxclass StorageCapacity {…};
Header file#include "midware/per_wrapper/storage_capacity.h"

3.5 Partition Capacity

本节的类型服务于获取磁盘分区存储容量。

3.5.1 Struct MountPartitionInfo

Interface IDSWSD-STPR-WRAPPER-API-PART.CAP-001
ASILQM
NameMountPartitionInfo
Kindstruct
Description表示已挂载的分区容量信息,成员意义分别为:
string name; // 分区名称
uint32_t size; // 分区总容量,单位KB
uint32_t used; // 分区已使用容量,单位KB
uint32_t available; // 分区剩余可用容量,单位KB
string used_percent; // 分区已使用容量百分比,保留1位小数
string mount_point; // 挂载路径
Symbolmidware::perwrapper::MountPartitionInfo
Scopemidware::perwrapper
Syntaxstruct MountPartitionInfo
{
string name;
uint32_t size;
uint32_t used;
uint32_t available;
string used_percent;
string mount_point;
};
Header file#include "midware/per_wrapper/per_wrapper_common_define.h"

3.5.2 Struct PartitionsCapacityInfo

Interface IDSWSD-STPR-WRAPPER-API-PART.CAP-002
ASILQM
NamePartitionsCapacityInfo
Kindstruct
Description表示分区容量查询信息,成员意义分别为:
string time_stamp; //查询时间,格式为"yyyy-MM-dd HH:mm:ss"
vector<MountPartitionInfo> mounted_partitions; // 已挂载分区容量信息实体
Symbolmidware::perwrapper::PartitionsCapacityInfo
Scopemidware::perwrapper
Syntaxstruct PartitionsCapacityInfo
{
string time_stamp;
vector&ltMountPartitionInfo> mounted_partitions;
};
Header file#include "midware/per_wrapper/per_wrapper_common_define.h"

4 API

4.1 Key-Value Storage

4.1.1 Function OpenKeyValueStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-KVS-002
ASILQM
NameOpenKeyValueStorageWrapper
Kindfunction
Description打开键值数据库,返回键值存储类的实例。
Symbolmidware::perwrapper::OpenKeyValueStorageWrapper(ara::core::StringView kvs)
Scopemidware::perwrapper
Visibilitypublic
Syntaxara::core::Result<ara::per::SharedHandle<KeyValueStorageWrapper> > OpenKeyValueStorageWrapper(const ara::core::StringView &kvs);
Parameters (in)kvs由PersistencyKeyValueDatabaseInterface输入的PortPrototype的短名称路径。
Return valueara::core::Result<ara::per::SharedHandle <KeyValueStorageWrapper> >包含SharedHandle的结果,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynone
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/kvs_wrapper.h"
Note示例:Port路径为 /NeuSAR/<应用名称>/<PortKey名称>,如OpenKeyValueStorageWrapper("/NeuSAR/AppPersistencyDemo/PortKey1")

4.1.2 Class KeyValueStorageWrapper methods

4.1.2.1 KeyValueStorageWrapper::KeyValueStorageWrapper(&&)

Interface IDSWSD-STPR-WRAPPER-API-KVS-003
ASILQM
NameKeyValueStorageWrapper::KeyValueStorageWrapper
Kindfunction
Description移动语义构造函数。
Symbolmidware::perwrapper::KeyValueStorageWrapper::KeyValueStorageWrapper(KeyValueStorageWrapper &&kvs)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
SyntaxKeyValueStorageWrapper(KeyValueStorageWrapper &&kvs) noexcept;
Parameters (inout)kvs要移动的KeyValueStorageWrapper对象
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.2 KeyValueStorageWrapper::KeyValueStorageWrapper(&)

Interface IDSWSD-STPR-WRAPPER-API-KVS-004
ASILQM
NameKeyValueStorageWrapper::KeyValueStorageWrapper
Kindfunction
Symbolmidware::perwrapper::KeyValueStorageWrapper::KeyValueStorageWrapper(KeyValueStoragev &kvs)
Visibilitydelete
Scopeclass midware::perwrapper::KeyValueStorageWrapper
SyntaxKeyValueStorageWrapper(const KeyValueStorageWrapper &)=delete;
Header file#include "midware/perwrapper/kvs_wrapper.h"
Description拷贝构造函数,禁用。
Note

4.1.2.3 KeyValueStorageWrapper::operator=(&&)

Interface IDSWSD-STPR-WRAPPER-API-KVS-005
ASILQM
NameKeyValueStorageWrapper::operator=
Kindfunction
Description移动语义赋值运算符。
Symbolmidware::perwrapper::KeyValueStorageWrapper::operator=(KeyValueStorageWrapper &&kvs)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
SyntaxKeyValueStorageWrapper& operator=(KeyValueStorageWrapper &&kvs) noexcept;
Parameters (inout)kvs要移动的KeyValueStorageWrapper对象
Return valueKeyValueStorageWrapper &移动后的KeyValueStorageWrapper对象
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.4 KeyValueStorageWrapper::operator=(&)

Interface IDSWSD-STPR-WRAPPER-API-KVS-006
ASILQM
NameKeyValueStorageWrapper::operator=
Kindfunction
Description拷贝赋值运算符,禁用。
Symbolmidware::perwrapper::KeyValueStorageWrapper::operator=(const KeyValueStorageWrapper &)
Visibilitydelete
Scopeclass midware::perwrapper::KeyValueStorageWrapper
SyntaxKeyValueStorageWrapper& operator=(const KeyValueStorage &)=delete;
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.5 KeyValueStorageWrapper::~KeyValueStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-KVS-007
ASILQM
NameKeyValueStorageWrapper::~KeyValueStorageWrapper
Kindfunction
Description析构函数。
Symbolmidware::perwrapper::KeyValueStorageWrapper::~KeyValueStorageWrapper()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntax~KeyValueStorageWrapper() noexcept;
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.6 KeyValueStorageWrapper::GetAllKeys

Interface IDSWSD-STPR-WRAPPER-API-KVS-008
ASILQM
NameKeyValueStorageWrapper::GetAllKeys
Kindfunction
Description获取当前键值库中全部可用的键。
Symbolmidware::perwrapper::KeyValueStorageWrapper::GetAllKeys()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<ara::core::Vector<ara::core::String> > GetAllKeys() const noexcept;
Return valueara::core::Result< ara::core::Vector< ara::core::String > >结果,包含可用键的列表,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.7 KeyValueStorageWrapper::HasKey

Interface IDSWSD-STPR-WRAPPER-API-KVS-009
ASILQM
NameKeyValueStorageWrapper::HasKey
Kindfunction
Description校验键值库中是否存在指定的键。
Symbolmidware::perwrapper::KeyValueStorageWrapper::HasKey(ara::core::StringView key)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<bool> HasKey(ara::core::StringView key) const noexcept;
Parameters (in)key要检查的key
Return valueara::core::Result< bool >结果,如果可以找到键,则包含true;如果不能,则包含false,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.8 KeyValueStorageWrapper::GetValue

Interface IDSWSD-STPR-WRAPPER-API-KVS-010
ASILQM
NameKeyValueStorageWrapper::GetValue
Kindfunction
Description返回键值库中指定键的值,模版类型T仅支持上位机支持的类型。
Symbolmidware::perwrapper::KeyValueStorageWrapper::GetValue(ara::core::StringView key)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxtemplate <class T> ara::core::Result<T> GetValue(ara::core::StringView key) const noexcept;
Template param:T检索值的类型
Parameters (in)key查找的key
Return valueara::core::Result< T >结果,检索到的值,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.9 KeyValueStorageWrapper::SetValue

Interface IDSWSD-STPR-WRAPPER-API-KVS-011
ASILQM
NameKeyValueStorageWrapper::SetValue
Kindfunction
Description为键值库的一个键设置值,如果指定键的值已经存在,则覆盖;可以使用与老值不同类型的新值覆盖老的值。值的类型仅支持上位机配置的类型。
Symbolmidware::perwrapper::KeyValueStorageWrapper::SetValue(ara::core::StringView key, const T &value)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxtemplate <class T> ara::core::Result<void> SetValue(ara::core::StringView key, const T &value) noexcept;
Template param:T值的类型
Parameters (in)key
value
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note如果当前策略为立即存储,则使用SyncToStorage将键值库刷写到磁盘。

4.1.2.10 KeyValueStorageWrapper::RemoveKey

Interface IDSWSD-STPR-WRAPPER-API-KVS-012
ASILQM
NameKeyValueStorageWrapper::RemoveKey
Kindfunction
Description从键值库中删除指定的键和对应的值。
Symbolmidware::perwrapper::KeyValueStorageWrapper::RemoveKey(ara::core::StringView key)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<void> RemoveKey(ara::core::StringView key) noexcept;
Parameters (in)key要删除的键
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note如果当前策略为立即存储,则使用SyncToStorage将键值库刷写到磁盘。

4.1.2.11 KeyValueStorageWrapper::RemoveAllKeys

Interface IDSWSD-STPR-WRAPPER-API-KVS-013
ASILQM
NameKeyValueStorageWrapper::RemoveAllKeys
Kindfunction
Description删除键值库中所有的键及关联的值。
Symbolmidware::perwrapper::KeyValueStorageWrapper::RemoveAllKeys()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<void> RemoveAllKeys() noexcept;
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note如果当前策略为立即存储,则使用SyncToStorage将键值库刷写到磁盘。

4.1.2.12 KeyValueStorageWrapper::SyncToStorage

Interface IDSWSD-STPR-WRAPPER-API-KVS-014
ASILQM
NameKeyValueStorageWrapper::SyncToStorage
Kindfunction
Description将键值库的更新刷新到物理存储。
Symbolmidware::perwrapper::KeyValueStorageWrapper::SyncToStorage()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<void> SyncToStorage() const noexcept;
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note如果未设置存储策略,则在调用SetValue、RemoveKey、RemoveAllKeys后,需要应用调用当前方法,否则掉电后不会将修改存储到磁盘,导致对键值库的修改丢失。

4.1.2.13 KeyValueStorageWrapper::DiscardPendingChanges

Interface IDSWSD-STPR-WRAPPER-API-KVS-015
ASILQM
NameKeyValueStorageWrapper::DiscardPendingChanges
Kindfunction
Description删除所有从上次用OpenKeyValueStorageWrapper()打开还未调用SyncToStorage()的修改。
Symbolmidware::perwrapper::KeyValueStorageWrapper::DiscardPendingChanges()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<void> DiscardPendingChanges() noexcept;
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/kvs_wrapper.h"
Note

4.1.2.14 KeyValueStorageWrapper::SetStrategy

Interface IDSWSD-STPR-WRAPPER-API-KVS-016
ASILQM
NameKeyValueStorageWrapper::SetStrategy
Kindfunction
Description为键值库设置存储策略,默认无策略,可为组合策略,如 S_CYCLE | S_CLOSED,含义是周期存储且下电存储
Symbolmidware::perwrapper::KeyValueStorageWrapper::SetStrategy(uint8_t strategy, uint32_t interval = 0)
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageWrapper
Syntaxara::core::Result<void> SetStrategy(uint8_t strategy, uint32_t interval = 0) noexcept = 0
Parameters (in)strategy存储策略 无策略(默认):S_NONE 立即存储:S_IMMEDIATELY 周期存储:S_CYCLE 下点存储:S_CLOSED
interval时间间隔:存储策略为周期存储时有效,必须指定大于0的值; 单位:毫秒
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/kvs_wrapper.h"
Note

4.2 Key-Value Storage Proxy

4.2.1 Function OpenKeyValueStorageProxy

Interface IDSWSD-STPR-WRAPPER-API- KV.PROXY-002
ASILQM
NameOpenKeyValueStorageProxy
Kindfunction
Description打开代理键值数据库,返回键值存储类的实例。
Symbolmidware::perwrapper::OpenKeyValueStorageProxy(const ara::core::StringView &kvs)
Visibilitypublic
Scopemidware::perwrapper
Syntaxara::core::Result<ara::per::SharedHandle<KeyValueStorageProxy>> OpenKeyValueStorageProxy(const ara::core::StringView &kvs) noexcept
Parameters (in)kvs分两种情况: A核应用核内共享时为守护进程中配置的键值库路径。 用于A核访问M核数据时,没有实际意义,可以为空。
Return valueara::core::Result< SharedHandle<Key ValueStorageProxy>>包含SharedHandle的结果,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/key_value_storage_proxy.h"
Note

4.2.2 Class KeyValueStorageProxy methods

4.2.2.1 KeyValueStorageProxy::ReadData

Interface IDSWSD-STPR-WRAPPER-API- KV.PROXY-003
ASILQM
NameKeyValueStorageProxy::ReadData
Kindfunction
DescriptionA核核内数据共享,获取共享键值库中指定键对应的值。
Symbolmidware::perwrapper::KeyValueStorageProxy::ReadData()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageProxy
Syntaxara::core::Result<ara::core::Vector<uint8_t>> ReadData(ara::core::String key, uint32_t timeout = 100) noexcept = 0
Parameters(in)key查找的key
timeout超时时间,单位毫秒,默认为100毫秒,s32g主板上建议设置为100毫秒或以上
Return valueara::core::Vector<uint8_t >检索的值
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/key_value_storage_proxy.h"
Note建议超时时间根据情况设置,因为涉及到和守护进程socket通信,如果时间设置过短,有可能返回错误。

4.2.2.2 KeyValueStorageProxy::WriteData

Interface IDSWSD-STPR-WRAPPER-API- KV.PROXY-004
ASILQM
NameKeyValueStorageProxy::WriteData
Kindfunction
DescriptionA核核内数据共享,为共享键值库的一个键设置值,如果指定键的值已经存在,则覆盖。
Symbolmidware::perwrapper::KeyValueStorageProxy::WriteData()
Visibilitypublic
Scopeclass midware::perwrapper::KeyValueStorageProxy
Syntaxara::core::Result<void> WriteData(ara::core::String key, ara::core::Vector<uint8_t>& val, uint32_t timeout = 100) noexcept = 0;
Parameters(in)key
val
timeout超时时间,单位毫秒,默认为100毫秒,s32g主板上建议设置为100毫秒或以上
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/key_value_storage_proxy.h"
Note建议超时时间根据情况设置,因为涉及到和守护进程socket通信,如果时间设置过短,有可能返回错误但是守护进程实际上写入成功的情况。

4.3 File Storage

4.3.1 Function OpenFileStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-FS-004
ASILQM
NameOpenFileStorageWrapper
Kindfunction
Description打开文件数据库,返回文件存储类的实例。
Symbolmidware::perwrapper::OpenFileStorageWrapper(const ara::core::StringView &fs)
Visibilitypublic
Scopemidware::perwrapper
Syntaxara::core::Result<ara::per::SharedHandle<FileStorageWrapper> > OpenFileStorageWrapper(const ara::core::StringView &fs)
Parameters (in)fs文件存储的Port路径
Return valueara::core::Result <ara::per::SharedHandle < FileStorageWrapper >>包含SharedHandle的结果,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynone
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note示例:Port路径为 /NeuSAR/<应用名称>/<PortKey名称>, OpenFileStorageWrapper("/NeuSAR/AppPersistencyDemo/PortFS1")

4.3.2 Class FileStorageWrapper methods

4.3.2.1 FileStorageWrapper::FileStorageWrapper(&&)

Interface IDSWSD-STPR-WRAPPER-API-FS-005
ASILQM
NameFileStorageWrapper::FileStorageWrapper
Kindfunction
Description移动语义构造函数。
Symbolmidware::perwrapper::FileStorageWrapper::FileStorageWrapper(FileStorageWrapper &&fs)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
SyntaxFileStorageWrapper(FileStorageWrapper &&fs) noexcept;
Parameters (inout)fs要移动的FileStorageWrapper对象
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.2 FileStorageWrapper::FileStorageWrapper(&)

Interface IDSWSD-STPR-WRAPPER-API-FS-006
ASILQM
NameFileStorageWrapper::FileStorageWrapper
Kindfunction
Description拷贝构造函数,禁用。
Symbolmidware::perwrapper::FileStorageWrapper::FileStorageWrapper(const FileStorageWrapper &)
Visibilitydelete
Scopeclass midware::perwrapper::FileStorageWrapper
SyntaxFileStorageWrapper(const FileStorageWrapper &)=delete;
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.3 FileStorageWrapper::operator=(&&)

Interface IDSWSD-STPR-WRAPPER-API-FS-007
ASILQM
NameFileStorageWrapper::operator=
Kindfunction
Description移动语义赋值运算符。
Symbolmidware::perwrapper::FileStorageWrapper::operator=(FileStorageWrapper &&fs)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
SyntaxFileStorageWrapper& operator=(FileStorageWrapper &&fs) noexcept;
Parameters (inout)fs要移动的FileStorageWrapper对象
Return valueFileStorageWrapper &移动后的FileStorageWrapper对象
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.4 FileStorageWrapper::operator=(&)

Interface IDSWSD-STPR-WRAPPER-API-FS-008
ASILQM
NameFileStorageWrapper::operator=
Kindfunction
Description拷贝赋值运算符,禁用。
Symbolmidware::perwrapper::FileStorageWrapper::operator=(const FileStorageWrapper &)
Visibilitydelete
Scopeclass midware::perwrapper::FileStorageWrapper
SyntaxFileStorageWrapper& operator=(const FileStorageWrapper &)=delete;
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.5 FileStorageWrapper::~FileStorageWrapper

Interface IDSWSD-STPR-WRAPPER-API-FS-009
ASILQM
NameFileStorageWrapper::~FileStorageWrapper
Kindfunction
Description析构函数。
Symbolmidware::perwrapper::FileStorageWrapper::~FileStorageWrapper()
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntax~FileStorageWrapper() noexcept;
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.6 FileStorageWrapper::GetAllFileNames

Interface IDSWSD-STPR-WRAPPER-API-FS-010
ASILQM
NameFileStorageWrapper::GetAllFileNames
Kindfunction
Description返回文件存储库中可用的文件列表。
Symbolmidware::perwrapper::FileStorageWrapper::GetAllFileNames()
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<ara::core::Vector<ara::core::String> > GetAllFileNames() const noexcept;
Return valueara::core::Result< ara::core::Vector< ara::core::String > >结果,包含可用文件列表,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.7 FileStorageWrapper::DeleteFile

Interface IDSWSD-STPR-WRAPPER-API-FS-011
ASILQM
NameFileStorageWrapper::DeleteFile
Kindfunction
Description从该文件存储中删除指定的文件。 当文件当前打开时,该操作将失败,并带有kResourceBusyError。
Symbolmidware::perwrapper::FileStorageWrapper::DeleteFile(ara::core::StringView fileName)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<void> DeleteFile(ara::core::StringView fileName) noexcept;
Parameters (in)file文件名
Return valueara::core::Result< void >结果,为空或为PerErrc中的定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.8 FileStorageWrapper::FileExists

Interface IDSWSD-STPR-WRAPPER-API-FS-012
ASILQM
NameFileStorageWrapper::FileExists
Kindfunction
Description查询文件存储中是否有指定的文件存在。
Symbolmidware::perwrapper::FileStorageWrapper::FileExists(ara::core::StringView fileName)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<bool> FileExists(ara::core::StringView fileName) const noexcept;
Parameters (in)file文件名
Return valueara::core::Result< bool >一个结果,如果文件存在,则包含true,如果不存在,则包含false,或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.9 FileStorageWrapper::GetCurrentFileSize

Interface IDSWSD-STPR-WRAPPER-API-FS-013
ASILQM
NameFileStorageWrapper::GetCurrentFileSize
Kindfunction
Description返回File Storage中一个文件占用的字节空间。.
Symbolmidware::perwrapper::FileStorageWrapper::GetCurrentFileSize(ara::core::StringView fileName)
Scopeclass midware::perwrapper::FileStorageWrapper
Visibilitypublic
Syntaxara::core::Result<uint64_t> GetCurrentFileSize(ara::core::StringView fileName) noexcept
Parameters (in)fileName需要查询大小的文件名。
Return valueara::core::Result< uint64_t >返回占用的空间或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.10 FileStorageWrapper::OpenFileReadWrite(fileName)

Interface IDSWSD-STPR-WRAPPER-API-FS-014
ASILQM
NameFileStorageWrapper::OpenFileReadWrite
Kindfunction
Description在文件存储中以可读可写方式打开一个文件。
Symbolmidware::perwrapper::FileStorageWrapper::OpenFileReadWrite(ara::core::StringView fileName)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadWriteAccessor> > OpenFileReadWrite (ara::core::StringView fileName) noexcept;
Parameters (in)fileName文件名
Return valueara::core::Result< UniqueHandle< ReadWriteAccessor > >一个结果,包含一个UniqueHandle,或为PerErrc中定义一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.11 FileStorageWrapper::OpenFileReadWrite(fileName, mode)

Interface IDSWSD-STPR-WRAPPER-API-FS-015
ASILQM
NameFileStorageWrapper::OpenFileReadWrite
Kindfunction
Description在文件存储中以可读可写方式打开一个文件。 此接口为“非标”接口。(参数和标准不一样)
Symbolmidware::perwrapper::FileStorageWrapper::OpenFileReadWrite(ara::core::StringView fileName, BasicOperations::OpenMode const mode)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadWriteAccessor> > OpenFileReadWrite(ara::core::StringView fileName, BasicOperations::OpenMode const mode) noexcept;
Parameters (in)fileName文件名
mode文件打开的模式
Return valueara::core::Result< UniqueHandle< ReadWriteAccessor > >一个结果,包含一个UniqueHandle,或为PerErrc中定义的一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.12 FileStorageWrapper::OpenFileReadOnly(fileName)

Interface IDSWSD-STPR-WRAPPER-API-FS-016
ASILQM
NameFileStorageWrapper::OpenFileReadOnly
Kindfunction
Description在文件存储中以只读方式打开一个文件。
Symbolmidware::perwrapper::FileStorageWrapper::OpenFileReadOnly(ara::core::StringView fileName)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadAccessor> > OpenFileReadOnly(ara::core::StringView fileName) noexcept;
Parameters (in)fileName文件名
Return valueara::core::Result< UniqueHandle< ReadAccessor > >一个结果,包含一个UniqueHandle,或为PerErrc中的持久性定义的一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.13 FileStorageWrapper::OpenFileReadOnly(fileName, mode)

Interface IDSWSD-STPR-WRAPPER-API-FS-017
ASILQM
NameFileStorageWrapper::OpenFileReadOnly
Kindfunction
Description在文件存储中以只读方式打开一个文件。 此接口为“非标”接口。(参数和标准不一样)
Symbolmidware::perwrapper::FileStorageWrapper::OpenFileReadOnly(ara::core::StringView fileName, BasicOperations::OpenMode const mode)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadAccessor> > OpenFileReadOnly(ara::core::StringView fileName, BasicOperations::OpenMode const mode) noexcept;
Parameters (in)fileName文件名
mode文件打开的模式
Return valueara::core::Result< UniqueHandle< ReadAccessor > >一个结果,包含一个UniqueHandle,或为PerErrc中的持久性定义的一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.14 FileStorageWrapper::OpenFileWriteOnly(fileName)

Interface IDSWSD-STPR-WRAPPER-API-FS-018
ASILQM
NameFileStorageWrapper::OpenFileWriteOnly
Kindfunction
Description在文件存储中以只写方式打开一个文件。
Symbolmidware::perwrapper::FileStorageWrapper::OpenFileWriteOnly(ara::core::StringView fileName)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadWriteAccessor> > OpenFileWriteOnly (ara::core::StringView fileName) noexcept;
Parameters (in)fileName文件名
Return valueara::core::Result<UniqueHandle<ReadWriteAccessor> >一个结果,包含一个UniqueHandle,或为PerErrc中的持久性定义的一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.2.15 FileStorageWrapper::OpenFileWriteOnly(fileName, mode)

Interface IDSWSD-STPR-WRAPPER-API-FS-019
ASILQM
NameFileStorageWrapper::OpenFileWriteOnly
Kindfunction
Description在文件存储中以只写方式打开一个文件。 此接口为“非标”接口。(参数和标准不一样)
Symbolmidware::perwrapper:FileStorageWrapper::OpenFileWriteOnly(ara::core::StringView fileName, Basic Operations::OpenMode const mode)
Visibilitypublic
Scopeclass midware::perwrapper::FileStorageWrapper
Syntaxara::core::Result<UniqueHandle<ReadWriteAccessor> > OpenFileWriteOnly(ara::core::StringView fileName, BasicOperations::OpenMode const mode) noexcept;
Parameters (in)fileName文件名
mode文件打开的模式
Return valueara::core::Result<UniqueHandle<ReadWriteAccessor> >一个结果,包含一个UniqueHandle,或为PerErrc中的持久性定义的一个错误,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/perwrapper/file_storage_wrapper.h"
Note

4.3.3 Class ReadAccessorWrapper methods

4.3.3.1 ReadAccessorWrapper::Peek

Interface IDSWSD-STPR-WRAPPER-API-FS-020
ASILQM
NameReadAccessorwrapper::Peek
Kindfunction
Description返回文件中当前位置的一个字符,不推进文件位置。
Symbolmidware::perwrapper::ReadAccessorwrapper::Peek()
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<char> Peek() noexcept override;
Return valueara::core::Result<char>当前位置的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.2 ReadAccessorWrapper::Get

Interface IDSWSD-STPR-WRAPPER-API-FS-021
ASILQM
NameReadAccessorwrapper::Get
Kindfunction
Description返回文件中当前位置的字符,向前推进当前位置。
Symbolmidware::perwrapper::ReadAccessorWrapper::Get()
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<char> Get() noexcept override
Return valueara::core::Result<char>当前位置的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.3 ReadAccessorWrapper::ReadText

Interface IDSWSD-STPR-WRAPPER-API-FS-022
ASILQM
NameReadAccessorwrapper::ReadText
Kindfunction
Description从当前的偏移读到末尾,作为字符串返回。
Symbolmidware::perwrapper::ReadAccessorWrapper::ReadText()
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<ara::core::String> ReadText() noexcept override;
Parameters (out)none
Return valueara::core::String存储读取的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.4 ReadAccessorWrapper::ReadText(len)

Interface IDSWSD-STPR-WRAPPER-API-FS-023
ASILQM
NameReadAccessorwrapper::ReadText
Kindfunction
Description从当前的偏移读取最多len个字节的内容,按字符串返回。
Symbolmidware::perwrapper::ReadAccessorWrapper::ReadText(uint64_t len)
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<ara::core::String> ReadText(uint64_t len) noexcept override
Parameters (out)Len需要读取的长度
Return valueara::core::String存储读取的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.5 ReadAccessorWrapper::ReadBytes

Interface IDSWSD-STPR-WRAPPER-API-FS-024
ASILQM
NameReadAccessorwrapper::ReadBytes
Kindfunction
Description从当前的偏移读取到末尾,按字节流返回。
Symbolmidware::perwrapper::ReadAccessorWrapper::ReadBytes()
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result< ara::core::Vector<char>> ReadBytes() noexcept override;
Parameters (out)
Return valueara::core::Vector<char>存储读取的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.6 ReadAccessorWrapper::ReadBytes(len)

Interface IDSWSD-STPR-WRAPPER-API-FS-025
ASILQM
NameReadAccessorwrapper::ReadBytes
Kindfunction
Description从当前的偏移读取最多len字节数据,按字节流返回。
Symbolmidware::perwrapper::ReadAccessorWrapper::ReadBytes(uint64_t len)
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<ara::core::Vector<char>> ReadBytes(uint64_t len) noexcept override
Parameters (out)len需要读取的长度
Return valueara::core::Vector<char>存储读取的字符
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.7 ReadAccessorWrapper::ReadLine

Interface IDSWSD-STPR-WRAPPER-API-FS-026
ASILQM
NameReadAccessorwrapper::ReadLine
Kindfunction
Description读取一行数据,并按字符串返回。
Symbolmidware::perwrapper::ReadAccessorWrapper::ReadLine(char const delim = '/n')
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<ara::core::String> ReadLine(char const delim = '/n') noexcept override
Parameters (in)delim行间的分隔字符
Return valueara::core::String读取的字符存储的变量
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.8 ReadAccessorWrapper::GetPosition

Interface IDSWSD-STPR-WRAPPER-API-FS-027
ASILQM
NameReadAccessorwrapper::GetPosition
Kindfunction
Description返回相对于文件开头的位置(字节偏移)。
Symbolmidware::perwrapper::ReadAccessorWrapper::GetPosition
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxuint64_t GetPosition() noexcept override
Return valueuint64_t文件的当前位置,以字节为单位
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.9 ReadAccessorWrapper::Seek(offset)

Interface IDSWSD-STPR-WRAPPER-API-FS-028
ASILQM
NameReadAccessorwrapper::Seek
Kindfunction
Description设置相对于文件开头的当前位置。 此接口为“非标”接口。(参数和标准不一样)
Symbolmidware::perwrapper::ReadAccessorWrapper::Seek(uint64_t offset)
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<void> Seek(uint64_t offset) noexcept override
Parameters (in)offset距离文件当前位置,以字节为单位
Return valueara::core::Result<void>结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.10 ReadAccessorWrapper::Seek(offset, origin)

Interface IDSWSD-STPR-WRAPPER-API-FS-029
ASILQM
NameReadAccessorwrapper::Seek
Kindfunction
Description根据方向设置文件中的当前位置。 此接口为“非标”接口。(参数和标准不一样)
Symbolmidware::perwrapper::ReadAccessorWrapper::Seek(uint64_t offset,ara::per::BasicOperations::SeekDirection const origin)
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxara::core::Result<void> Seek(uint64_t offset, ara::per::BasicOperations::SeekDirection const origin) noexcept override
Parameters (in)offsetSeek的偏移量
originSeek的方向
Return valueara::core::Result<void>结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.3.11 ReadAccessorWrapper::IsEof

Interface IDSWSD-STPR-WRAPPER-API-FS-030
ASILQM
NameReadAccessorwrapper::IsEof
Kindfunction
Description检查是否到达文件末尾。
Symbolmidware::perwrapper::ReadAccessorWrapper::IsEof()
Visibilitypublic
Scopeclass midware::perwrapper::ReadAccessorWrapper
Syntaxbool IsEof() noexcept override;
Return valuebool如果到达文件末尾,则为True,否则为false。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_accessor_wrapper.h"
Note

4.3.4 Class ReadWriteAccessorWrapper methods

4.3.4.1 ReadWriteAccessorWrapper::SetStrategy

Interface IDSWSD-STPR-WRAPPER-API-FS-031
ASILQM
NameReadWriteAccessorWrapper::SetStrategy
Kindfunction
Description为单个文件设置存储策略,默认无策略,可为组合策略,如 S_CYCLE | S_CLOSED,含义是周期存储且下电存储
Symbolmidware::perwrapper::ReadWriteAccessorWrapper::SetStrategy(uint8_t strategy, uint32_t interval = 0)
Visibilitypublic
Scopeclass midware::perwrapper::ReadWriteAccessorWrapper
Syntaxara::core::Result<void> SetStrategy(uint8_t strategy, uint32_t interval = 0) noexcept = 0
Parameters (in)strategy存储策略 无策略(默认):S_NONE 立即存储:S_IMMEDIATELY 周期存储:S_CYCLE 下点存储:S_CLOSED
interval时间间隔:存储策略为周期存储时有效,必须指定大于0的值; 单位:毫秒
Return valueara::core::Result< void >结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note

4.3.4.2 ReadWriteAccessorWrapper::SyncToFile

Interface IDSWSD-STPR-WRAPPER-API-FS-032
ASILQM
NameReadWriteAccessorWrapper::SyncToFile
Kindfunction
Description先调用flush并强制写缓存区到文件的持久存储中。
Symbolmidware::perwrapper::ReadWriteAccessorWrapper::SyncToFile()
Visibilitypublic
Scopeclass midware::perwrapper::ReadWriteAccessorWrapper
Syntaxara::core::Result<void> SyncToFile() noexcept override
Return valueara::core::Result< void >结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note如果未设置存储策略,则在调用Write的操作后,需要应用调用当前方法,否则掉电后不会将修改存储到磁盘,导致对文件的修改丢失。

4.3.4.3 ReadWriteAccessorWrapper::WriteBytes

Interface IDSWSD-STPR-WRAPPER-API-FS-033
ASILQM
NameReadWriteAccessorWrapper::WriteBytes
Kindfunction
Description写入字节流到文件当前位置
Symbolmidware::perwrapper::ReadWriteAccessorWrapper::WriteBytes(ara::core::Vector<char> s)
Visibilitypublic
Scopeclass midware::perwrapper::ReadWriteAccessorWrapper
Syntaxara::core::Result<void> WriteBytes(ara::core::Vector<char> s) noexcept override
Parameters (in)sWrite的字节流
Return valueara::core::Result< void >结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note

4.3.4.4 ReadWriteAccessorWrapper::WriteText

Interface IDSWSD-STPR-WRAPPER-API-FS-034
ASILQM
NameReadWriteAccessorWrapper::WriteText
Kindfunction
Description写入文本到文件当前位置
Symbolmidware::perwrapper::ReadWriteAccessorWrapper::WriteText(ara::core::StringView string)
Visibilitypublic
Scopeclass midware::perwrapper::ReadWriteAccessorWrapper
Syntaxara::core::Result<void> WriteText(ara::core::StringView string) noexcept override
Parameters (in)stringWrite的字符串
Return valueara::core::Result< void >结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note

4.3.4.5 ReadWriteAccessorWrapper::operator<<

Interface IDSWSD-STPR-WRAPPER-API-FS-035
ASILQM
NameReadWriteAccessorWrapper::operator<<
Kindfunction
Description写入文本到文件当前位置
Symbolmidware::perwrapper::ReadWriteAccessorWrapper::operator<<(ara::core::StringView string)
Visibilitypublic
Scopeclass midware::perwrapper::ReadWriteAccessorWrapper
Syntaxara::core::Result<void> operator<<(ara::core::StringView string) noexcept override
Parameters (in)stringWrite的字符串
Return valueara::core::Result< void >结果,要么为空,要么包含为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/read_write_accessor_wrapper.h"
Note

4.4 Compression & UnCompression

4.4.1 Function Compression

Interface IDSWSD-STPR-WRAPPER-API-COMPRESS-001
ASILQM
NameCompression
Kindfunction
Description压缩文件接口函数
Symbolmidware::perwrapper::Compression()
Visibilitypublic
Scopeara::per midware::perwrapper
Syntaxara::core::Result<void> Compression(ara::core::String path, ara::core::String pack = "");
Parameters (in)path待压缩文件路径名,可以是文件夹或文件
pack压缩包文件路径名,压缩完成后,会在结尾添加“.tar.gz”。如果pack为空字符串,则会将pack设置 为与path相同。
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/compress_method.h"
Notepath路径名可以为相对路径、绝对路径。 pack路径名可以为相对路径、绝对路径。 绝对路径需要确保属于当前应用的路径下,否则会无权限。

4.4.2 Function UnCompression

Interface IDSWSD-STPR-WRAPPER-API-COMPRESS-002
ASILQM
NameUnCompression
Kindfunction
Description解压文件接口函数
Symbolmidware::perwrapper::UnCompression()
Visibilitypublic
Scopeara::per midware::perwrapper
Syntaxara::core::Result<void> UnCompression(ara::core::String pack, ara::core::String path = "");
Parameters (in)pack待解压缩压缩包文件路径名,需要加上“.tar.gz”结尾,否则无法找到压缩文件
path解压缩目的目录名称,不存在会自动创建。如果path为空字符串,会设置为pack的父目录。
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/compress_method.h"
Notepath路径名可以为相对路径、绝对路径。 pack路径名可以为相对路径、绝对路径。 绝对路径需要确保属于当前应用的路径下,否则会无权限。

4.5 APP Storage Capacity

4.5.1 Class StorageCapacity methods

4.5.1.1 StorageCapacity::GetMaxCapacity

Interface IDSWSD-STPR-WRAPPER-API-APP.CAP-002
ASILQM
NameStorageCapacity::GetMaxCapacity
Kindfunction
Description获取应用的最大支持容量
Symbolmidware::perwrapper::StorageCapacity::GetMaxCapacity
Visibilitypublic
Scopeclass midware::perwrapper::StorageCapacity
Syntaxara::core::Result<void> GetMaxCapacity(uint64_t& capacity) noexcept;
Parameters (out)uint64_t&接收应用最大支持存储容量,单位KB
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/storage_capacity.h"
Note

4.5.1.2 StorageCapacity::SetMaxCapacity

Interface IDSWSD-STPR-WRAPPER-API-APP.CAP-003
ASILQM
NameStorageCapacity::SetMaxCapacity
Kindfunction
Description设置应用最大支持存储容量
Symbolmidware::perwrapper::StorageCapacity::SetMaxCapacity
Visibilitypublic
Scopeclass midware::perwrapper::StorageCapacity
Syntaxara::core::Result<void> SetMaxCapacity(const uint64_t capacity) noexcept;
Parameters (in)const uint64_t设置应用最大支持存储容量,单位KB
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyno
Header file#include "midware/per_wrapper/storage_capacity.h"
Note

4.5.1.3 StorageCapacity::GetUseCapacity

Interface IDSWSD-STPR-WRAPPER-API-APP.CAP-004
ASILQM
NameStorageCapacity::GetUseCapacity
Kindfunction
Description获取应用已使用存储容量
Symbolmidware::perwrapper::StorageCapacity::GetUseCapacity
Visibilitypublic
Scopeclass midware::perwrapper::StorageCapacity
Syntaxara::core::Result<void> GetUseCapacity(uint64_t& capacity) noexcept;
Parameters (out)uint64_t&接收应用已使用存储容量,单位KB
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/storage_capacity.h"
Note

4.5.1.4 StorageCapacity::GetRemainingCapacity

Interface IDSWSD-STPR-WRAPPER-API-APP.CAP-005
ASILQM
NameStorageCapacity::GetRemainingCapacity
Kindfunction
Description获取应用剩余可用存储容量
Symbolmidware::perwrapper::StorageCapacity::GetRemainingCapacity
Visibilitypublic
Scopeclass midware::perwrapper::StorageCapacity
Syntaxara::core::Result<void> GetRemainingCapacity(uint64_t& capacity) noexcept;
Parameters (out)uint64_t&获取应用剩余可用存储容量,单位KB
Return valueara::core::Result<void>结果,为空或为PerErrc中定义的错误之一,PerErrc参考文档《NeuSAR aCore_API文档_PER.docx》。
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/storage_capacity.h"
Note

4.6 Partition Capacity

4.6.1 PartitionCapacityWrapper class

4.6.1.1 PartitionCapacityWrapper::GetMountedPartitionsInfo

Interface IDSWSD-STPR-WRAPPER-API-PART.CAP-003
ASILQM
NamePartitionCapacityWrapper::GetMountedPartitionsInfo
Kindfunction
Description获取分区容量信息
Symbolstatic int PartitionCapacityWrapper::GetMountedPartitionsInfo(PartitionsCapacityInfo& partition_info);
Visibilitypublic
Scopestatic class midware::perwrapper::PartitionCapacityWrapper
Syntaxint GetMountedPartitionsInfo(PartitionsCapacityInfo& partition_info);
Parameters (in)PartitionsCapacityInfo &获取的分区容量信息
Return valueint结果,成功返回0,否则返回-1
Exception Safetynoexcept
Thread Safetyre-entrant
Header file#include "midware/per_wrapper/partition_capactity_wrapper.h"
Note

5 Service Interface

5.1 Provided Service Interface

5.1.1 Port

模块没有定义Port。

5.1.1.1 PortName

Interface ID
ASIL
Name
KindInterface
Description
Variation

5.1.2 Service Interface

5.1.2.1 InterfaceName

Interface ID
ASIL
Name
NameSpace

5.2 Required Service Interface

5.2.1 Port

模块没有定义Port。

5.2.1.1 PortName

Interface ID
ASIL
Name
KindInterface
Description
Variation

5.2.2 Service Interface

5.2.2.1 InterfaceName

Interface ID
ASIL
Name
NameSpace

6 接口变更履历

6.1 SW5.0到SW7.0的变更

SW5.0SW7.0含义
ara::core::Result<ara::core::Vector<char>> ReadData(ara::core::string key, uint32_t timeout = 10) noexcept = 0ara::core::Result<ara::core::Vector<uint8_t>> ReadData(ara::core::String key, uint32_t timeout = 10) noexcept = 0入参类型
ara::core::Result<void> WriteData(ara::core::string key, ara::core::Vector<char>& val, uint32_t timeout = 10)ara::core::Result<void> WriteData(ara::core::String key, ara::core::Vector<uint8_t>& val, uint32_t timeout = 10)入参类型
ara::core::Result<ara::core::Vector<char>> ReadBlock(short data_id, int timeout = 10)ara::core::Result<ara::core::Vector<uint8_t>> ReadBlock(uint16_t data_id, uint32_t timeout = 10)入参类型
ara::core::Result<void> WriteBlock(short data_id, ara::core::Vector<char>& val, int timeout = 10)ara::core::Result<void> WriteBlock(uint16_t data_id, ara::core::Vector<uint8_t>& val, uint32_t timeout = 10)入参类型
ara::core::Result<void> Compression(ara::core::String path, ara::core::String pack = "");ara::core::Result<void> Compression(ara::core::String path, ara::core::String pack = "");新增
ara::core::Result<void> UnCompression(ara::core::String pack, ara::core::String path = "");ara::core::Result<void> UnCompression(ara::core::String pack, ara::core::String path = "");新增
ara::core::Result<void> GetMaxCapacity(uint64_t& capacity) noexcept;新增
ara::core::Result<void> SetMaxCapacity(const uint64_t capacity) noexcept;新增
ara::core::Result<void> GetUseCapacity(uint64_t& capacity) noexcept;新增
ara::core::Result<void> GetRemainingCapacity(uint64_t& capacity) noexcept;新增

6.2 SW9.0到SW10.0的变更

SW9.0SW10.0含义
static int PartitionCapacityWrapper::GetMountedPartitionsInfo (PartitionsCapacityInfo& partition_info);新增

6.3 SW10.0到G3 1.0的变更

SW10.0G3 1.0含义
ara::core::Result&lt ara::core::Vector&ltuint8_t>> ReadBlock(uint16_t data_id, uint32_t timeout = 100) noexcept;删除
ara::core::Result&ltvoid> WriteBlock(uint16_t data_id, ara::core::Vector&ltuint8_t>& val, uint32_t timeout = 100) noexcept;删除

附录A 信息定义

TypeStructureComment
Interface IDSWSD-{子软件系统名称}-{模块组}-API-{模块名}-{流水号} {}中为可选项,根据项目实际需求进行定义 流水号:从001开始的三位自然数
ASILDescriptionComment
ASIL A根据S – Severity(严重度) E – Exposure(暴露度) C – Controllability(可控性) 排定功能安全等级。详细理解可以参考26262标准文件。如果有关于ASIL等级的特殊解释说明,请记录在此
ASIL B 
ASIL C 
ASIL D 
QM 
QM(A)从ASIL A到ASIL D 中拆分出来,拆分的标准,参考功能安全体系文件《功能安全需求分解指南_FS.pdf》 
QM(B) 
QM(C) 
QM(D) 
ASIL A(A) 
ASIL A(B) 
ASIL A(C) 
ASIL A(D) 
ASIL B(B) 
ASIL B(C) 
ASIL B(D) 
ASIL C(C) 
ASIL C(D) 
ASIL D(D)