Skip to content

Commit

Permalink
Implement backups
Browse files Browse the repository at this point in the history
* trigger backup importation via http route
* follow backup advancement with status route
* import backup via a command line
* let user choose batch size of documents to import (command lines)

closes #884
closes #840
  • Loading branch information
ManyTheFish committed Sep 28, 2020
1 parent efe5984 commit c254320
Show file tree
Hide file tree
Showing 26 changed files with 1,301 additions and 155 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Expand Up @@ -30,6 +30,11 @@ jobs:
with:
command: test
args: --locked --release
- name: Run cargo test backup
uses: actions-rs/cargo@v1
with:
command: test
args: backup --locked --release -- --ignored --test-threads 1
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions meilisearch-core/src/database.rs
Expand Up @@ -586,6 +586,8 @@ impl Database {
.main
.put_fields_distribution(writer, &frequency)
}

pub fn version(&self) -> (u32, u32, u32) { self.database_version }
}

#[cfg(test)]
Expand Down
7 changes: 7 additions & 0 deletions meilisearch-error/src/lib.rs
Expand Up @@ -76,6 +76,9 @@ pub enum Code {
RetrieveDocument,
SearchDocuments,
UnsupportedMediaType,

BackupAlreadyInProgress,
BackupProcessFailed,
}

impl Code {
Expand Down Expand Up @@ -122,6 +125,10 @@ impl Code {
RetrieveDocument => ErrCode::internal("unretrievable_document", StatusCode::BAD_REQUEST),
SearchDocuments => ErrCode::internal("search_error", StatusCode::BAD_REQUEST),
UnsupportedMediaType => ErrCode::invalid("unsupported_media_type", StatusCode::UNSUPPORTED_MEDIA_TYPE),

// error related to backup
BackupAlreadyInProgress => ErrCode::invalid("backup_already_in_progress", StatusCode::CONFLICT),
BackupProcessFailed => ErrCode::internal("backup_process_failed", StatusCode::INTERNAL_SERVER_ERROR),
}
}

Expand Down
1 change: 1 addition & 0 deletions meilisearch-http/Cargo.toml
Expand Up @@ -37,6 +37,7 @@ meilisearch-error = { path = "../meilisearch-error", version = "0.14.1" }
meilisearch-schema = { path = "../meilisearch-schema", version = "0.14.1" }
meilisearch-tokenizer = {path = "../meilisearch-tokenizer", version = "0.14.1"}
mime = "0.3.16"
once_cell = "1.4.1"
rand = "0.7.3"
regex = "1.3.6"
rustls = "0.18"
Expand Down

0 comments on commit c254320

Please sign in to comment.