Skip to content

Commit 39bb137

Browse files
committed
Added license in quickwit-{actors,index} Cargo.toml
1 parent 7a67a13 commit 39bb137

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

quickwit-actors/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name = "quickwit-actors"
33
version = "0.1.0"
44
authors = ["Quickwit, Inc. <[email protected]>"]
55
edition = "2018"
6+
license = 'AGPL-3.0-or-later' # For a commercial, license, contact [email protected]
7+
description = "Actor framework used in quickwit"
8+
repository = "https://github.com/quickwit-inc/quickwit"
9+
homepage = "https://quickwit.io/"
10+
documentation = "https://quickwit.io/docs/"
11+
612

713
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
814

quickwit-index/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ version = '0.1.0'
44
authors = ['Quickwit, Inc. <[email protected]>']
55
edition = '2018'
66
license = 'AGPL-3.0-or-later' # For a commercial, license, contact [email protected]
7-
description = "Crate containing all of the custom tantivy Directory used in quickwit"
7+
description = "Quickwit indexing"
88
repository = "https://github.com/quickwit-inc/quickwit"
99
homepage = "https://quickwit.io/"
1010
documentation = "https://quickwit.io/docs/"
1111

12-
1312
[dependencies]
1413
futures = "0.3"
1514
tantivy = { git= "https://github.com/quickwit-inc/tantivy", rev="c1d1d84"}

quickwit-index/src/actors/indexer.rs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use crate::models::IndexerMessage;
4343
use crate::models::RawDocBatch;
4444
use crate::models::ScratchDirectory;
4545

46-
#[derive(Clone, Default, Debug)]
46+
#[derive(Clone, Default, Debug, Eq, PartialEq)]
4747
pub struct IndexerCounters {
4848
/// Overall number of documents received, partitionned
4949
/// into 3 categories:
@@ -102,9 +102,11 @@ impl ImmutableState {
102102
fn get_or_create_current_indexed_split<'a>(
103103
&self,
104104
current_split_opt: &'a mut Option<IndexedSplit>,
105+
counters: &mut IndexerCounters,
105106
ctx: &ActorContext<Indexer>,
106107
) -> anyhow::Result<&'a mut IndexedSplit> {
107108
if current_split_opt.is_none() {
109+
counters.num_docs_in_split = 0;
108110
let new_indexed_split = self.create_indexed_split()?;
109111
let commit_timeout = IndexerMessage::CommitTimeout {
110112
split_id: new_indexed_split.split_id.clone(),
@@ -159,7 +161,8 @@ impl ImmutableState {
159161
counters: &mut IndexerCounters,
160162
ctx: &ActorContext<Indexer>,
161163
) -> Result<(), ActorExitStatus> {
162-
let indexed_split = self.get_or_create_current_indexed_split(current_split_opt, ctx)?;
164+
let indexed_split =
165+
self.get_or_create_current_indexed_split(current_split_opt, counters, ctx)?;
163166
for doc_json in batch.docs {
164167
counters.overall_num_bytes += doc_json.len() as u64;
165168
indexed_split.docs_size_in_bytes += doc_json.len() as u64;
@@ -176,6 +179,7 @@ impl ImmutableState {
176179
} => {
177180
counters.num_docs_in_split += 1;
178181
counters.num_valid_docs += 1;
182+
indexed_split.num_docs += 1;
179183
if let Some(timestamp) = timestamp_opt {
180184
record_timestamp(timestamp, &mut indexed_split.time_range);
181185
}
@@ -332,6 +336,7 @@ mod tests {
332336
use std::time::Duration;
333337

334338
use crate::actors::indexer::record_timestamp;
339+
use crate::actors::indexer::IndexerCounters;
335340
use crate::models::CommitPolicy;
336341
use crate::models::RawDocBatch;
337342
use quickwit_actors::create_test_mailbox;
@@ -382,9 +387,10 @@ mod tests {
382387
&indexer_mailbox,
383388
RawDocBatch {
384389
docs: vec![
385-
"{\"body\": \"happy\"}".to_string(),
386-
"{\"body\": \"happy2\"}".to_string(),
387-
"{".to_string(),
390+
r#"{"body": "happy"}"#.to_string(), // missing timestamp
391+
r#"{"body": "happy", "timestamp": 1628837062}"#.to_string(), // ok
392+
r#"{"body": "happy2", "timestamp": 1628837062}"#.to_string(), // ok
393+
"{".to_string(), // invalid json
388394
],
389395
}
390396
.into(),
@@ -394,14 +400,22 @@ mod tests {
394400
.send_message(
395401
&indexer_mailbox,
396402
RawDocBatch {
397-
docs: vec!["{\"body\": \"happy3\"}".to_string()],
403+
docs: vec![r#"{"body": "happy3", "timestamp": 1628837062}"#.to_string()], // ok
398404
}
399405
.into(),
400406
)
401407
.await?;
402408
let indexer_counters = indexer_handle.process_pending_and_observe().await.state;
403-
assert_eq!(indexer_counters.num_valid_docs, 3);
404-
assert_eq!(indexer_counters.num_parse_errors, 1);
409+
assert_eq!(
410+
indexer_counters,
411+
IndexerCounters {
412+
num_parse_errors: 1,
413+
num_missing_timestamp: 1,
414+
num_valid_docs: 3,
415+
num_docs_in_split: 3,
416+
overall_num_bytes: 146,
417+
}
418+
);
405419
let output_messages = inbox.drain_available_message_for_test();
406420
assert_eq!(output_messages.len(), 1);
407421
assert_eq!(output_messages[0].num_docs, 3);

0 commit comments

Comments
 (0)