mirror of
https://github.com/NohamR/knowledge-kit.git
synced 2026-05-25 04:17:17 +00:00
docs: Data uploader SDK Content
This commit is contained in:
@@ -121,7 +121,7 @@ _##keyName = [decoder decode##dataType##ForKey:NSStringFromSelector(@selector(ke
|
||||
// 初始化一份默认配置
|
||||
- (void)setDefaultConfigurationModel {
|
||||
PCTConfigurationModel *configurationModel = [[PCTConfigurationModel alloc] init];
|
||||
configurationModel.url = @"https://.com";
|
||||
configurationModel.url = @"https://***DomainName.com";
|
||||
configurationModel.isUpload = YES;
|
||||
configurationModel.isGather = YES;
|
||||
configurationModel.isUpdateClear = YES;
|
||||
@@ -1147,6 +1147,20 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||
@end
|
||||
```
|
||||
|
||||
上面有个地方需要注意下,因为经常需要根据类型来判读操作那个数据表,使用频次很高,所以写成内联函数的形式
|
||||
|
||||
```objective-c
|
||||
NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||
if (type == PCTLogTableTypeMeta) {
|
||||
return PCT_LOG_TABLE_META;
|
||||
}
|
||||
if (type == PCTLogTableTypePayload) {
|
||||
return PCT_LOG_TABLE_PAYLOAD;
|
||||
}
|
||||
return @"";
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 5. 数据存储流程
|
||||
@@ -1348,6 +1362,8 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||
|
||||
- 由于频率会比较高,所以需要做节流的逻辑
|
||||
|
||||
很多人会搞不清楚防抖和节流的区别。一言以蔽之:“函数防抖关注一定时间连续触发的事件只在最后执行一次,而函数节流侧重于一段时间内只执行一次”。此处不是本文重点,感兴趣的的可以查看[这篇文章](https://segmentfault.com/a/1190000018445196)
|
||||
|
||||
- 上报流程会首先判断(为了节约用户流量)
|
||||
|
||||
- 判断当前网络环境为 WI-FI 则实时上报
|
||||
@@ -1514,10 +1530,14 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||

|
||||
|
||||
也可以使用 [slather](https://github.com/SlatherOrg/slather)。在项目终端环境下新建 `.slather.yml` 配置文件,然后执行语句 `slather coverage -s --scheme prism-client-Example --workspace prism-client.xcworkspace prism-client.xcodeproj`。
|
||||
|
||||
关于质量保证的最基础、可靠的方案之一软件测试,在各个端都有一些需要注意的地方,还需要结合工程化,我会写专门的[文章](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.75.md)谈谈经验心得。
|
||||
|
||||
|
||||
|
||||
## 五、 接口设计
|
||||
## 五、 接口设计及核心实现
|
||||
|
||||
### 1. 接口设计
|
||||
|
||||
```objective-c
|
||||
@interface PrismClient : NSObject
|
||||
@@ -1596,7 +1616,11 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||
}
|
||||
```
|
||||
|
||||
真正处理逻辑的是 `PCTService` 类。这里贴一下代码,点击展开
|
||||
|
||||
|
||||
### 2. 核心实现
|
||||
|
||||
真正处理逻辑的是 `PCTService` 类。
|
||||
|
||||
```objective-c
|
||||
#define PCT_SAVED_FLOW @"PCT_SAVED_FLOW"
|
||||
@@ -1772,9 +1796,9 @@ NS_INLINE NSString *PCTGetTableNameFromType(PCTLogTableType type) {
|
||||
|
||||
// 基础配置
|
||||
- (void)setupConfig {
|
||||
_requestBaseUrl = @"https://common.***.com";
|
||||
_metaURL = @"prism/metrics/meta";
|
||||
_payloadURL = @"prism/metrics/detail";
|
||||
_requestBaseUrl = @"https://***DomainName.com";
|
||||
_metaURL = @"prism/***";
|
||||
_payloadURL = @"prism/***";
|
||||
}
|
||||
|
||||
- (void)executeHandlerWhenAppLaunched
|
||||
@@ -2479,6 +2503,8 @@ UT 是质量保证的一个方面,另一个就是 MR 机制。我们团队 MR
|
||||
|
||||
- [WAL](https://en.wikipedia.org/wiki/Write-ahead_logging)
|
||||
- [WCDB 的 WAL 模式和异步 Checkpoint](https://cloud.tencent.com/developer/article/1031030)
|
||||
- [sqlite vacuum](https://www.sqlite.org/lang_vacuum.html)
|
||||
- [彻底弄懂函数防抖和函数节流](https://segmentfault.com/a/1190000018445196)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user