From 45df4d0d9b577fecee798d672695fe24ff57fb1b Mon Sep 17 00:00:00 2001 From: mo khan Date: Tue, 15 Jul 2025 16:37:08 -0600 Subject: feat: migrate from Cedar to SpiceDB authorization system This is a major architectural change that replaces the Cedar policy-based authorization system with SpiceDB's relation-based authorization. Key changes: - Migrate from Rust to Go implementation - Replace Cedar policies with SpiceDB schema and relationships - Switch from envoy `ext_authz` with Cedar to SpiceDB permission checks - Update build system and dependencies for Go ecosystem - Maintain Envoy integration for external authorization This change enables more flexible permission modeling through SpiceDB's Google Zanzibar inspired relation-based system, supporting complex hierarchical permissions that were difficult to express in Cedar. Breaking change: Existing Cedar policies and Rust-based configuration will no longer work and need to be migrated to SpiceDB schema. --- vendor/itertools/src/zip_longest.rs | 139 ------------------------------------ 1 file changed, 139 deletions(-) delete mode 100644 vendor/itertools/src/zip_longest.rs (limited to 'vendor/itertools/src/zip_longest.rs') diff --git a/vendor/itertools/src/zip_longest.rs b/vendor/itertools/src/zip_longest.rs deleted file mode 100644 index d4eb9a88..00000000 --- a/vendor/itertools/src/zip_longest.rs +++ /dev/null @@ -1,139 +0,0 @@ -use super::size_hint; -use std::cmp::Ordering::{Equal, Greater, Less}; -use std::iter::{Fuse, FusedIterator}; - -use crate::either_or_both::EitherOrBoth; - -// ZipLongest originally written by SimonSapin, -// and dedicated to itertools https://github.com/rust-lang/rust/pull/19283 - -/// An iterator which iterates two other iterators simultaneously -/// and wraps the elements in [`EitherOrBoth`]. -/// -/// This iterator is *fused*. -/// -/// See [`.zip_longest()`](crate::Itertools::zip_longest) for more information. -#[derive(Clone, Debug)] -#[must_use = "iterator adaptors are lazy and do nothing unless consumed"] -pub struct ZipLongest { - a: Fuse, - b: Fuse, -} - -/// Create a new `ZipLongest` iterator. -pub fn zip_longest(a: T, b: U) -> ZipLongest -where - T: Iterator, - U: Iterator, -{ - ZipLongest { - a: a.fuse(), - b: b.fuse(), - } -} - -impl Iterator for ZipLongest -where - T: Iterator, - U: Iterator, -{ - type Item = EitherOrBoth; - - #[inline] - fn next(&mut self) -> Option { - match (self.a.next(), self.b.next()) { - (None, None) => None, - (Some(a), None) => Some(EitherOrBoth::Left(a)), - (None, Some(b)) => Some(EitherOrBoth::Right(b)), - (Some(a), Some(b)) => Some(EitherOrBoth::Both(a, b)), - } - } - - #[inline] - fn size_hint(&self) -> (usize, Option) { - size_hint::max(self.a.size_hint(), self.b.size_hint()) - } - - #[inline] - fn fold(self, init: B, mut f: F) -> B - where - Self: Sized, - F: FnMut(B, Self::Item) -> B, - { - let Self { mut a, mut b } = self; - let res = a.try_fold(init, |init, a| match b.next() { - Some(b) => Ok(f(init, EitherOrBoth::Both(a, b))), - None => Err(f(init, EitherOrBoth::Left(a))), - }); - match res { - Ok(acc) => b.map(EitherOrBoth::Right).fold(acc, f), - Err(acc) => a.map(EitherOrBoth::Left).fold(acc, f), - } - } -} - -impl DoubleEndedIterator for ZipLongest -where - T: DoubleEndedIterator + ExactSizeIterator, - U: DoubleEndedIterator + ExactSizeIterator, -{ - #[inline] - fn next_back(&mut self) -> Option { - match self.a.len().cmp(&self.b.len()) { - Equal => match (self.a.next_back(), self.b.next_back()) { - (None, None) => None, - (Some(a), Some(b)) => Some(EitherOrBoth::Both(a, b)), - // These can only happen if .len() is inconsistent with .next_back() - (Some(a), None) => Some(EitherOrBoth::Left(a)), - (None, Some(b)) => Some(EitherOrBoth::Right(b)), - }, - Greater => self.a.next_back().map(EitherOrBoth::Left), - Less => self.b.next_back().map(EitherOrBoth::Right), - } - } - - fn rfold(self, mut init: B, mut f: F) -> B - where - F: FnMut(B, Self::Item) -> B, - { - let Self { mut a, mut b } = self; - let a_len = a.len(); - let b_len = b.len(); - match a_len.cmp(&b_len) { - Equal => {} - Greater => { - init = a - .by_ref() - .rev() - .take(a_len - b_len) - .map(EitherOrBoth::Left) - .fold(init, &mut f) - } - Less => { - init = b - .by_ref() - .rev() - .take(b_len - a_len) - .map(EitherOrBoth::Right) - .fold(init, &mut f) - } - } - a.rfold(init, |acc, item_a| { - f(acc, EitherOrBoth::Both(item_a, b.next_back().unwrap())) - }) - } -} - -impl ExactSizeIterator for ZipLongest -where - T: ExactSizeIterator, - U: ExactSizeIterator, -{ -} - -impl FusedIterator for ZipLongest -where - T: Iterator, - U: Iterator, -{ -} -- cgit v1.2.3