mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-02 15:50:29 +08:00
精简 API
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
! Contributors : Nul None <nul@none.org>
|
||||
! |
|
||||
! Created On : <2024-08-19>
|
||||
! Last Modified : <2025-10-28>
|
||||
! Last Modified : <2026-01-21>
|
||||
! ---------------------------------------------------------- -->
|
||||
|
||||
# Write A Recipe Even If You Don't Know C
|
||||
@@ -57,6 +57,11 @@
|
||||
- **换源链接**: 指镜像站所提供的某一个具体的换源使用的URL
|
||||
- **测速链接**: 用来测速的URL,与 "换源链接" 不同,可分为 **精准测速** 和 **模糊测速**
|
||||
|
||||
1. 在代码中,测速链接一般使用 `smurl` (即 `speed measure URL`) 来指代
|
||||
2. 在代码中,换源链接一般使用 `repourl` (即 `repository URL`) 来指代
|
||||
|
||||
为什么不用 `regurl`,因为使用术语 `repository` 的 target 远多于使用术语 `registry` 的。
|
||||
|
||||
- **镜像源**: 为了方便,**偶尔**我们将直接称`mirror`和/或`source`为**镜像源**,这只是一种方便性的称呼,可以统称二者,也可以根据上下文指代二者之一
|
||||
|
||||
<br>
|
||||
|
||||
@@ -28,7 +28,7 @@ def_sources_end()
|
||||
//
|
||||
|
||||
// 调整上述某一个镜像站的所提供源的 "换源链接"
|
||||
chef_set_source_url (this, &UpstreamProvider, "新的换源链接");
|
||||
chef_set_url (this, &UpstreamProvider, "新的换源链接");
|
||||
```
|
||||
|
||||
<br>
|
||||
@@ -59,14 +59,14 @@ def_sources_end()
|
||||
//
|
||||
|
||||
// 调整/设置上述某一个镜像站的所提供源的 "精准测速链接"
|
||||
chef_set_source_smurl (this, &UpstreamProvider, "新的测速链接")
|
||||
chef_set_smurl (this, &UpstreamProvider, "新的测速链接")
|
||||
// 把所有上述源的 "测速链接" 设置为 "换源链接" + postfix
|
||||
chef_set_sources_speed_measure_url_with_postfix (this, "/dir/BigFile.tar.gz");
|
||||
chef_set_all_smurl_with_postfix (this, "/dir/BigFile.tar.gz");
|
||||
// 基于 "换源链接" 做更自定义的操作
|
||||
chef_set_sources_speed_measure_url_with_func (this, func, data);
|
||||
chef_set_all_smurl_with_func (this, func, data);
|
||||
|
||||
// 调整某一个镜像站(Provider)的 "测速链接"
|
||||
chef_set_provider_speed_measure_url (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");
|
||||
chef_set_provider_smurl (&Tencent, "https://mirrors.cloud.tencent.com/npm/BigFile.tar.gz");
|
||||
// 调整某一个镜像站(Provider)的 "测速精度"
|
||||
chef_set_provider_speed_measure_accuracy (&UpstreamProvider, ROUGH);
|
||||
chef_set_provider_sm_accuracy (&UpstreamProvider, ROUGH);
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user