summaryrefslogtreecommitdiff
path: root/vendor/logos-codegen/src/leaf.rs
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-15 16:37:08 -0600
committermo khan <mo@mokhan.ca>2025-07-17 16:30:22 -0600
commit45df4d0d9b577fecee798d672695fe24ff57fb1b (patch)
tree1b99bf645035b58e0d6db08c7a83521f41f7a75b /vendor/logos-codegen/src/leaf.rs
parentf94f79608393d4ab127db63cc41668445ef6b243 (diff)
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.
Diffstat (limited to 'vendor/logos-codegen/src/leaf.rs')
-rw-r--r--vendor/logos-codegen/src/leaf.rs118
1 files changed, 0 insertions, 118 deletions
diff --git a/vendor/logos-codegen/src/leaf.rs b/vendor/logos-codegen/src/leaf.rs
deleted file mode 100644
index 5e0b810e..00000000
--- a/vendor/logos-codegen/src/leaf.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-use std::cmp::{Ord, Ordering};
-use std::fmt::{self, Debug, Display};
-
-use proc_macro2::{Span, TokenStream};
-use syn::{spanned::Spanned, Ident};
-
-use crate::graph::{Disambiguate, Node};
-use crate::util::MaybeVoid;
-
-#[derive(Clone)]
-pub struct Leaf<'t> {
- pub ident: Option<&'t Ident>,
- pub span: Span,
- pub priority: usize,
- pub field: MaybeVoid,
- pub callback: Option<Callback>,
-}
-
-#[derive(Clone)]
-pub enum Callback {
- Label(TokenStream),
- Inline(Box<InlineCallback>),
- Skip(Span),
-}
-
-#[derive(Clone)]
-pub struct InlineCallback {
- pub arg: Ident,
- pub body: TokenStream,
- pub span: Span,
-}
-
-impl From<InlineCallback> for Callback {
- fn from(inline: InlineCallback) -> Callback {
- Callback::Inline(Box::new(inline))
- }
-}
-
-impl Callback {
- pub fn span(&self) -> Span {
- match self {
- Callback::Label(tokens) => tokens.span(),
- Callback::Inline(inline) => inline.span,
- Callback::Skip(span) => *span,
- }
- }
-}
-
-impl<'t> Leaf<'t> {
- pub fn new(ident: &'t Ident, span: Span) -> Self {
- Leaf {
- ident: Some(ident),
- span,
- priority: 0,
- field: MaybeVoid::Void,
- callback: None,
- }
- }
-
- pub fn new_skip(span: Span) -> Self {
- Leaf {
- ident: None,
- span,
- priority: 0,
- field: MaybeVoid::Void,
- callback: Some(Callback::Skip(span)),
- }
- }
-
- pub fn callback(mut self, callback: Option<Callback>) -> Self {
- self.callback = callback;
- self
- }
-
- pub fn field(mut self, field: MaybeVoid) -> Self {
- self.field = field;
- self
- }
-
- pub fn priority(mut self, priority: usize) -> Self {
- self.priority = priority;
- self
- }
-}
-
-impl Disambiguate for Leaf<'_> {
- fn cmp(left: &Leaf, right: &Leaf) -> Ordering {
- Ord::cmp(&left.priority, &right.priority)
- }
-}
-
-impl<'t> From<Leaf<'t>> for Node<Leaf<'t>> {
- fn from(leaf: Leaf<'t>) -> Self {
- Node::Leaf(leaf)
- }
-}
-
-impl Debug for Leaf<'_> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "::{}", self)?;
-
- match self.callback {
- Some(Callback::Label(ref label)) => write!(f, " ({})", label),
- Some(Callback::Inline(_)) => f.write_str(" (<inline>)"),
- Some(Callback::Skip(_)) => f.write_str(" (<skip>)"),
- None => Ok(()),
- }
- }
-}
-
-impl Display for Leaf<'_> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- match self.ident {
- Some(ident) => Display::fmt(ident, f),
- None => f.write_str("<skip>"),
- }
- }
-}