-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use http::request::Builder; | ||
use hyper::body::{Body, Sender}; | ||
use hyper::client::HttpConnector; | ||
use hyper::{body, Client, Request, StatusCode}; | ||
use hyper_tls::HttpsConnector; | ||
|
||
use std::collections::HashMap; | ||
|
||
use super::{Result, SinkError}; | ||
|
||
const SNOWFLAKE_HOST_ADDR: &str = "snowflakecomputing.com"; | ||
const SNOWFLAKE_REQUEST_ID: &str = "RW_SNOWFLAKE_SINK"; | ||
|
||
#[derive(Debug)] | ||
pub struct SnowflakeInserterBuilder { | ||
url: String, | ||
header: HashMap<String, String>, | ||
} | ||
|
||
impl SnowflakeInserterBuilder { | ||
pub fn new(account: String, db: String, schema: String, pipe: String, header: HashMap<String, String>) -> Self { | ||
// TODO: ensure if we need user to *explicitly* provide the request id | ||
let url = format!("https://{}.{}/v1/data/pipes/{}.{}.{}/insertFiles?request_id={}", | ||
account, | ||
SNOWFLAKE_HOST_ADDR, | ||
db, | ||
schema. | ||
pipe, | ||
SNOWFLAKE_REQUEST_ID); | ||
|
||
Self { | ||
url, | ||
header, | ||
} | ||
} | ||
|
||
fn build_request_and_client() -> (Builder, Client<HttpsConnector<HttpConnector>>) { | ||
|
||
} | ||
|
||
pub async fn build(&self) -> Result<SnowflakeInserter> { | ||
|
||
} | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct SnowflakeInserter { | ||
sender: Option<Sender>, | ||
join_handle: Option<JoinHandle<Result<Vec<u8>>, | ||
buffer: BytesMut, | ||
} |