Something went wrong. Try again.
A lexicon-driven AppView for ATProto.
Something went wrong. Try again.
Rust
1234567891011121314151617181920212223242526272829303132333435363738394041424344mod bindings;mod http;mod kv;mod logging;mod lookup;mod secrets;
pub use bindings::{PluginState, register_host_functions};pub use http::*;pub use kv::*;pub use logging::*;pub use lookup::*;pub use secrets::*;
use std::collections::HashMap;use std::sync::Arc;
/// Context passed to all host function callspub struct HostContext { pub plugin_id: String, pub scope: String, // user DID or OAuth state pub secrets: HashMap<String, String>, pub config: serde_json::Value, pub db: sqlx::AnyPool, pub db_backend: crate::db::DatabaseBackend, pub http_client: reqwest::Client, pub lexicons: Arc<crate::lexicon::LexiconRegistry>,}
/// Resource usage tracking for limits#[derive(Default)]pub struct ResourceUsage { pub http_requests: u32, pub http_bytes_transferred: u64, pub kv_bytes_used: u64,}
/// Resource limits from specpub const MAX_HTTP_REQUESTS: u32 = 100;pub const MAX_HTTP_RESPONSE_SIZE: u64 = 100 * 1024 * 1024; // 100 MBpub const MAX_HTTP_TOTAL_TRANSFER: u64 = 500 * 1024 * 1024; // 500 MBpub const MAX_HTTP_CONCURRENT: usize = 5;pub const MAX_KV_SIZE_PER_USER: u64 = 1024 * 1024; // 1 MB