Skip to main content

AirLibrary/Client/AirServiceProvider/
IndexFiles.rs

1//! `AirServiceProvider::IndexFiles` - kick off a directory index pass on
2//! the Air daemon. Wraps
3//! [`crate::Client::AirClient::AirClient::IndexFiles`].
4
5use crate::{
6	AirError,
7	Client::{AirClient::IndexInfo, AirServiceProvider::AirServiceProvider},
8	dev_log,
9};
10
11impl AirServiceProvider {
12	/// Indexes files under `path`. `patterns` includes globs to match;
13	/// `exclude_patterns` filters those out. `max_depth` of `0` is
14	/// unlimited.
15	pub async fn IndexFiles(
16		&self,
17
18		path:String,
19
20		patterns:Vec<String>,
21
22		exclude_patterns:Vec<String>,
23
24		max_depth:u32,
25	) -> Result<IndexInfo::Struct, AirError> {
26		let RequestID = crate::Utility::GenerateRequestId();
27
28		dev_log!(
29			"grpc",
30			"[AirServiceProvider] IndexFiles (request_id: {}, path: {})",
31			RequestID,
32			path
33		);
34
35		self.client
36			.IndexFiles(RequestID, path, patterns, exclude_patterns, max_depth)
37			.await
38	}
39}