Struct aruna_cache::cache::Cache

source ·
pub struct Cache {
    pub graph_cache: DashMap<Resource, DashSet<Resource, RandomState>, RandomState>,
    pub name_cache: DashMap<String, DashSet<Resource, RandomState>, RandomState>,
    pub shared_to_pid: DashMap<DieselUlid, Resource, RandomState>,
    pub pid_to_shared: DashMap<DieselUlid, Resource, RandomState>,
    pub object_cache: DashMap<Resource, ApiResource, RandomState>,
    pub permissions: DashMap<DieselUlid, DashMap<ResourcePermission, PermissionLevel, RandomState>, RandomState>,
    pub pubkeys: DashMap<i32, PubKey, RandomState>,
    pub oidc_ids: DashMap<String, (DieselUlid, String), RandomState>,
    pub token_ids: DashMap<DieselUlid, DieselUlid, RandomState>,
}

Fields§

§graph_cache: DashMap<Resource, DashSet<Resource, RandomState>, RandomState>§name_cache: DashMap<String, DashSet<Resource, RandomState>, RandomState>§shared_to_pid: DashMap<DieselUlid, Resource, RandomState>§pid_to_shared: DashMap<DieselUlid, Resource, RandomState>§object_cache: DashMap<Resource, ApiResource, RandomState>§permissions: DashMap<DieselUlid, DashMap<ResourcePermission, PermissionLevel, RandomState>, RandomState>§pubkeys: DashMap<i32, PubKey, RandomState>§oidc_ids: DashMap<String, (DieselUlid, String), RandomState>§token_ids: DashMap<DieselUlid, DieselUlid, RandomState>

Implementations§

source§

impl Cache

source

pub fn new() -> Self

source

pub fn traverse_graph( &self, from: &Resource ) -> Result<Vec<(Resource, Resource)>>

source

pub fn get_parents_with_targets( &self, from: &Resource, targets: Vec<Resource> ) -> Result<()>

source

pub fn get_parents(&self, from: &Resource) -> Result<Vec<(Resource, Resource)>>

source

pub fn remove_all_res(&self, res: Resource)

source

pub fn add_name(&self, res: Resource, name: String)

source

pub fn remove_name(&self, res: Resource, name: Option<String>)

source

pub fn add_or_update_shared( &self, shared: DieselUlid, persistent: DieselUlid, variant: ResourceVariant ) -> Result<()>

source

pub fn get_persistent(&self, shared: &DieselUlid) -> Option<Resource>

source

pub fn get_shared(&self, persistent: &DieselUlid) -> Option<Resource>

source

pub fn add_or_update_permission( &self, id: DieselUlid, perm: (ResourcePermission, PermissionLevel) )

source

pub fn remove_permission( &self, id: DieselUlid, res: Option<ResourcePermission>, full_entry: bool )

source

pub fn get_permissions( &self, id: &DieselUlid ) -> Option<Vec<(ResourcePermission, PermissionLevel)>>

source

pub fn add_pubkey(&self, id: i32, pk: PubKey)

source

pub fn remove_pubkey(&self, id: i32)

source

pub fn set_pubkeys(&self, pks: Vec<Pubkey>)

source

pub fn get_pubkeys(&self) -> Vec<PubKey>

source

pub fn add_oidc(&self, oidc_id: String, user_id: DieselUlid, url: String)

source

pub fn remove_oidc(&self, oidc_id: &str)

source

pub fn get_user_perm_by_oidc( &self, oidc_id: &str ) -> Option<Vec<(ResourcePermission, PermissionLevel)>>

source

pub fn add_user_token(&self, token_id: DieselUlid, user_id: DieselUlid)

source

pub fn remove_user_token(&self, token_id: DieselUlid)

source

pub fn get_user_by_token(&self, token_id: DieselUlid) -> Option<DieselUlid>

source

pub fn remove_all_tokens_by_user(&self, user_id: DieselUlid)

source

pub fn parse_and_update_user_info(&self, uinfo: User) -> Option<()>

source

pub fn process_api_resource_update( &self, res: ApiResource, shared_id: DieselUlid, persistent_resource: Resource ) -> Result<()>

Trait Implementations§

source§

impl Debug for Cache

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Cache

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Cache

§

impl Send for Cache

§

impl Sync for Cache

§

impl Unpin for Cache

§

impl UnwindSafe for Cache

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<T> IntoSql for T

§

fn into_sql<T>(self) -> Self::Expressionwhere Self: AsExpression<T> + Sized, T: SqlType + TypedExpressionType,

Convert self to an expression for Diesel’s query builder. Read more
§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expressionwhere &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more