Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New platform] Introduce start phase for core services on server #35297

Merged
merged 23 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4eef5fb
introduce start phase. setup is bloated with start functionality
mshustov Apr 18, 2019
f116a29
fix amp typings: server is part of start contract now
mshustov Apr 18, 2019
faad244
update mock files
mshustov Apr 18, 2019
a037fe8
root.start(): necessary to run test server
mshustov Apr 18, 2019
25aa5a5
expose setup&start server api to simplify testing
mshustov Apr 18, 2019
7ffd2aa
move tests to the new API
mshustov Apr 18, 2019
fad9a06
test servers also should call root.start()
mshustov Apr 18, 2019
cfddce2
update docs
mshustov Apr 18, 2019
406ae80
update snapshots: this functionality is tested in http server
mshustov Apr 18, 2019
bfd7b0b
split setup/start phases
mshustov Apr 24, 2019
38b7394
Merge branch 'master' into introduce-start-phase
mshustov Apr 24, 2019
f504d00
update docs
mshustov Apr 24, 2019
ea34a0e
expose http server if it not started
mshustov Apr 25, 2019
3d245f5
adopt test to exposed Http server via SetupContract
mshustov Apr 25, 2019
05e0333
udpate docs
mshustov Apr 25, 2019
d46e7a8
cleanup apm changees
mshustov Apr 25, 2019
62a6724
Merge branch 'master' into introduce-start-phase
mshustov Apr 25, 2019
255d3c3
check legacy service setup before start
mshustov Apr 25, 2019
8880af1
check http server setup before start
mshustov Apr 25, 2019
02ccc54
restrict server options mutation; unify Promise interface for setup
mshustov Apr 30, 2019
f8cc8c8
Merge branch 'master' into introduce-start-phase
mshustov Apr 30, 2019
c04fdd2
introduce start pahse for plugins service for parity with client side
mshustov Apr 30, 2019
37de718
Revert "introduce start pahse for plugins service for parity with cli…
mshustov Apr 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthenticationHandler](./kibana-plugin-server.authenticationhandler.md)

## AuthenticationHandler type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md) &gt; [authenticated](./kibana-plugin-server.authtoolkit.authenticated.md)

## AuthToolkit.authenticated property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md)

## AuthToolkit interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md) &gt; [redirected](./kibana-plugin-server.authtoolkit.redirected.md)

## AuthToolkit.redirected property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [AuthToolkit](./kibana-plugin-server.authtoolkit.md) &gt; [rejected](./kibana-plugin-server.authtoolkit.rejected.md)

## AuthToolkit.rejected property
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreStart](./kibana-plugin-server.corestart.md) &gt; [http](./kibana-plugin-server.corestart.http.md)

## CoreStart.http property

<b>Signature:</b>

```typescript
http: HttpServiceStart;
```
18 changes: 18 additions & 0 deletions docs/development/core/server/kibana-plugin-server.corestart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [CoreStart](./kibana-plugin-server.corestart.md)

## CoreStart interface

<b>Signature:</b>

```typescript
export interface CoreStart
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [http](./kibana-plugin-server.corestart.http.md) | <code>HttpServiceStart</code> | |

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [HttpServiceSetup](./kibana-plugin-server.httpservicesetup.md)

## HttpServiceSetup type
Expand All @@ -6,5 +8,5 @@
<b>Signature:</b>

```typescript
export declare type HttpServiceSetup = HttpServerInfo;
export declare type HttpServiceSetup = HttpServerSetup;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [HttpServiceStart](./kibana-plugin-server.httpservicestart.md) &gt; [isListening](./kibana-plugin-server.httpservicestart.islistening.md)

## HttpServiceStart.isListening property

Indicates if http server is listening on a port

<b>Signature:</b>

```typescript
isListening: () => boolean;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [HttpServiceStart](./kibana-plugin-server.httpservicestart.md)

## HttpServiceStart interface


<b>Signature:</b>

```typescript
export interface HttpServiceStart
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [isListening](./kibana-plugin-server.httpservicestart.islistening.md) | <code>() =&gt; boolean</code> | Indicates if http server is listening on a port |

Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [body](./kibana-plugin-server.kibanarequest.body.md)

## KibanaRequest.body property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [from](./kibana-plugin-server.kibanarequest.from.md)

## KibanaRequest.from() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [getFilteredHeaders](./kibana-plugin-server.kibanarequest.getfilteredheaders.md)

## KibanaRequest.getFilteredHeaders() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [headers](./kibana-plugin-server.kibanarequest.headers.md)

## KibanaRequest.headers property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md)

## KibanaRequest class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [params](./kibana-plugin-server.kibanarequest.params.md)

## KibanaRequest.params property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [path](./kibana-plugin-server.kibanarequest.path.md)

## KibanaRequest.path property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [KibanaRequest](./kibana-plugin-server.kibanarequest.md) &gt; [query](./kibana-plugin-server.kibanarequest.query.md)

## KibanaRequest.query property
Expand Down
2 changes: 2 additions & 0 deletions docs/development/core/server/kibana-plugin-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
| [AuthToolkit](./kibana-plugin-server.authtoolkit.md) | A tool set defining an outcome of Auth interceptor for incoming request. |
| [CallAPIOptions](./kibana-plugin-server.callapioptions.md) | The set of options that defines how API call should be made and result be processed. |
| [CoreSetup](./kibana-plugin-server.coresetup.md) | |
| [CoreStart](./kibana-plugin-server.corestart.md) | |
| [ElasticsearchServiceSetup](./kibana-plugin-server.elasticsearchservicesetup.md) | |
| [HttpServiceStart](./kibana-plugin-server.httpservicestart.md) | |
| [Logger](./kibana-plugin-server.logger.md) | Logger exposes all the necessary methods to log any type of information and this is the interface used by the logging consumers including plugins. |
| [LoggerFactory](./kibana-plugin-server.loggerfactory.md) | The single purpose of <code>LoggerFactory</code> interface is to define a way to retrieve a context-based logger instance. |
| [LogMeta](./kibana-plugin-server.logmeta.md) | Contextual metadata |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [OnRequestHandler](./kibana-plugin-server.onrequesthandler.md)

## OnRequestHandler type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md)

## OnRequestToolkit interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md) &gt; [next](./kibana-plugin-server.onrequesttoolkit.next.md)

## OnRequestToolkit.next property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md) &gt; [redirected](./kibana-plugin-server.onrequesttoolkit.redirected.md)

## OnRequestToolkit.redirected property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [OnRequestToolkit](./kibana-plugin-server.onrequesttoolkit.md) &gt; [rejected](./kibana-plugin-server.onrequesttoolkit.rejected.md)

## OnRequestToolkit.rejected property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [PluginSetupContext](./kibana-plugin-server.pluginsetupcontext.md) &gt; [http](./kibana-plugin-server.pluginsetupcontext.http.md)

## PluginSetupContext.http property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [delete](./kibana-plugin-server.router.delete.md)

## Router.delete() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [get](./kibana-plugin-server.router.get.md)

## Router.get() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [getRoutes](./kibana-plugin-server.router.getroutes.md)

## Router.getRoutes() method
Expand Down
2 changes: 2 additions & 0 deletions docs/development/core/server/kibana-plugin-server.router.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md)

## Router class
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [path](./kibana-plugin-server.router.path.md)

## Router.path property
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [post](./kibana-plugin-server.router.post.md)

## Router.post() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [put](./kibana-plugin-server.router.put.md)

## Router.put() method
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index) &gt; [kibana-plugin-server](./kibana-plugin-server.md) &gt; [Router](./kibana-plugin-server.router.md) &gt; [routes](./kibana-plugin-server.router.routes.md)

## Router.routes property
Expand Down
5 changes: 4 additions & 1 deletion src/core/public/plugins/plugins_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,17 @@ export type PluginsServiceStartDeps = CoreStart;
export interface PluginsServiceSetup {
contracts: Map<string, unknown>;
}
export interface PluginsServiceStart {
contracts: Map<string, unknown>;
}

/**
* Service responsible for loading plugin bundles, initializing plugins, and managing the lifecycle
* of all plugins.
*
* @internal
*/
export class PluginsService implements CoreService<PluginsServiceSetup> {
export class PluginsService implements CoreService<PluginsServiceSetup, PluginsServiceStart> {
/** Plugin wrappers in topological order. */
private readonly plugins: Map<
PluginName,
Expand Down
1 change: 1 addition & 0 deletions src/core/server/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export async function bootstrap({

try {
await root.setup();
await root.start();
} catch (err) {
await shutdown(err);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ElasticsearchServiceContract = PublicMethodsOf<ElasticsearchService>;
const createMock = () => {
const mocked: jest.Mocked<ElasticsearchServiceContract> = {
setup: jest.fn(),
start: jest.fn(),
stop: jest.fn(),
};
mocked.setup.mockResolvedValue(createSetupContractMock());
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/elasticsearch/elasticsearch_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export class ElasticsearchService implements CoreService<ElasticsearchServiceSet
};
}

public async start() {}

public async stop() {
this.log.debug('Stopping elasticsearch service');

Expand Down
48 changes: 4 additions & 44 deletions src/core/server/http/__snapshots__/http_service.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core/server/http/http_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const createHttpSchema = schema.object(
}
);

type HttpConfigType = TypeOf<typeof createHttpSchema>;
export type HttpConfigType = TypeOf<typeof createHttpSchema>;

export class HttpConfig {
/**
Expand Down
Loading