docs: 微服务平台下基于 GraphQL 构建 BFF 的思考changeLog

This commit is contained in:
LiuBinPeng
2021-11-29 09:50:54 +08:00
parent 6ec45450a2
commit 2c4b8c577c
40 changed files with 1175 additions and 30 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -263,8 +263,8 @@ typedef CF_OPTIONS(CFOptionFlags, CFRunLoopActivity) {
kCFRunLoopBeforeTimers , // 触发 Timer 回调
kCFRunLoopBeforeSources , // 触发 Source0 回调
kCFRunLoopBeforeWaiting , // 等待 mach_port 消息
kCFRunLoopAfterWaiting ), // 接收 mach_port 消息
kCFRunLoopExit , // 退出 loop
kCFRunLoopAfterWaiting, // 接收 mach_port 消息
kCFRunLoopExit, // 退出 loop
kCFRunLoopAllActivities // loop 所有状态改变
}
```
@@ -2678,24 +2678,24 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
```objective-c
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// 为 NSURLConnection、NSURLSession、CFNetwork 代理设置代理转发
@interface NetworkDelegateProxy : NSProxy
+ (instancetype)setProxyForObject:(id)originalTarget withNewDelegate:(id)newDelegate;
@end
NS_ASSUME_NONNULL_END
// .m
@interface NetworkDelegateProxy () {
id _originalTarget;
id _NewDelegate;
}
@end
```
@@ -2797,7 +2797,7 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
```objective-c
// NSURLConnection+Monitor.m
@implementation NSURLConnection (Monitor)
+ (void)load
{
static dispatch_once_t onceToken;
@@ -2807,7 +2807,7 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
}
});
}
- (_Nonnull instancetype)apm_initWithRequest:(NSURLRequest *)request delegate:(nullable id)delegate
{
/*
@@ -2823,23 +2823,23 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
return [self apm_initWithRequest:rq delegate:delegate];
} else {
[rq setValue:traceId forHTTPHeaderField:@"head_key_traceid"];
NSURLSessionAndConnectionImplementor *mockDelegate = [NSURLSessionAndConnectionImplementor new];
[self registerDelegateMethod:@"connection:didFailWithError:" originalDelegate:delegate newDelegate:mockDelegate flag:"v@:@@"];
[self registerDelegateMethod:@"connection:didReceiveResponse:" originalDelegate:delegate newDelegate:mockDelegate flag:"v@:@@"];
[self registerDelegateMethod:@"connection:didReceiveData:" originalDelegate:delegate newDelegate:mockDelegate flag:"v@:@@"];
[self registerDelegateMethod:@"connection:didFailWithError:" originalDelegate:delegate newDelegate:mockDelegate flag:"v@:@@"];
[self registerDelegateMethod:@"connectionDidFinishLoading:" originalDelegate:delegate newDelegate:mockDelegate flag:"v@:@"];
[self registerDelegateMethod:@"connection:willSendRequest:redirectResponse:" originalDelegate:delegate newDelegate:mockDelegate flag:"@@:@@"];
delegate = [NetworkDelegateProxy setProxyForObject:delegate withNewDelegate:mockDelegate];
// 调用 hook 之前的初始化方法,返回 NSURLConnection
return [self apm_initWithRequest:rq delegate:delegate];
}
}
- (void)registerDelegateMethod:(NSString *)methodName originalDelegate:(id<NSURLConnectionDelegate>)originalDelegate newDelegate:(NSURLSessionAndConnectionImplementor *)newDelegate flag:(const char *)flag
{
if ([originalDelegate respondsToSelector:NSSelectorFromString(methodName)]) {
@@ -2853,7 +2853,7 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
class_addMethod([originalDelegate class], NSSelectorFromString(methodName), class_getMethodImplementation([newDelegate class], NSSelectorFromString(methodName)), flag);
}
}
@end
```
@@ -2897,10 +2897,10 @@ CFNetwork 使用 CFReadStreamRef 来传递数据,使用回调函数的形式
struct objc_object {
Class _Nonnull isa OBJC_ISA_AVAILABILITY;
};
/// A pointer to an instance of a class.
typedef struct objc_object *id;
```
![isa swizzling](https://raw.githubusercontent.com/FantasticLBP/knowledge-kit/master/assets/2020-04-13-isaSwizzling.png)
@@ -3324,7 +3324,7 @@ typedef CFHTTPMessageRef (*APMURLResponseFetchHTTPResponse)(CFURLRef response);
- (void)stopLoadi
{
[self.internalConnection cancel];
HCTNetworkTrafficModel *model = [[HCTNetworkTrafficModel alloc] init];
model.path = self.request.URL.path;
model.host = self.request.URL.host;
@@ -3489,7 +3489,7 @@ typedef CFHTTPMessageRef (*APMURLResponseFetchHTTPResponse)(CFURLRef response);
self.internalResponse = response;
[self.client URLProtocol:self wasRedirectedToRequest:request redirectResponse:response];
}
HCTNetworkTrafficModel *model = [[HCTNetworkTrafficModel alloc] init];
model.path = request.URL.path;
model.host = request.URL.host;
@@ -3499,7 +3499,7 @@ typedef CFHTTPMessageRef (*APMURLResponseFetchHTTPResponse)(CFURLRef response);
model.bodyLength = [connection.currentRequest dgm_getBodyLength];
model.emptyLineLength = [self.internalResponse apm_getEmptyLineLength];
model.length = model.lineLength + model.headerLength + model.bodyLength + model.emptyLineLength;
NSDictionary *networkTrafficDictionary = [model convertToDictionary];
[[HermesClient sharedInstance] sendWithType:APMMonitorNetworkTrafficType meta:networkTrafficDictionary payload:nil];
return request;

4
Chapter1 - iOS/1.97.md Normal file
View File

@@ -0,0 +1,4 @@
# __attribute__ 的骚操作
https://mp.weixin.qq.com/s/FTC-IYVCqzGU-00nj5bVfw
https://www.jianshu.com/p/965f6f903114

1132
Chapter1 - iOS/1.98.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -98,4 +98,7 @@
* [92、flutter 无痕埋点](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.92.md)
* [93、flutter 新功能引导](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.93.md)
* [94、APM-Wake Up](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.94.md)
* [95、从 flutter 和前端角度出发,聊聊单线程模型下如何保证 UI 流畅性](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.95.md)
* [95、从 flutter 和前端角度出发,聊聊单线程模型下如何保证 UI 流畅性](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.95.md)
* [96、一个提高 App 运算性能的想法](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.96.md)
* [97、__attribute__ 的骚操作](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.97.md)
* [98、前端、BFF、后端一些常见的设计模式](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.98.md)

View File

@@ -28,7 +28,11 @@
## 二、猫吃什么?
科学生骨肉和不错的猫粮。生骨肉可以看我以前的文章。猫粮推荐:渴望、爱肯拿、绿福摩、百利、金装素力高
科学生骨肉和不错的猫粮。生骨肉可以简单些,因为并不是一直吃生骨肉,所以一些所谓的营养元素可以加,但不是必须(营养均衡、微量元素)
简易版的生骨肉:鸡胸肉、牛肉、三文鱼、鸡蛋、羊奶、鸡心、鸡肝。
猫粮推荐渴望、Go、爱肯拿、绿福摩、百利。
@@ -44,7 +48,7 @@ Pro 版:可以喝新鲜羊奶,淘宝有,不是那种劣质的羊奶粉。
## 四、猫咪玩什么?
猫咪需要一些玩具,嘴简单的玩具有:逗猫棒、激光灯、毛线球、猫薄荷。
猫咪需要一些玩具,嘴简单的玩具有:逗猫棒、激光灯、毛线球、猫薄荷。因为我喜欢玩乒乓球,我家里地上可能会有乒乓球,所以发现地上乒乓球猫咪也会很喜欢抓来抓去,可爱极了。
猫爬架这些东西可有可无。
@@ -71,7 +75,7 @@ Pro 版:可以喝新鲜羊奶,淘宝有,不是那种劣质的羊奶粉。
吃生骨肉的情况下猫咪1个月一次内外驱虫。
驱虫推荐用大宠爱、拜耳驱虫药。
**驱虫推荐用大宠爱、拜耳驱虫药。**
需要注意的是,这些驱虫药都有成猫和幼猫的区别,因为药剂含量不一样,所以主人需要细心些。
@@ -79,7 +83,7 @@ Pro 版:可以喝新鲜羊奶,淘宝有,不是那种劣质的羊奶粉。
### 2. 疫苗
小猫出生的一年需要3针疫苗、一次狂犬幼苗。从第二年开始每年打一针。疫苗本上有时间
小猫出生的**一年需要3针疫苗、一次狂犬幼苗。从第二年开始每年打一针**。疫苗本上有时间
@@ -89,7 +93,7 @@ Pro 版:可以喝新鲜羊奶,淘宝有,不是那种劣质的羊奶粉。
- 定期给猫咪用“排梳”梳梳头,猫咪非常享受这个过程,会一直“呼噜呼噜”的叫。
- 可以学一下按摩手法,看一下知乎或者抖音教程,猫咪非常享受给他摸下巴、头部等区域。
- 布偶是长毛猫,所以脚底的毛,可以用电动剃毛机,剃掉。
- 猫咪冬天3个月洗一次澡夏天可以2个月洗一次澡。猫咪洗护的东西和人的不一样酸碱度 PH 值不一样,所以需要专门给猫咪洗澡的东西。布偶猫尾巴会出油,所以还需要去油膏。我用的是克里斯汀森的洗护,去油用的是 Goop 去油膏。
- 猫咪冬天3个月洗一次澡夏天可以2个月洗一次澡。猫咪洗护的东西和人的不一样酸碱度 PH 值不一样,所以需要专门给猫咪洗澡的东西。布偶猫尾巴会出油,所以还需要去油膏。我用的是赛级布偶洗护套装,千元价格,**克里斯汀森的洗护,去油用的是 Goop 去油膏**。其他性价比高的推荐**“isb伊珊娜宠物浴液”**,除此之外的猫咪主人可以按需购买
- 可以去外面的宠物店给猫咪洗澡,但是因为猫咪的美容机构有太多的猫咪去过,所以我不去那种地方,怕有残留细菌。或者工作人员心情不好,会不会对猫咪不温柔?
@@ -104,11 +108,11 @@ Pro 版:可以喝新鲜羊奶,淘宝有,不是那种劣质的羊奶粉。
### 5. 消毒
可以买一个紫外臭氧灯,消毒效果好。猫舍、宠物店都用这个。我用过的牌子是”雪莱“,是一家专门做这个的上市公司。
可以买一个**紫外臭氧灯**,消毒效果好。猫舍、宠物店都用这个。我用过的牌子是”雪莱“,是一家专门做这个的上市公司。
需要注意的是,紫外线、臭氧灯均对生物有害,所以消毒的时候人、猫咪、宠物、植物都需要离开。消毒完毕后通风半小时再进入。
另外还可以选用杜邦卫可,它是一种粉红色细末状的小颗粒,兑水后可以喷洒消毒。
另外还可以选用**杜邦卫可**,它是一种粉红色细末状的小颗粒,兑水后可以喷洒消毒。

View File

@@ -99,6 +99,8 @@
* [94、APM-Wake Up](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.94.md)
* [95、从 flutter 和前端角度出发,聊聊单线程模型下如何保证 UI 流畅性](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.95.md)
* [96、一个提高 App 运算性能的想法](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.96.md)
* [97、__attribute__ 的骚操作](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.97.md)
* [98、前端、BFF、后端一些常见的设计模式](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter1%20-%20iOS/1.98.md)
* [Chapter2 - Web FrontEnd](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter2%20-%20Web%20FrontEnd/chapter2.md)
* [1、-last-child与-last-of-type你只是会用有研究过区别吗](https://github.com/FantasticLBP/knowledge-kit/blob/master/Chapter2%20-%20Web%20FrontEnd/2.1.md)

BIN
assets/.DS_Store vendored

Binary file not shown.

BIN
assets/GraphQL1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

BIN
assets/GraphQLFeature1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
assets/GraphQLFeature2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
assets/GraphQLFeature3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

BIN
assets/GraphQLFeature4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
assets/MicroFrontEnd1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
assets/MicroFrontend.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
assets/MicroServer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

BIN
assets/React-Redux1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
assets/React-Redux2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
assets/ServerSideCare.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 KiB

BIN
assets/ServicesMesh.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
assets/ServicesMeshArch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
assets/Vue-MVVM.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 KiB

BIN
assets/Vue-OneWayBind.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

BIN
assets/Vue-TwoWayBind.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
assets/VueReact1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/VueReact1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
assets/WebInstructure1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
assets/WebInstructure2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
assets/WebInstructure3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
assets/WebInstructure4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
assets/WebInstructure5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB