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