diff --git a/server/src/browser-management/classes/BrowserPool.ts b/server/src/browser-management/classes/BrowserPool.ts index 5244fcea..bac06d2f 100644 --- a/server/src/browser-management/classes/BrowserPool.ts +++ b/server/src/browser-management/classes/BrowserPool.ts @@ -31,3 +31,32 @@ interface PoolDictionary { [key: string]: BrowserPoolInfo, } +/** + * A browser pool is a collection of remote browsers that are initialized and ready to be used. + * Enforces a "1 User - 1 Browser" policy, while allowing multiple users to have their own browser instances. + * Adds the possibility to add, remove and retrieve remote browsers from the pool. + * @category BrowserManagement + */ +export class BrowserPool { + /** + * Holds all the instances of remote browsers. + */ + private pool: PoolDictionary = {}; + + /** + * Maps user IDs to their browser IDs. + */ + private userToBrowserMap: Map = new Map(); + + /** + * Adds a remote browser instance to the pool for a specific user. + * If the user already has a browser, the existing browser will be closed and replaced. + * + * @param id remote browser instance's id + * @param browser remote browser instance + * @param userId the user ID that owns this browser instance + * @param active states if the browser's instance is being actively used + * @returns true if a new browser was added, false if an existing browser was replaced + */ + +} \ No newline at end of file