-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE] factor io config into common code (#1335)
* Factors out IOConfig, S3Config, etc into a common io-config crate. * Reexports them in the daft-io crate for convenience * sadly `daft-dsl` still depends on `daft-io` for the url_download function so we still have to recompile quite a bit. * This should be fixed when we allow for dynamic function registration.
- Loading branch information
Showing
22 changed files
with
448 additions
and
382 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
[dependencies] | ||
common-error = {path = "../error", default-features = false} | ||
pyo3 = {workspace = true, optional = true} | ||
serde = {workspace = true} | ||
serde_json = {workspace = true} | ||
|
||
[features] | ||
default = ["python"] | ||
python = ["dep:pyo3", "common-error/python"] | ||
|
||
[package] | ||
edition = {workspace = true} | ||
name = "common-io-config" | ||
version = {workspace = true} |
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,25 @@ | ||
use std::fmt::Display; | ||
use std::fmt::Formatter; | ||
|
||
use serde::Deserialize; | ||
use serde::Serialize; | ||
|
||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] | ||
pub struct AzureConfig { | ||
pub storage_account: Option<String>, | ||
pub access_key: Option<String>, | ||
pub anonymous: bool, | ||
} | ||
|
||
impl Display for AzureConfig { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { | ||
write!( | ||
f, | ||
"AzureConfig | ||
storage_account: {:?} | ||
access_key: {:?} | ||
anonymous: {:?}", | ||
self.storage_account, self.access_key, self.anonymous | ||
) | ||
} | ||
} |
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,26 @@ | ||
use std::fmt::Display; | ||
use std::fmt::Formatter; | ||
|
||
use serde::Deserialize; | ||
use serde::Serialize; | ||
|
||
use crate::{AzureConfig, GCSConfig, S3Config}; | ||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] | ||
pub struct IOConfig { | ||
pub s3: S3Config, | ||
pub azure: AzureConfig, | ||
pub gcs: GCSConfig, | ||
} | ||
|
||
impl Display for IOConfig { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { | ||
write!( | ||
f, | ||
"IOConfig: | ||
{} | ||
{} | ||
{}", | ||
self.s3, self.azure, self.gcs | ||
) | ||
} | ||
} |
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,23 @@ | ||
use std::fmt::Display; | ||
use std::fmt::Formatter; | ||
|
||
use serde::Deserialize; | ||
use serde::Serialize; | ||
|
||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq, Hash)] | ||
pub struct GCSConfig { | ||
pub project_id: Option<String>, | ||
pub anonymous: bool, | ||
} | ||
|
||
impl Display for GCSConfig { | ||
fn fmt(&self, f: &mut Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { | ||
write!( | ||
f, | ||
"GCSConfig | ||
project_id: {:?} | ||
anonymous: {:?}", | ||
self.project_id, self.anonymous | ||
) | ||
} | ||
} |
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,9 @@ | ||
#[cfg(feature = "python")] | ||
pub mod python; | ||
|
||
mod azure; | ||
mod config; | ||
mod gcs; | ||
mod s3; | ||
|
||
pub use crate::{azure::AzureConfig, config::IOConfig, gcs::GCSConfig, s3::S3Config}; |
Oops, something went wrong.