Skip to content

Commit 558f58e

Browse files
committed
document all entrypoints
1 parent daff4d0 commit 558f58e

File tree

2 files changed

+30
-41
lines changed

2 files changed

+30
-41
lines changed

crates/core/src/entrypoint/configure.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use tokio::fs::File;
1818
use tokio::io;
1919
use tokio_stream::StreamExt;
20-
use tracing::{debug, info};
20+
use tracing::info;
2121

2222
use crate::config::{
2323
defaults, IndexerConfig, IndexerDualEncoderConfig, IndexerGraphConfig, LocalConfig,
@@ -73,7 +73,7 @@ fn download_files() {
7373
}
7474

7575
fn build_spellchecker() -> Result<()> {
76-
debug!("Building spellchecker");
76+
info!("Building spellchecker");
7777
let spellchecker_path = Path::new(DATA_PATH).join("web_spell");
7878

7979
if !spellchecker_path.exists() {
@@ -97,7 +97,7 @@ fn build_spellchecker() -> Result<()> {
9797
}
9898

9999
fn create_webgraph() -> Result<()> {
100-
debug!("Creating webgraph");
100+
info!("Creating webgraph");
101101
let out_path = Path::new(DATA_PATH).join("webgraph");
102102

103103
if out_path.exists() {
@@ -128,7 +128,7 @@ fn create_webgraph() -> Result<()> {
128128
}
129129

130130
fn calculate_centrality() {
131-
debug!("Calculating centrality");
131+
info!("Calculating centrality");
132132
let webgraph_path = Path::new(DATA_PATH).join("webgraph");
133133
let out_path = Path::new(DATA_PATH).join("centrality");
134134

@@ -144,7 +144,7 @@ fn calculate_centrality() {
144144
}
145145

146146
fn create_inverted_index() -> Result<()> {
147-
debug!("Creating inverted index");
147+
info!("Creating inverted index");
148148
let out_path = Path::new(DATA_PATH).join("index");
149149

150150
if out_path.exists() {
@@ -209,6 +209,7 @@ fn create_inverted_index() -> Result<()> {
209209
}
210210

211211
fn create_entity_index() -> Result<()> {
212+
info!("Creating entity index");
212213
let out_path = Path::new(DATA_PATH).join("entity");
213214
if out_path.exists() {
214215
std::fs::remove_dir_all(&out_path)?;

crates/core/src/main.rs

Lines changed: 24 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,14 @@ enum Commands {
6666
},
6767

6868
/// Deploy the search server.
69-
SearchServer {
70-
config_path: String,
71-
},
69+
SearchServer { config_path: String },
7270

7371
/// Deploy the entity search server.
74-
EntitySearchServer {
75-
config_path: String,
76-
},
72+
EntitySearchServer { config_path: String },
7773

7874
/// Deploy the json http api. The api interacts with
7975
/// the search servers, webgraph servers etc. to provide the necesarry functionality.
80-
Api {
81-
config_path: String,
82-
},
76+
Api { config_path: String },
8377

8478
/// Deploy the crawler.
8579
Crawler {
@@ -102,23 +96,19 @@ enum Commands {
10296
ml: bool,
10397
},
10498

105-
// Commands for the live index.
99+
/// Commands for the live index.
106100
LiveIndex {
107101
#[clap(subcommand)]
108102
options: LiveIndex,
109103
},
110104

111-
// Build spell correction model.
112-
WebSpell {
113-
config_path: String,
114-
},
105+
/// Build spell correction model.
106+
WebSpell { config_path: String },
115107

116-
// Compute statistics for sites.
117-
SiteStats {
118-
config_path: String,
119-
},
108+
/// Compute statistics for sites.
109+
SiteStats { config_path: String },
120110

121-
// Commands to compute distributed graph algorithms.
111+
/// Commands to compute distributed graph algorithms.
122112
Ampc {
123113
#[clap(subcommand)]
124114
options: AmpcOptions,
@@ -155,20 +145,22 @@ enum AmpcOptions {
155145

156146
#[derive(Subcommand)]
157147
enum AdminOptions {
158-
Init {
159-
host: SocketAddr,
160-
},
148+
/// Create the admin config file. Run this before any other admin commands so the client knows where to connect.
149+
Init { host: SocketAddr },
150+
151+
/// Print the reachable cluster members and which service they are running.
161152
Status,
162-
TopKeyphrases {
163-
top: usize,
164-
},
165153

154+
/// Export the top most common phrases in the index.
155+
TopKeyphrases { top: usize },
156+
157+
/// Get statistics about the index.
166158
#[clap(subcommand)]
167-
Index(AdminIndexOptions),
159+
IndexStats(AdminIndexStatsOptions),
168160
}
169161

170162
#[derive(Subcommand)]
171-
enum AdminIndexOptions {
163+
enum AdminIndexStatsOptions {
172164
/// Get the size of the index
173165
Size,
174166
}
@@ -251,9 +243,7 @@ enum WebgraphOptions {
251243
#[derive(Subcommand)]
252244
enum IndexingOptions {
253245
/// Create the search index.
254-
Search {
255-
config_path: String,
256-
},
246+
Search { config_path: String },
257247

258248
/// Merge multiple search indexes into a single index.
259249
MergeSearch {
@@ -267,10 +257,8 @@ enum IndexingOptions {
267257
output_path: String,
268258
},
269259

270-
// Create an index of canonical urls.
271-
Canonical {
272-
config_path: String,
273-
},
260+
/// Create an index of canonical urls.
261+
Canonical { config_path: String },
274262
}
275263

276264
fn load_toml_config<T: DeserializeOwned, P: AsRef<Path>>(path: P) -> T {
@@ -511,8 +499,8 @@ fn main() -> Result<()> {
511499
.block_on(entrypoint::admin::top_keyphrases(top))?;
512500
}
513501

514-
AdminOptions::Index(index_options) => match index_options {
515-
AdminIndexOptions::Size => {
502+
AdminOptions::IndexStats(index_options) => match index_options {
503+
AdminIndexStatsOptions::Size => {
516504
tokio::runtime::Builder::new_current_thread()
517505
.enable_all()
518506
.build()?

0 commit comments

Comments
 (0)