1 | import { IIterator } from '@lumino/algorithm';
|
2 | import { Poll } from '@lumino/polling';
|
3 | import { ISignal } from '@lumino/signaling';
|
4 | import { ServerConnection } from '../serverconnection';
|
5 | import * as Session from './session';
|
6 | import { BaseManager } from '../basemanager';
|
7 | import { Kernel } from '../kernel';
|
8 |
|
9 |
|
10 |
|
11 | export declare class SessionManager extends BaseManager implements Session.IManager {
|
12 | |
13 |
|
14 |
|
15 |
|
16 |
|
17 | constructor(options: SessionManager.IOptions);
|
18 | /**
|
19 | * The server settings for the manager.
|
20 | */
|
21 | readonly serverSettings: ServerConnection.ISettings;
|
22 | /**
|
23 | * Test whether the manager is ready.
|
24 | */
|
25 | get isReady(): boolean;
|
26 | /**
|
27 | * A promise that fulfills when the manager is ready.
|
28 | */
|
29 | get ready(): Promise<void>;
|
30 | /**
|
31 | * A signal emitted when the running sessions change.
|
32 | */
|
33 | get runningChanged(): ISignal<this, Session.IModel[]>;
|
34 | /**
|
35 | * A signal emitted when there is a connection failure.
|
36 | */
|
37 | get connectionFailure(): ISignal<this, Error>;
|
38 | /**
|
39 | * Dispose of the resources used by the manager.
|
40 | */
|
41 | dispose(): void;
|
42 | connectTo(options: Omit<Session.ISessionConnection.IOptions, 'connectToKernel' | 'serverSettings'>): Session.ISessionConnection;
|
43 | /**
|
44 | * Create an iterator over the most recent running sessions.
|
45 | *
|
46 | * @returns A new iterator over the running sessions.
|
47 | */
|
48 | running(): IIterator<Session.IModel>;
|
49 | /**
|
50 | * Force a refresh of the running sessions.
|
51 | *
|
52 | * @returns A promise that with the list of running sessions.
|
53 | *
|
54 | * #### Notes
|
55 | * This is not typically meant to be called by the user, since the
|
56 | * manager maintains its own internal state.
|
57 | */
|
58 | refreshRunning(): Promise<void>;
|
59 | /**
|
60 | * Start a new session. See also [[startNewSession]].
|
61 | *
|
62 | * @param createOptions - Options for creating the session
|
63 | *
|
64 | * @param connectOptions - Options for connecting to the session
|
65 | */
|
66 | startNew(createOptions: Session.ISessionOptions, connectOptions?: Omit<Session.ISessionConnection.IOptions, 'model' | 'connectToKernel' | 'serverSettings'>): Promise<Session.ISessionConnection>;
|
67 | /**
|
68 | * Shut down a session by id.
|
69 | */
|
70 | shutdown(id: string): Promise<void>;
|
71 | /**
|
72 | * Shut down all sessions.
|
73 | *
|
74 | * @returns A promise that resolves when all of the kernels are shut down.
|
75 | */
|
76 | shutdownAll(): Promise<void>;
|
77 | /**
|
78 | * Find a session associated with a path and stop it if it is the only session
|
79 | * using that kernel.
|
80 | *
|
81 | * @param path - The path in question.
|
82 | *
|
83 | * @returns A promise that resolves when the relevant sessions are stopped.
|
84 | */
|
85 | stopIfNeeded(path: string): Promise<void>;
|
86 | /**
|
87 | * Find a session by id.
|
88 | */
|
89 | findById(id: string): Promise<Session.IModel | undefined>;
|
90 | /**
|
91 | * Find a session by path.
|
92 | */
|
93 | findByPath(path: string): Promise<Session.IModel | undefined>;
|
94 | /**
|
95 | * Execute a request to the server to poll running kernels and update state.
|
96 | */
|
97 | protected requestRunning(): Promise<void>;
|
98 | /**
|
99 | * Handle a session starting.
|
100 | */
|
101 | private _onStarted;
|
102 | private _onDisposed;
|
103 | private _onChanged;
|
104 | private _isReady;
|
105 | private _sessionConnections;
|
106 | private _models;
|
107 | private _pollModels;
|
108 | private _ready;
|
109 | private _runningChanged;
|
110 | private _connectionFailure;
|
111 | private readonly _connectToKernel;
|
112 | private _kernelManager;
|
113 | }
|
114 | /**
|
115 | * The namespace for `SessionManager` class statics.
|
116 | */
|
117 | export declare namespace SessionManager {
|
118 | |
119 |
|
120 |
|
121 | interface IOptions extends BaseManager.IOptions {
|
122 | |
123 |
|
124 |
|
125 | standby?: Poll.Standby;
|
126 | |
127 |
|
128 |
|
129 | kernelManager: Kernel.IManager;
|
130 | }
|
131 | }
|