diff --git a/src/handlers/http/modal/ingest_server.rs b/src/handlers/http/modal/ingest_server.rs
index dce52a17b..37057966e 100644
--- a/src/handlers/http/modal/ingest_server.rs
+++ b/src/handlers/http/modal/ingest_server.rs
@@ -45,7 +45,6 @@ use crate::{handlers::http::base_path, option::CONFIG};
use actix_web::web;
use actix_web::web::resource;
use actix_web::Scope;
-use anyhow::anyhow;
use async_trait::async_trait;
use base64::Engine;
use bytes::Bytes;
@@ -85,14 +84,14 @@ impl ParseableServer for IngestServer {
// parseable can't use local storage for persistence when running a distributed setup
if CONFIG.get_storage_mode_string() == "Local drive" {
return Err(anyhow::Error::msg(
- "This instance of the Parseable server has been configured to run in a distributed setup, it doesn't support local storage.",
- ));
+ "This instance of the Parseable server has been configured to run in a distributed setup, it doesn't support local storage.",
+ ));
}
// check for querier state. Is it there, or was it there in the past
- let parseable_json = self.check_querier_state().await?;
+ let parseable_json = check_querier_state().await?;
// to get the .parseable.json file in staging
- self.validate_credentials().await?;
+ validate_credentials().await?;
Ok(parseable_json)
}
@@ -112,7 +111,7 @@ impl ParseableServer for IngestServer {
tokio::spawn(airplane::server());
// set the ingestor metadata
- self.set_ingestor_metadata().await?;
+ set_ingestor_metadata().await?;
// Ingestors shouldn't have to deal with OpenId auth flow
let app = self.start(prometheus, None);
@@ -278,96 +277,92 @@ impl IngestServer {
),
)
}
+}
+
+// create the ingestor metadata and put the .ingestor.json file in the object store
+pub async fn set_ingestor_metadata() -> anyhow::Result<()> {
+ let storage_ingestor_metadata = migrate_ingester_metadata().await?;
+ let store = CONFIG.storage().get_object_store();
+
+ // find the meta file in staging if not generate new metadata
+ let resource = INGESTOR_META.clone();
+ // use the id that was generated/found in the staging and
+ // generate the path for the object store
+ let path = ingestor_metadata_path(None);
+
+ // we are considering that we can always get from object store
+ if let Some(mut store_data) = storage_ingestor_metadata {
+ if store_data.domain_name != INGESTOR_META.domain_name {
+ store_data
+ .domain_name
+ .clone_from(&INGESTOR_META.domain_name);
+ store_data.port.clone_from(&INGESTOR_META.port);
- // create the ingestor metadata and put the .ingestor.json file in the object store
- async fn set_ingestor_metadata(&self) -> anyhow::Result<()> {
- let storage_ingestor_metadata = migrate_ingester_metadata().await?;
- let store = CONFIG.storage().get_object_store();
-
- // find the meta file in staging if not generate new metadata
- let resource = INGESTOR_META.clone();
- // use the id that was generated/found in the staging and
- // generate the path for the object store
- let path = ingestor_metadata_path(None);
-
- // we are considering that we can always get from object store
- if storage_ingestor_metadata.is_some() {
- let mut store_data = storage_ingestor_metadata.unwrap();
-
- if store_data.domain_name != INGESTOR_META.domain_name {
- store_data
- .domain_name
- .clone_from(&INGESTOR_META.domain_name);
- store_data.port.clone_from(&INGESTOR_META.port);
-
- let resource = Bytes::from(serde_json::to_vec(&store_data)?);
-
- // if pushing to object store fails propagate the error
- return store
- .put_object(&path, resource)
- .await
- .map_err(|err| anyhow!(err));
- }
- } else {
- let resource = Bytes::from(serde_json::to_vec(&resource)?);
+ let resource = Bytes::from(serde_json::to_vec(&store_data)?);
+ // if pushing to object store fails propagate the error
store.put_object(&path, resource).await?;
}
+ } else {
+ let resource = Bytes::from(serde_json::to_vec(&resource)?);
- Ok(())
+ store.put_object(&path, resource).await?;
}
- // check for querier state. Is it there, or was it there in the past
- // this should happen before the set the ingestor metadata
- async fn check_querier_state(&self) -> anyhow::Result