Skip to main content
Glama

Convex MCP server

Official
by get-convex
split_rw_lock.rs1.11 kB
use std::sync::Arc; use parking_lot::{ RwLock, RwLockReadGuard, RwLockWriteGuard, }; /// Create a "split" lock with a reader half and a writer half. The reader /// implements `Clone`, but the writer is unique. pub fn new_split_rw_lock<T>(value: T) -> (Reader<T>, Writer<T>) { let inner = Arc::new(RwLock::new(value)); ( Reader { inner: inner.clone(), }, Writer { inner }, ) } pub struct Reader<T> { pub(crate) inner: Arc<RwLock<T>>, } impl<T> Clone for Reader<T> { fn clone(&self) -> Self { Self { inner: self.inner.clone(), } } } impl<T> Reader<T> { pub fn lock(&self) -> RwLockReadGuard<'_, T> { self.inner.read() } } pub struct Writer<T> { pub(crate) inner: Arc<RwLock<T>>, } impl<T> Writer<T> { pub fn reader(&self) -> Reader<T> { Reader { inner: self.inner.clone(), } } pub fn write(&mut self) -> RwLockWriteGuard<'_, T> { self.inner.write() } pub fn read(&self) -> RwLockReadGuard<'_, T> { self.inner.read() } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/get-convex/convex-backend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server