refactor: Rename Wal metadata endpoint types to WriteBuffer

pull/24376/head
Carol (Nichols || Goulding) 2021-04-19 16:25:03 -04:00 committed by kodiakhq[bot]
parent 5f024401a4
commit ed6025b400
2 changed files with 8 additions and 8 deletions

View File

@ -2,9 +2,9 @@
use crate::write_buffer::SegmentSummary; use crate::write_buffer::SegmentSummary;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
/// Query string for WAL metadata endpoint /// Query string for the Write Buffer metadata endpoint
#[derive(Debug, Clone, Serialize, Deserialize, Default, Eq, PartialEq)] #[derive(Debug, Clone, Serialize, Deserialize, Default, Eq, PartialEq)]
pub struct WalMetadataQuery { pub struct WriteBufferMetadataQuery {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<usize>, pub limit: Option<usize>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -13,8 +13,8 @@ pub struct WalMetadataQuery {
pub newer_than: Option<chrono::DateTime<chrono::Utc>>, pub newer_than: Option<chrono::DateTime<chrono::Utc>>,
} }
/// Response for WAL metadata endpoint /// Response for the Write Buffer metadata endpoint
#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)]
pub struct WalMetadataResponse { pub struct WriteBufferMetadataResponse {
pub segments: Vec<SegmentSummary>, pub segments: Vec<SegmentSummary>,
} }

View File

@ -13,7 +13,7 @@
// Influx crates // Influx crates
use super::{super::commands::metrics, planner::Planner}; use super::{super::commands::metrics, planner::Planner};
use data_types::{ use data_types::{
http::WalMetadataQuery, http::WriteBufferMetadataQuery,
names::{org_and_bucket_to_database, OrgBucketMappingError}, names::{org_and_bucket_to_database, OrgBucketMappingError},
DatabaseName, DatabaseName,
}; };
@ -37,7 +37,7 @@ use routerify::{prelude::*, Middleware, RequestInfo, Router, RouterError, Router
use serde::Deserialize; use serde::Deserialize;
use snafu::{OptionExt, ResultExt, Snafu}; use snafu::{OptionExt, ResultExt, Snafu};
use data_types::http::WalMetadataResponse; use data_types::http::WriteBufferMetadataResponse;
use hyper::server::conn::AddrIncoming; use hyper::server::conn::AddrIncoming;
use std::{ use std::{
fmt::Debug, fmt::Debug,
@ -556,7 +556,7 @@ async fn get_write_buffer_meta<M: ConnectionManager + Send + Sync + Debug + 'sta
.expect("db name must have been set") .expect("db name must have been set")
.clone(); .clone();
let query: WalMetadataQuery = req let query: WriteBufferMetadataQuery = req
.uri() .uri()
.query() .query()
.map(|query| { .map(|query| {
@ -593,7 +593,7 @@ async fn get_write_buffer_meta<M: ConnectionManager + Send + Sync + Debug + 'sta
let response = Response::builder() let response = Response::builder()
.status(StatusCode::OK) .status(StatusCode::OK)
.body(Body::from( .body(Body::from(
serde_json::to_string(&WalMetadataResponse { segments }) serde_json::to_string(&WriteBufferMetadataResponse { segments })
.expect("json encoding should not fail"), .expect("json encoding should not fail"),
)) ))
.expect("builder should be successful"); .expect("builder should be successful");