Skip to main content
Glama
lock-manager.d.ts1.67 kB
/** * Agent Synch MCP Server - Lock Manager * Handles file locking and queuing for concurrent agent access. */ export interface LockInfo { resourceId: string; agentId: string; acquiredAt: string; expiresAt: string; operation: string; } export interface QueueEntry { agentId: string; resourceId: string; requestedAt: string; operation: string; resolve: (acquired: boolean) => void; } /** * LockManager - Handles concurrent access to shared resources. * Uses in-memory locks with file-based persistence for crash recovery. */ export declare class LockManager { private locks; private queues; private lockDir; private defaultTimeoutMs; constructor(baseDir: string, timeoutMs?: number); initialize(): Promise<void>; /** * Acquire a lock on a resource. Returns immediately if available, * otherwise queues the request and waits. */ acquireLock(resourceId: string, agentId: string, operation: string, timeoutMs?: number): Promise<boolean>; private doAcquireLock; private queueForLock; /** * Release a lock and process the queue. */ releaseLock(resourceId: string, agentId: string): Promise<boolean>; private processQueue; private extendLock; /** * Get current lock status for a resource. */ getLockStatus(resourceId: string): LockInfo | null; /** * Get queue length for a resource. */ getQueueLength(resourceId: string): number; /** * Get all active locks. */ getAllLocks(): LockInfo[]; private lockFilePath; private persistLock; private removeLockFile; private recoverLocks; }

Latest Blog Posts

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/Mnehmos/mnehmos.synch.mcp'

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