polish: drop dead provider_names, clarify status mapping, README prereq
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ numbers across reverse-lookup sites. Providers are sandboxed WASM components.
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
$ rustup target add wasm32-wasip2 # once
|
||||||
$ just run
|
$ just run
|
||||||
$ curl "http://127.0.0.1:8080/api/v1/number/0700000000"
|
$ curl "http://127.0.0.1:8080/api/v1/number/0700000000"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ impl LookupService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn provider_names(&self) -> Vec<&str> {
|
|
||||||
self.providers.iter().map(|p| p.name()).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Run all providers concurrently; one result per provider name.
|
/// Run all providers concurrently; one result per provider name.
|
||||||
pub async fn lookup(&self, number: &str) -> BTreeMap<String, ProviderResult> {
|
pub async fn lookup(&self, number: &str) -> BTreeMap<String, ProviderResult> {
|
||||||
let tasks = self.providers.iter().map(|provider| {
|
let tasks = self.providers.iter().map(|provider| {
|
||||||
@@ -91,6 +87,7 @@ async fn run_provider(
|
|||||||
match tokio::task::spawn_blocking(move || provider.requests(&number)).await {
|
match tokio::task::spawn_blocking(move || provider.requests(&number)).await {
|
||||||
Ok(Ok(urls)) => urls,
|
Ok(Ok(urls)) => urls,
|
||||||
Ok(Err(error)) => {
|
Ok(Err(error)) => {
|
||||||
|
// Host-side trap; the 4-status API has no better bucket than parse_failed.
|
||||||
warn!(provider = %name, %error, "requests() failed");
|
warn!(provider = %name, %error, "requests() failed");
|
||||||
return ProviderResult::ParseFailed;
|
return ProviderResult::ParseFailed;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user