text stringlengths 70 351k | source stringclasses 4
values |
|---|---|
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/request_id.rs | crate: src
use hyper::Request;
use tower_http::request_id::{MakeRequestId, RequestId};
fn make_request_id<B>(&mut self, _request: &Request<B>) -> Option<RequestId> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto.rs | crate: src
use std::{ops::Deref, sync::Arc};
use crate::errors::{self, CustomResult};
pub type Backend = dyn KeyManagement + Send + Sync;
pub fn client(&self) -> &Arc<Backend> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto.rs | crate: src
use std::{ops::Deref, sync::Arc};
pub type Backend = dyn KeyManagement + Send + Sync;
pub fn new(client: Arc<Backend>) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto.rs | crate: src
use masking::StrongSecret;
use crate::errors::{self, CustomResult};
async fn decrypt_key(
&self,
input: StrongSecret<Vec<u8>>,
) -> CustomResult<StrongSecret<Vec<u8>>, errors::CryptoError> {
{<|fim_suffix|>
<|fim_middl... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto.rs | crate: src
use masking::StrongSecret;
use crate::errors::{self, CustomResult};
async fn encrypt_key(
&self,
input: StrongSecret<Vec<u8>>,
) -> CustomResult<StrongSecret<Vec<u8>>, errors::CryptoError> {
<|fim_suffix|>
<|fim_middle... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto.rs | crate: src
use masking::StrongSecret;
use crate::errors::{self, CustomResult};
async fn generate_key(
&self,
) -> CustomResult<(Source, StrongSecret<[u8; 32]>), errors::CryptoError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/multitenancy.rs | crate: src
use crate::{
app::{AppState, SessionState, StorageState},
consts::TENANT_HEADER,
errors::{self, ApiErrorContainer, SwitchError, ToContainerError},
};
use error_stack::ResultExt;
use hyper::header;
pub type MultiTenant<T>... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/multitenancy.rs | crate: src
use crate::{
app::{AppState, SessionState, StorageState},
consts::TENANT_HEADER,
errors::{self, ApiErrorContainer, SwitchError, ToContainerError},
};
use error_stack::ResultExt;
use hyper::header;
use std::sync::Arc;
asy... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/multitenancy.rs | crate: src
use crate::{
app::{AppState, SessionState, StorageState},
consts::TENANT_HEADER,
errors::{self, ApiErrorContainer, SwitchError, ToContainerError},
};
pub type MultiTenant<T> = FxHashMap<TenantId, T>;
pub(crate) fn get_db... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/multitenancy.rs | crate: src
use crate::{
app::{AppState, SessionState, StorageState},
consts::TENANT_HEADER,
errors::{self, ApiErrorContainer, SwitchError, ToContainerError},
};
use std::sync::Arc;
pub type MultiTenant<T> = FxHashMap<TenantId, T>;
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/multitenancy.rs | crate: src
pub type MultiTenant<T> = FxHashMap<TenantId, T>;
pub fn new(val: String) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/blake3.rs | crate: src
use masking::{PeekInterface, Secret, StrongSecret};
pub fn hash(&self, token: Secret<String>) -> [u8; 32] {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use core::fmt;
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, Sealing... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use core::fmt;
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, Sealing... | ast_fragments |
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey};
fn advance(&... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey};
/// Constructs a nonce sequence from bytes
fn from_bytes(bytes: [u8; aead::NONCE_LEN]) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use error_stack::ResultExt;
use core::fmt;
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use masking::PeekInterfa... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use error_stack::ResultExt;
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use masking::StrongSecret;
pub async fn from_vec(
key: StrongSecret<Vec<u8>>,
) -> errors::CustomR... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use masking::StrongSecret;
pub fn new(key: StrongSecret<[u8; 32]>) -> errors::CustomResult<Self, errors::CryptoError> {
{<|fim_suffix|>
<|... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/aes256.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
};
use serde::de::{self, Deserialize, Deserializer, Unexpected, Visitor};
use ring::aead::{self, BoundKey, OpeningKey, SealingKey, UnboundKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/kms.rs | crate: src
use crate::{
crypto::{Crypto, Source},
errors::{self, CustomResult, SwitchError},
services::aws::AwsKmsClient,
};
use aws_sdk_kms::primitives::Blob;
use masking::{PeekInterface, StrongSecret};
async fn generate_key(
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/vault.rs | crate: src
use crate::consts::base64::BASE64_ENGINE;
use crate::errors::{self, CryptoError, CustomResult};
use error_stack::report;
use masking::{PeekInterface, StrongSecret};
use std::pin::Pin;
use vaultrs::{api, transit};
fn decrypt(&self, i... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/crypto/vault.rs | crate: src
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
pub fn new(settings: VaultSettings) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/types/requests/encryption.rs | crate: src
use crate::types::{core::Identifier, method::EncryptionType};
fn test_enc_request_deserialize() {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/health.rs | crate: src
use crate::{app::AppState, env::observability as logger, metrics};
use axum::extract::State;
use std::sync::Arc;
pub(crate) async fn heath_check(
State(_): State<Arc<AppState>>,
) -> (hyper::StatusCode, &'static str) {
{<|fim_suf... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/custodian.rs | crate: src
use base64::Engine;
use error_stack::{ensure, ResultExt};
use hyper::header;
use crate::consts::base64::BASE64_ENGINE;
use crate::errors::{ApiErrorContainer, CustomResult, ParsingError, SwitchError, ToContainerError};
fn ex... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/custodian.rs | crate: src
use std::sync::Arc;
use axum::http::request;
use hyper::header;
use crate::app::AppState;
async fn from_request_parts(
parts: &mut request::Parts,
_state: &Arc<AppState>,
) -> Result<Self, Self::Rejectio... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/custodian.rs | crate: src
use masking::{PeekInterface, Secret, StrongSecret};
use crate::multitenancy::TenantState;
pub fn into_access_token(self, state: &TenantState) -> Option<StrongSecret<String>> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/custodian.rs | crate: src
use masking::{PeekInterface, Secret, StrongSecret};
pub fn new(keys: Option<(String, String)>) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use error_stack::ensure;
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKeyNew},
types::{
key::Version,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use error_stack::ensure;
use rustc_hash::{FxHashMap, FxHashSet};
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use error_stack::ensure;
use rustc_hash::{FxHashMap, FxHashSet};
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKey... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use error_stack::ensure;
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKeyNew},
types::{
key::Version,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use error_stack::ensure;
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKeyNew},
types::{
key::Version,... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/core/crypto/crux.rs | crate: src
use crate::{
crypto::{aes256::GcmAes256, Crypto, Source},
errors::{self, SwitchError},
multitenancy::TenantState,
storage::types::{DataKey, DataKeyNew},
types::{
key::Version, DecryptedData, Decrypted... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/storage/types/dek.rs | crate: src
fn from(value: DataKeyNew) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/storage/adapter/cassandra.rs | crate: src
use crate::storage::{adapter::Cassandra, errors, Config, DbState};
async fn get_conn<'a>(
&'a self,
) -> errors::CustomResult<Self::Conn<'a>, errors::ConnectionError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/storage/adapter/cassandra.rs | crate: src
use crate::storage::{adapter::Cassandra, errors, Config, DbState};
async fn from_config(config: &Config, schema: &str) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/env/metrics.rs | crate: src
use opentelemetry_sdk::{metrics::SdkMeterProvider, Resource};
fn drop(&mut self) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/env/metrics.rs | crate: src
use opentelemetry::global;
use opentelemetry_sdk::{metrics::SdkMeterProvider, Resource};
use prometheus::default_registry;
pub(super) fn setup_metrics_pipeline() -> MetricsGuard {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/errors/crypto.rs | crate: src
use error_stack::report;
use crate::env::observability as logger;
fn switch(self) -> super::CustomResult<T, CryptoError> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch-encryption-service/src/errors/crypto.rs | crate: src
fn switch(self) -> super::CustomResult<T, CryptoError> {
self.map_err(|err| err.change_context(CryptoError::InvalidValue))
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/errors/crypto.rs | crate: src
use error_stack::report;
fn switch(self) -> super::CustomResult<(), CryptoError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch-encryption-service/src/routes/datakey.rs | crate: src
use axum::{routing::post, Router};
use std::sync::Arc;
use crate::{app::AppState, core};
pub fn server(state: Arc<AppState>) -> Router<Arc<AppState>> {
Router::new()
.route("/create", post(core::create_data_key))
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch-encryption-service/src/routes/crypto.rs | crate: src
use crate::{app::AppState, core};
use axum::{routing::post, Router};
use std::sync::Arc;
pub fn server(state: Arc<AppState>) -> Router<Arc<AppState>> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/mock_db.rs | crate: storage_impl
use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState};
use futures::lock::{Mutex, MutexGuard};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_key_store::Merc... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/mock_db.rs | crate: storage_impl
use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState};
use futures::lock::{Mutex, MutexGuard};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_key_store::Merc... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/mock_db.rs | crate: storage_impl
use std::sync::Arc;
use error_stack::ResultExt;
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_key_store::MerchantKeyStore,
payments::{payment_attempt::PaymentAttempt, PaymentI... | ast_fragments |
// file: hyperswitch/crates/storage_impl/src/mock_db.rs | crate: storage_impl
use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState};
use futures::lock::{Mutex, MutexGuard};
use hyperswitch_domain_models::{
behaviour::{Conversion, ReverseConversion},
merchant_key_store::MerchantKeyStore,
... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/callback_mapper.rs | crate: storage_impl
fn from_storage_model(storage_model: Self::StorageModel) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/storage_impl/src/callback_mapper.rs | crate: storage_impl
use diesel_models::callback_mapper::CallbackMapper as DieselCallbackMapper;
fn to_storage_model(self) -> Self::StorageModel {
DieselCallbackMapper {
id: self.id,
type_: self.type_,
data: sel... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
fn from(value: QueueStrategy) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
fn get_dbname(&self) -> &str {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
fn get_port(&self) -> u16 {
self.port
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
fn get_host(&self) -> &str {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
use masking::Secret;
fn get_password(&self) -> Secret<String> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/config.rs | crate: storage_impl
fn get_username(&self) -> &str {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/connection.rs | crate: storage_impl
use bb8::PooledConnection;
use common_utils::errors;
use diesel::PgConnection;
pub type PgPool = bb8::Pool<async_bb8_diesel::ConnectionManager<PgConnection>>;
pub type PgPooledConn = async_bb8_diesel::Connection<PgConnection... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/connection.rs | crate: storage_impl
use bb8::PooledConnection;
use common_utils::errors;
use diesel::PgConnection;
pub type PgPool = bb8::Pool<async_bb8_diesel::ConnectionManager<PgConnection>>;
pub type PgPooledConn = async_bb8_diesel::Connection<PgConnection... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/connection.rs | crate: storage_impl
pub type PgPool = bb8::Pool<async_bb8_diesel::ConnectionManager<PgConnection>>;
pub type PgPooledConn = async_bb8_diesel::Connection<PgConnection>;
pub async fn redis_connection(
redis: &redis_interface::RedisSettings,
)... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/redis.rs | crate: storage_impl
use std::sync::{atomic, Arc};
use self::{kv_store::RedisConnInterface, pub_sub::PubSubInterface};
fn get_redis_conn(
&self,
) -> error_stack::Result<
Arc<redis_interface::RedisConnectionPool>,
redis_in... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/redis.rs | crate: storage_impl
use std::sync::{atomic, Arc};
use self::{kv_store::RedisConnInterface, pub_sub::PubSubInterface};
pub fn set_error_callback(&self, callback: tokio::sync::oneshot::Sender<()>) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/redis.rs | crate: storage_impl
use std::sync::{atomic, Arc};
pub async fn new(
conf: &redis_interface::RedisSettings,
) -> error_stack::Result<Self, redis_interface::errors::RedisError> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/storage_impl/src/mock_db/redis_conn.rs | crate: storage_impl
use std::sync::Arc;
use redis_interface::errors::RedisError;
use crate::redis::kv_store::RedisConnInterface;
fn get_redis_conn(
&self,
) -> Result<Arc<redis_interface::RedisConnectionPool>, error_stack::R... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/consts.rs | crate: common_utils
/// Default limit for payouts list API
pub fn default_payouts_list_limit() -> u32 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/consts.rs | crate: common_utils
/// Default limit for payments list API
pub fn default_payments_list_limit() -> u32 {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/common_utils/src/events.rs | crate: common_utils
fn get_api_event_type(&self) -> Option<ApiEventsType> {
Some(ApiEventsType::Miscellaneous)
} | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/fp_utils.rs | crate: common_utils
/// This function wraps the evaluated result of `f` into current context,
/// based on the condition provided into the `predicate`
pub fn when<W: Applicative<(), WrappedSelf<()> = W>, F>(predicate: bool, f: F) -> W
where
F... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/fp_utils.rs | crate: common_utils
fn pure(v: R) -> Self::WrappedSelf<R> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
/// Hollow implementation, for windows compatibility
pub fn close(self) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
/// Dummy handler for signals in windows (empty)
pub fn handle(&self) -> Self {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
pub fn get_allowed_signals() -> Result<DummySignal, std::io::Error> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
pub fn get_allowed_signals() -> Result<signal_hook_tokio::SignalsInfo, std::io::Error> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
use tokio::sync::mpsc;
pub async fn signal_handler(_sig: DummySignal, _sender: mpsc::Sender<()>) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/signals.rs | crate: common_utils
use router_env::logger;
use tokio::sync::mpsc;
pub async fn signal_handler(mut sig: signal_hook_tokio::Signals, sender: mpsc::Sender<()>) {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/access_token.rs | crate: common_utils
use std::fmt::Display;
use crate::id_type;
/// Create a key for fetching the access token from redis
pub fn create_access_token_key(
merchant_id: &id_type::MerchantId,
merchant_connector_id_or_connector_name: impl ... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/hashing.rs | crate: common_utils
use masking::{PeekInterface, Secret, Strategy};
fn from(value: Secret<String, T>) -> Self {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
// file: hyperswitch/crates/common_utils/src/hashing.rs | crate: common_utils
use serde::{Deserialize, Serialize, Serializer};
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let hashed_value = blake3::hash(self.0.peek().as_bytes()).to_hex();
hashe... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/errors.rs | crate: common_utils
pub type CustomResult<T, E> = error_stack::Result<T, E>;
fn switch(&self) -> T {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/errors.rs | crate: common_utils
pub type CustomResult<T, E> = error_stack::Result<T, E>;
fn switch(self) -> Result<T, error_stack::Report<U>> {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use core::fmt::Debug;
use std::str::FromStr;
use http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use router_env::{instrument, logger, tracing};
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
err... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use std::str::FromStr;
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, DecryptDataRequest,
EncryptionCreateRequest... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, Decryp... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, Decryp... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use masking::{PeekInterface, StrongSecret};
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, DecryptDataRequest,
En... | ast_fragments |
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, DecryptDataRequest,
EncryptionCreateRequest, EncryptionTransferRequest, GetKeyman... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/keymanager.rs | crate: common_utils
use http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
use crate::{
consts::{BASE64_ENGINE, TENANT_HEADER},
errors,
types::keymanager::{
BatchDecryptDataRequest, DataKeyCreateResponse, Decryp... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/metrics/utils.rs | crate: common_utils
use std::time;
use router_env::opentelemetry;
pub async fn record_operation_time<F, R>(
future: F,
metric: &opentelemetry::metrics::Histogram<f64>,
key_value: &[opentelemetry::KeyValue],
) -> R
where
F: fu... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/metrics/utils.rs | crate: common_utils
use std::time;
pub async fn time_future<F, R>(future: F) -> (R, time::Duration)
where
F: futures::Future<Output = R>,
{
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
/// Get higher lineages from the current lineage
pub fn get_same_and_higher_lineages(self) -> Vec<Self> {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Get the profile_id from the lineage
pub fn profile_id(&self) -> Option<&id_type::ProfileId> {
<|fim_suffix|>
<|fim_middl... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Get the merchant_id from the lineage
pub fn merchant_id(&self) -> Option<&id_type::MerchantId> {
<|fim_suffix|>
<|fim_mi... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Get the org_id from the lineage
pub fn org_id(&self) -> Option<&id_type::OrganizationId> {
{
Self::Tenant { .. } => None... | ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Get the tenant_id from the lineage
pub fn tenant_id(&self) -> &id_type::TenantId {
{<|fim_suffix|>
<|fim_middle|>
}}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use common_enums::EntityType;
/// Get the entity_type from the lineage
pub fn entity_type(&self) -> EntityType {
<|fim_suffix|>
<|fim_middle|>
}
| ast_fragments |
<|fim_prefix|>
// file: hyperswitch/crates/common_utils/src/types/theme.rs | crate: common_utils
use common_enums::EntityType;
use crate::{
events::{ApiEventMetric, ApiEventsType},
id_type, impl_api_event_type,
};
/// Constructor for ThemeLineage
pub fn new(
entity_type: EntityType,
tenant_i... | ast_fragments |
// file: hyperswitch/crates/common_utils/src/types/primitive_wrappers.rs | crate: common_utils
fn to_sql<'b>(
&'b self,
out: &mut diesel::serialize::Output<'b, '_, DB>,
) -> diesel::serialize::Result {
self.0.to_sql(out)
} | ast_fragments |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.