Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
pull-requests: write
contents: read
steps:
- uses: actions/setup-node@v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4

- run: npm install -g @commitlint/cli @commitlint/config-conventional

# Checkout to get the commitlint configuration.
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- run: npx commitlint --verbose <<< $COMMIT_MSG
env:
Expand All @@ -28,7 +28,7 @@ jobs:

${{ github.event.pull_request.body }}

- uses: actions/github-script@v7
- uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
if: failure()
with:
script: |
Expand Down
54 changes: 31 additions & 23 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ on:

jobs:
format:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
components: rustfmt
toolchain: stable
Expand All @@ -26,27 +26,27 @@ jobs:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
components: clippy
toolchain: stable

# install linux dependencies
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04' # This must match the platform value defined above.
if: matrix.os == 'ubuntu-latest' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: Check clippy
run: cargo clippy --tests
Expand All @@ -59,7 +59,7 @@ jobs:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.os }}
Expand All @@ -72,37 +72,44 @@ jobs:
CARGO_INCREMENTAL: 0

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
toolchain: stable

# install linux dependencies
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-22.04' # This must match the platform value defined above.
if: matrix.os == 'ubuntu-latest' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: Run unit tests
run: cargo test --lib

policy-openfga:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Run model tests
uses: openfga/action-openfga-test@v0.1.1
# Installs the fga CLI directly. openfga/action-openfga-test is a composite action that
# pulls in further unpinned actions, which the org policy rejects.
- name: Install OpenFGA CLI
uses: jaxxstorm/action-install-gh-release@cd6b2b78ad38bdd294341cda064ec0692b06215b # v1.14.0
with:
store-file-path: ./delta-sharing/openfga/fga/dev.fga.yaml
repo: openfga/cli
tag: v0.8.1
cache: enable

- name: Run model tests
run: fga model test --tests ./delta-sharing/openfga/fga/dev.fga.yaml

- name: Install OpenFGA server
uses: jaxxstorm/action-install-gh-release@v1.14.0
uses: jaxxstorm/action-install-gh-release@cd6b2b78ad38bdd294341cda064ec0692b06215b # v1.14.0
with:
repo: openfga/openfga
tag: v1.8.0
Expand All @@ -118,7 +125,7 @@ jobs:
cargo test -p delta-sharing-openfga

integration:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

services:
postgres:
Expand All @@ -139,12 +146,13 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4

- name: Setup rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1
with:
toolchain: stable

# The app crate needs the GTK/WebKit system libraries, which this job does not install.
- name: Run integration tests
run: cargo test --tests --features integration-pg
run: cargo test --workspace --exclude app --tests --features integration-pg
2 changes: 2 additions & 0 deletions delta-sharing/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct InMemoryBackendConfig {

// storage crendentials

// Deserialized from the config file, so it is never constructed in code.
#[allow(dead_code)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Credential {
pub name: String,
Expand Down
2 changes: 1 addition & 1 deletion delta-sharing/cloud-client/src/aws/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@
self
}

/// If enabled, [`AmazonS3`] will not fetch credentials and will not sign requests

Check warning on line 554 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

unresolved link to `AmazonS3`

Check warning on line 554 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

unresolved link to `AmazonS3`

Check warning on line 554 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

unresolved link to `AmazonS3`
///
/// This can be useful when interacting with public S3 buckets that deny authorized requests
pub fn with_skip_signature(mut self, skip_signature: bool) -> Self {
Expand Down Expand Up @@ -655,7 +655,7 @@
self
}

/// Create a [`AmazonS3`] instance from the provided values,

Check warning on line 658 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

unresolved link to `AmazonS3`

Check warning on line 658 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

unresolved link to `AmazonS3`

Check warning on line 658 in delta-sharing/cloud-client/src/aws/builder.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

unresolved link to `AmazonS3`
/// consuming `self`.
pub fn build(self) -> Result<AmazonConfig> {
let region = self.region.unwrap_or_else(|| "us-east-1".to_string());
Expand Down Expand Up @@ -844,7 +844,7 @@
/// Whether these headers are sent depends on both the kind of encryption set
/// and the kind of request being made.
#[derive(Default, Clone, Debug)]
pub(super) struct S3EncryptionHeaders(pub HeaderMap);
pub(crate) struct S3EncryptionHeaders(pub HeaderMap);

impl S3EncryptionHeaders {
fn try_new(
Expand Down
7 changes: 2 additions & 5 deletions delta-sharing/cloud-client/src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/// This struct is used to maintain the URI path encoding
const STRICT_PATH_ENCODE_SET: percent_encoding::AsciiSet = STRICT_ENCODE_SET.remove(b'/');

/// [`CredentialProvider`] for [`AmazonS3`]

Check warning on line 26 in delta-sharing/cloud-client/src/aws/mod.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

unresolved link to `AmazonS3`

Check warning on line 26 in delta-sharing/cloud-client/src/aws/mod.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

unresolved link to `AmazonS3`

Check warning on line 26 in delta-sharing/cloud-client/src/aws/mod.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

unresolved link to `AmazonS3`
pub type AwsCredentialProvider = Arc<dyn CredentialProvider<Credential = AwsCredential>>;

const VERSION_HEADER: &str = "x-amz-version-id";
Expand Down Expand Up @@ -136,10 +136,7 @@
#[derive(Debug, thiserror::Error)]
pub enum RequestError {
#[error(transparent)]
Generic {
#[from]
source: crate::Error,
},
Generic(#[from] crate::Error),

#[error("Retry")]
Retry { source: crate::retry::Error },
Expand All @@ -148,7 +145,7 @@
impl From<RequestError> for crate::Error {
fn from(value: RequestError) -> Self {
match value {
RequestError::Generic { source } => source,
RequestError::Generic(source) => source,
RequestError::Retry { source } => source.error(),
}
}
Expand Down
24 changes: 12 additions & 12 deletions delta-sharing/cloud-client/src/azure/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,18 +280,18 @@ fn string_to_sign_service_sas(
signed_start,
signed_expiry,
canonicalized_resource,
"", // signed identifier
"", // signed ip
"", // signed protocol
&AZURE_VERSION.to_str().unwrap(), // signed version
signed_resource, // signed resource
"", // signed snapshot time
"", // signed encryption scope
"", // rscc - response header: Cache-Control
"", // rscd - response header: Content-Disposition
"", // rsce - response header: Content-Encoding
"", // rscl - response header: Content-Language
"", // rsct - response header: Content-Type
"", // signed identifier
"", // signed ip
"", // signed protocol
AZURE_VERSION.to_str().unwrap(), // signed version
signed_resource, // signed resource
"", // signed snapshot time
"", // signed encryption scope
"", // rscc - response header: Cache-Control
"", // rscd - response header: Content-Disposition
"", // rsce - response header: Content-Encoding
"", // rscl - response header: Content-Language
"", // rsct - response header: Content-Type
);

let mut pairs = HashMap::new();
Expand Down
7 changes: 2 additions & 5 deletions delta-sharing/cloud-client/src/gcp/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,8 @@ pub(crate) enum Error {
#[error("No RSA key found in pem file")]
MissingKey,

#[error("Invalid RSA key: {}", source)]
InvalidKey {
#[from]
source: ring::error::KeyRejected,
},
#[error("Invalid RSA key: {0}")]
InvalidKey(#[from] ring::error::KeyRejected),

#[error("Error signing: {}", source)]
Sign { source: ring::error::Unspecified },
Expand Down
3 changes: 3 additions & 0 deletions delta-sharing/cloud-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![allow(unused, dead_code)]
// `async_trait` adds `#[must_use]` to every trait method, which clippy reports as a duplicate of
// the `must_use` on the boxed future it returns. The attribute comes from the macro.
#![allow(clippy::double_must_use)]

use std::time::Duration;

Expand Down
2 changes: 1 addition & 1 deletion delta-sharing/cloud-client/src/retry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
Error::Reqwest { source, .. } if source.is_connect() => {
Self::new(ErrorKind::NotConnected, err)
}
_ => Self::new(ErrorKind::Other, err),
_ => Self::other(err),
}
}
}
Expand All @@ -141,7 +141,7 @@
/// * Timeouts for [safe] / read-only requests
///
/// Requests will be retried up to some limit, using exponential
/// backoff with jitter. See [`BackoffConfig`] for more information

Check warning on line 144 in delta-sharing/cloud-client/src/retry.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

public documentation for `RetryConfig` links to private item `BackoffConfig`

Check warning on line 144 in delta-sharing/cloud-client/src/retry.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

public documentation for `RetryConfig` links to private item `BackoffConfig`

Check warning on line 144 in delta-sharing/cloud-client/src/retry.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

public documentation for `RetryConfig` links to private item `BackoffConfig`
///
/// [safe]: https://datatracker.ietf.org/doc/html/rfc7231#section-4.2.1
#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion delta-sharing/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ futures = "0.3"

# in-memory handler dependencies (in alphabetical order)
dashmap = { version = "6", optional = true }
uuid = { version = "1" }
uuid = { version = "1", features = ["serde"] }

# axum handler dependencies (in alphabetical order)
axum = { version = "0.8", optional = true }
Expand Down
5 changes: 5 additions & 0 deletions delta-sharing/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// `async_trait` adds `#[must_use]` to every trait method, which clippy reports as a duplicate of
// the `must_use` on the boxed future it returns. The attribute comes from the macro, so it is
// allowed for the crate instead of on each trait.
#![allow(clippy::double_must_use)]

use std::sync::Arc;

pub mod api;
Expand Down
12 changes: 7 additions & 5 deletions delta-sharing/common/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ use crate::{

const MAX_PAGE_SIZE: usize = 10000;

type AssociationMap = DashMap<AssociationLabel, DashMap<Uuid, (Uuid, Option<PropertyMap>)>>;

/// An in-memory implementation of a resource store.
///
/// This store is not intended for production use, but is useful for testing and development.
#[derive(Debug, Clone)]
pub struct InMemoryResourceStore {
resources: Arc<DashMap<Uuid, Resource>>,
id_map: Arc<DashMap<ObjectLabel, DashMap<ResourceName, Uuid>>>,
associations: Arc<DashMap<AssociationLabel, DashMap<Uuid, (Uuid, Option<PropertyMap>)>>>,
associations: Arc<AssociationMap>,
secrets: Arc<DashMap<String, DashMap<Uuid, bytes::Bytes>>>,
}

Expand Down Expand Up @@ -162,8 +164,8 @@ impl ResourceStore for InMemoryResourceStore {
map.value()
.iter()
.filter(|entry| {
namespace.is_none_or(|ns| entry.key().prefix_matches(ns))
&& page_token.is_none_or(|t| &t > entry.value())
namespace.map_or(true, |ns| entry.key().prefix_matches(ns))
&& page_token.map_or(true, |t| &t > entry.value())
})
.map(|entry| *entry.value())
.collect::<Vec<_>>()
Expand Down Expand Up @@ -272,8 +274,8 @@ impl ResourceStore for InMemoryResourceStore {
.get(&resource_uuid)
.iter()
.filter(|entry| {
target_uuid.is_none_or(|uuid| entry.value().0 == uuid)
&& page_token.is_none_or(|t| &t > entry.key())
target_uuid.map_or(true, |uuid| entry.value().0 == uuid)
&& page_token.map_or(true, |t| &t > entry.key())
})
.map(|entry| entry.value().0)
.collect::<Vec<_>>()
Expand Down
Loading
Loading