Datalayer VS Code Extension - v0.0.6
    Preparing search index...

    Mutable service manager wrapper that maintains a stable reference while allowing the underlying service manager to be swapped.

    Index

    Constructors

    Properties

    _disposalTimeoutId: Timeout = null
    _listeners: (() => void)[] = []
    _serviceManager: IManager
    _subProxyCache: Map<string, unknown> = ...
    _subProxyClearFunctions: (() => void)[] = []

    Accessors

    Methods

    • Clear all sub-proxy caches to force re-creation with new service manager. This is CRITICAL when swapping service managers to prevent stale references.

      Returns void

    • Helper to dispose old service manager IMMEDIATELY. Used when switching service managers to ensure old kernels are shut down before SessionContext tries to use the new one.

      Returns Promise<void>

    • Create a proxy that forwards all property access to the current service manager. This allows the MutableServiceManager to be used as a drop-in replacement.

      IMPORTANT: For properties that are objects (like kernels, sessions, etc.), we need to return proxies as well, because SessionContext extracts these properties and holds onto them. Without proxies, SessionContext would keep references to the old mock service manager's kernels/sessions even after we swap to a real one.

      CRITICAL FIX: Do NOT cache sub-proxies! Even though we clear the cache when service manager changes, React components may already have references to the old cached sub-proxies. Always creating fresh proxies ensures every property access reads from the CURRENT service manager.

      Returns IManager

    • Add a listener for service manager changes.

      Parameters

      • listener: () => void

        Callback to invoke when service manager changes

      Returns { dispose: () => void }

      Disposable to remove the listener

    • Update the service manager with new connection settings. This swaps the internal service manager without changing the wrapper reference.

      Parameters

      • url: string

        The base URL for the Jupyter server

      • token: string

        The authentication token

      Returns void

      Use updateFromConfig instead

    • Update the service manager using a configuration object.

      This is the unified method for switching between any service manager types. No custom logic needed - the factory handles everything!

      Parameters

      Returns Promise<void>

      // Switch to Pyodide
      await manager.updateFromConfig({ type: 'pyodide' });

      // Switch to local kernel
      await manager.updateFromConfig({
      type: 'local',
      kernelId: 'abc-123',
      kernelName: 'Python 3.11',
      url: 'local-kernel://python311'
      });

      // Switch to remote server
      await manager.updateFromConfig({
      type: 'remote',
      url: 'http://localhost:8888',
      token: 'secret'
      });

      // Switch to mock
      await manager.updateFromConfig({ type: 'mock' });
    • Update the underlying service manager directly. This is useful when you need to replace the service manager with a custom one (e.g., LocalKernelServiceManager for local kernel connections).

      Parameters

      • serviceManager: IManager

        The new service manager to use

      Returns void

      Use updateFromConfig instead

    • Switch to Pyodide service manager for offline execution. Uses JupyterLite with Pyodide kernel from @datalayer/jupyter-react package. Falls back to mock service manager if Pyodide initialization fails.

      Returns Promise<void>

      Cancels any pending disposal to prevent race conditions from rapid kernel switching.

      Use updateFromConfig instead