Rename workspace packages and update Rust imports and usage examples

This commit is contained in:
2026-12-03 04:27:32 +08:00
parent ef251ae339
commit 01b8af4757
16 changed files with 56 additions and 55 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
[package]
name = "telefind-app"
name = "app"
version.workspace = true
edition.workspace = true
default-run = "telefind"
@@ -9,8 +9,8 @@ name = "telefind"
path = "src/main.rs"
[dependencies]
telefind-core = { path = "../core" }
telefind-bot = { path = "../bot" }
core = { path = "../core" }
bot = { path = "../bot" }
ureq = { version = "3", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+1 -1
View File
@@ -1,7 +1,7 @@
//! Line-delimited public document changes supplied by the caller.
use search_core::{Document, DocumentId, Media, PublicName, SearchIndex};
use serde::Deserialize;
use std::{error::Error, io::BufRead};
use telefind_core::{Document, DocumentId, Media, PublicName, SearchIndex};
#[derive(Deserialize)]
#[serde(rename_all = "lowercase")]
+3 -3
View File
@@ -1,3 +1,5 @@
use app::{input, telegram};
use search_core::MemoryIndex;
use std::{
env,
error::Error,
@@ -5,8 +7,6 @@ use std::{
io::{self, BufReader},
process::ExitCode,
};
use telefind_app::{input, telegram};
use telefind_core::MemoryIndex;
const USAGE: &str = concat!(
"telefind bot [events.jsonl|-]\n",
@@ -36,7 +36,7 @@ fn run() -> Result<(), Box<dyn Error>> {
}
Some("query") if args.len() >= 3 => {
load(&args[1], &mut index)?;
let reply = telefind_bot::handle(&index, "telefind", &args[2..].join(" "))?;
let reply = bot::handle(&index, "telefind", &args[2..].join(" "))?;
println!("{}", serde_json::to_string(&telegram::render(reply))?);
Ok(())
}
+1 -1
View File
@@ -6,10 +6,10 @@ use self::{
update::{dispatch, Update},
};
pub use client::Client;
use search_core::SearchIndex;
use serde::Deserialize;
use serde_json::{json, Value};
use std::{error::Error, thread, time::Duration};
use telefind_core::SearchIndex;
pub use update::render;
fn with_retry<T>(
+1 -1
View File
@@ -1,8 +1,8 @@
//! Broker-neutral gateway and leased workers. Each adapter is scoped to one bot.
use super::{client::Failure, process, receive, run_loop, Client, Update};
use search_core::SearchIndex;
use serde::{Deserialize, Serialize};
use std::{error::Error, time::Duration};
use telefind_core::SearchIndex;
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Lane {
+2 -2
View File
@@ -1,9 +1,9 @@
use super::*;
use search_core::MemoryIndex;
use std::{
io::{BufRead, BufReader, Read, Write},
net::TcpListener,
};
use telefind_core::MemoryIndex;
fn respond(server: &TcpListener, reply: impl FnOnce(&str, Value) -> (u16, String)) {
let (mut socket, _) = server.accept().unwrap();
@@ -105,7 +105,7 @@ fn nonpublic_and_protected_updates_do_not_add_searchable_posts() {
}
assert_eq!(
index
.search(&telefind_core::Query::new("private"))
.search(&search_core::Query::new("private"))
.unwrap()
.total,
0
+1 -1
View File
@@ -108,7 +108,7 @@ fn publish_failure_keeps_offset_then_workers_replay_and_defer_flooded_reply() {
assert_eq!(step(&mut queries), Outcome::Completed);
assert_eq!(
index
.search(&telefind_core::Query::new("tutorial"))
.search(&search_core::Query::new("tutorial"))
.unwrap()
.total,
0
+2 -2
View File
@@ -1,7 +1,7 @@
use bot::{handle, Reply};
use search_core::{Document, DocumentId, Media, PublicName, SearchIndex};
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use telefind_bot::{handle, Reply};
use telefind_core::{Document, DocumentId, Media, PublicName, SearchIndex};
#[derive(Deserialize, Serialize)]
pub struct Update {