feat: add mutation

This commit is contained in:
evenyag
2023-08-01 21:29:34 +08:00
parent 5ac3126ba4
commit 433aac0053
3 changed files with 31 additions and 4 deletions

19
Cargo.lock generated
View File

@@ -211,7 +211,7 @@ dependencies = [
"common-error",
"common-time",
"datatypes",
"greptime-proto",
"greptime-proto 0.1.0 (git+https://github.com/GreptimeTeam/greptime-proto.git?rev=3d8ac534a0c8fd1c6ec66d129345b44c95665ebc)",
"prost",
"snafu",
"tonic 0.9.2",
@@ -4123,6 +4123,18 @@ dependencies = [
"tonic-build",
]
[[package]]
name = "greptime-proto"
version = "0.1.0"
source = "git+https://github.com/GreptimeTeam/greptime-proto.git?rev=5e422e518b6755c46ec8e6f26233c433ff016558#5e422e518b6755c46ec8e6f26233c433ff016558"
dependencies = [
"prost",
"serde",
"serde_json",
"tonic 0.9.2",
"tonic-build",
]
[[package]]
name = "h2"
version = "0.3.20"
@@ -5498,6 +5510,7 @@ dependencies = [
"datafusion-common",
"datatypes",
"futures",
"greptime-proto 0.1.0 (git+https://github.com/GreptimeTeam/greptime-proto.git?rev=5e422e518b6755c46ec8e6f26233c433ff016558)",
"lazy_static",
"log-store",
"metrics",
@@ -6982,7 +6995,7 @@ dependencies = [
"datafusion",
"datatypes",
"futures",
"greptime-proto",
"greptime-proto 0.1.0 (git+https://github.com/GreptimeTeam/greptime-proto.git?rev=3d8ac534a0c8fd1c6ec66d129345b44c95665ebc)",
"promql-parser",
"prost",
"query",
@@ -7252,7 +7265,7 @@ dependencies = [
"format_num",
"futures",
"futures-util",
"greptime-proto",
"greptime-proto 0.1.0 (git+https://github.com/GreptimeTeam/greptime-proto.git?rev=3d8ac534a0c8fd1c6ec66d129345b44c95665ebc)",
"humantime",
"metrics",
"num",

View File

@@ -32,6 +32,8 @@ datafusion.workspace = true
datafusion-common.workspace = true
datatypes = { path = "../datatypes" }
futures.workspace = true
# TODO(yingwen): Update and use api crate once https://github.com/GreptimeTeam/greptime-proto/pull/72 is merged.
greptime-proto = { git = "https://github.com/GreptimeTeam/greptime-proto.git", rev = "5e422e518b6755c46ec8e6f26233c433ff016558" }
lazy_static = "1.4"
log-store = { path = "../log-store" }
metrics.workspace = true

View File

@@ -17,7 +17,8 @@
use std::time::Duration;
use common_base::readable_size::ReadableSize;
use store_api::storage::{ColumnId, CompactionStrategy, RegionId};
use greptime_proto::v1::Rows;
use store_api::storage::{ColumnId, CompactionStrategy, OpType, RegionId};
use tokio::sync::oneshot::{self, Receiver, Sender};
use crate::config::DEFAULT_WRITE_BUFFER_SIZE;
@@ -82,11 +83,22 @@ pub struct CloseRequest {
pub region_id: RegionId,
}
/// Mutation to apply to a set of rows.
#[derive(Debug)]
pub struct Mutation {
/// Type of the mutation.
pub op_type: OpType,
/// Rows to write.
pub rows: Rows,
}
/// Request to write a region.
#[derive(Debug)]
pub(crate) struct WriteRequest {
/// Region to write.
pub region_id: RegionId,
/// Mutations to the region.
pub mutations: Vec<Mutation>,
}
/// Request sent to a worker