2020-05-15 13:41:26 +03:00
|
|
|
---
|
|
|
|
layout: developer-doc
|
|
|
|
title: Enso Protocol Project Manager Message Specification
|
|
|
|
category: language-server
|
|
|
|
tags: [language-server, protocol, specification]
|
|
|
|
order: 3
|
|
|
|
---
|
|
|
|
|
|
|
|
# Enso Protocol Project Manager Message Specification
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This document contains the specification of the Enso protocol messages that
|
|
|
|
pertain to the project manager component. Please familiarise yourself with the
|
|
|
|
[common](./protocol-common.md) features of the protocol before reading this
|
|
|
|
document.
|
|
|
|
|
|
|
|
For information on the design and architecture of the protocol, as well as its
|
|
|
|
transport formats, please look [here](./protocol-architecture).
|
|
|
|
|
|
|
|
<!-- MarkdownTOC levels="2,3" autolink="true" -->
|
|
|
|
|
|
|
|
- [Types](#types)
|
|
|
|
- [`ProjectMetadata`](#projectmetadata)
|
|
|
|
- [Project Management Operations](#project-management-operations)
|
|
|
|
- [`project/open`](#projectopen)
|
|
|
|
- [`project/close`](#projectclose)
|
2020-06-19 12:37:35 +03:00
|
|
|
- [`project/list`](#projectlist)
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`project/create`](#projectcreate)
|
2020-07-01 16:55:50 +03:00
|
|
|
- [`project/rename`](#projectrename)
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`project/delete`](#projectdelete)
|
|
|
|
- [`project/listSample`](#projectlistsample)
|
|
|
|
- [Language Server Management](#language-server-management)
|
|
|
|
- [Errors](#errors)
|
|
|
|
- [`ProjectNameValidationError`](#projectnamevalidationerror)
|
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror)
|
|
|
|
- [`ProjectExistsError`](#projectexistserror)
|
|
|
|
- [`ProjectNotFoundError`](#projectnotfounderror)
|
|
|
|
- [`ProjectOpenError`](#projectopenerror)
|
|
|
|
- [`ProjectCloseError`](#projectcloseerror)
|
|
|
|
- [`ProjectNotOpenError`](#projectnotopenerror)
|
|
|
|
- [`ProjectOpenByOtherPeersError`](#projectopenbyotherpeerserror)
|
|
|
|
- [`CannotRemoveOpenProjectError`](#cannotremoveopenprojecterror)
|
|
|
|
|
|
|
|
<!-- /MarkdownTOC -->
|
|
|
|
|
|
|
|
## Types
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
There are a number of types that are used only within the project server's
|
|
|
|
protocol messages. These are specified here.
|
|
|
|
|
|
|
|
### `ProjectMetadata`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This type represents information about a project.
|
|
|
|
|
|
|
|
#### Format
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectMetadata {
|
|
|
|
name: String;
|
|
|
|
id: UUID;
|
|
|
|
lastOpened: UTCDateTime;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Project Management Operations
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
The primary responsibility of the project managers is to allow users to manage
|
|
|
|
their projects.
|
|
|
|
|
|
|
|
### `project/open`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This message requests that the project manager open a specified project. This
|
|
|
|
operation also includes spawning an instance of the language server open on the
|
|
|
|
specified project.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectOpenRequest {
|
|
|
|
projectId: UUID;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectOpenResult {
|
|
|
|
languageServerJsonAddress: IPWithSocket;
|
|
|
|
languageServerBinaryAddress: IPWithSocket;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`ProjectNotFoundError`](#projectnotfounderror) to signal that the project
|
|
|
|
doesn't exist.
|
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
|
|
|
- [`ProjectOpenError`](#projectopenerror) to signal failures during server boot.
|
|
|
|
|
|
|
|
### `project/close`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This message requests that the project manager close a specified project. This
|
|
|
|
operation includes shutting down the language server gracefully so that it can
|
|
|
|
persist state to disk as needed.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectCloseRequest {
|
|
|
|
projectId: UUID;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
2020-07-21 15:59:40 +03:00
|
|
|
{
|
|
|
|
}
|
2020-05-15 13:41:26 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`ProjectNotFoundError`](#projectnotfounderror) to signal that the project
|
|
|
|
doesn't exist.
|
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
|
|
|
- [`ProjectCloseError`](#projectcloseerror) to signal failures that occurred
|
|
|
|
during language server stoppage.
|
|
|
|
- [`ProjectNotOpenError`](#projectnotopenerror) to signal cannot close a project
|
|
|
|
that is not open.
|
2020-07-21 15:59:40 +03:00
|
|
|
- [`ProjectOpenByOtherPeersError`](#projectopenbyotherpeerserror) to signal that
|
|
|
|
cannot close a project that is open by other clients.
|
2020-05-15 13:41:26 +03:00
|
|
|
|
2020-06-19 12:37:35 +03:00
|
|
|
### `project/list`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
|
|
|
This message requests that the project manager lists all user's projects. The
|
2020-06-19 12:37:35 +03:00
|
|
|
list of projects is sorted by the open time.
|
2020-05-15 13:41:26 +03:00
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
2020-06-19 12:37:35 +03:00
|
|
|
interface ProjectListRequest {
|
|
|
|
numberOfProjects?: Int;
|
2020-05-15 13:41:26 +03:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
2020-06-19 12:37:35 +03:00
|
|
|
interface ProjectListResponse {
|
2020-05-15 13:41:26 +03:00
|
|
|
projects: [ProjectMetadata];
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
|
|
|
|
|
|
|
### `project/create`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This message requests the creation of a new project.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectCreateRequest {
|
|
|
|
name: String;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectOpenResponse {
|
|
|
|
projectId: UUID;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`ProjectNameValidationError`](#projectnamevalidationerror) to signal
|
|
|
|
validation failures.
|
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
2020-07-21 15:59:40 +03:00
|
|
|
- [`ProjectExistsError`](#projectexistserror) to signal that the project already
|
|
|
|
exists.
|
2020-05-15 13:41:26 +03:00
|
|
|
|
2020-07-01 16:55:50 +03:00
|
|
|
### `project/rename`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-07-01 16:55:50 +03:00
|
|
|
This message requests the renaming of a project.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectRenameRequest {
|
|
|
|
projectId: UUID;
|
|
|
|
name: String;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```
|
|
|
|
null
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-07-01 16:55:50 +03:00
|
|
|
- [`ProjectNameValidationError`](#projectnamevalidationerror) to signal
|
|
|
|
validation failures.
|
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
|
|
|
- [`ProjectExistsError`](#projectexistserror) to signal that the project with
|
|
|
|
the provided name already exists.
|
2020-07-21 15:59:40 +03:00
|
|
|
- [`ServiceError`](#serviceerror) to signal that the the operation timed out.
|
2020-07-01 16:55:50 +03:00
|
|
|
- [`LanguageServerError`](#languageservererror) to signal generic language
|
|
|
|
server failures.
|
2020-05-15 13:41:26 +03:00
|
|
|
|
|
|
|
### `project/delete`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This message requests the deletion of a project.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectDeleteRequest {
|
|
|
|
projectId: UUID;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
2020-07-21 15:59:40 +03:00
|
|
|
{
|
|
|
|
}
|
2020-05-15 13:41:26 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
- [`ProjectDataStoreError`](#projectdatastoreerror) to signal problems with
|
|
|
|
underlying data store.
|
|
|
|
- [`ProjectNotFoundError`](#projectnotfounderror) to signal that the project
|
|
|
|
doesn't exist.
|
|
|
|
- [`CannotRemoveOpenProjectError`](#cannotremoveopenprojecterror) to signal that
|
|
|
|
the project cannot be removed, because is open by at least one user.
|
|
|
|
|
|
|
|
### `project/listSample`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
This request lists the sample projects that are available to the user.
|
|
|
|
|
|
|
|
- **Type:** Request
|
|
|
|
- **Direction:** Client -> Server
|
|
|
|
- **Connection:** Protocol
|
|
|
|
- **Visibility:** Public
|
|
|
|
|
|
|
|
#### Parameters
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectListSampleRequest {
|
|
|
|
numProjects: Int;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Result
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
interface ProjectListSampleResponse {
|
|
|
|
projects: [ProjectMetadata];
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
TBC
|
|
|
|
|
|
|
|
## Language Server Management
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
The project manager is also responsible for managing the language server. This
|
|
|
|
means that it needs to be able to spawn the process, but also tell the process
|
|
|
|
when to shut down.
|
|
|
|
|
|
|
|
> The actionables for this section are:
|
|
|
|
>
|
|
|
|
> - Fill it in when we have more of an idea about exactly how this spawning
|
|
|
|
> relationship is going to work.
|
|
|
|
|
|
|
|
## Errors
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
The project manager component has its own set of errors. This section is not a
|
|
|
|
complete specification and will be updated as new errors are added.
|
|
|
|
|
|
|
|
### `ProjectNameValidationError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals validation failures.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4001,
|
|
|
|
"message" : "Cannot create project with empty name"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectDataStoreError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals problems with underlying data store.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4002,
|
|
|
|
"message" : "Cannot load project index"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectExistsError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that the project already exists.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4003,
|
|
|
|
"message" : "Project with the provided name exists"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectNotFoundError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that the project doesn't exist.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4004,
|
|
|
|
"message" : "Project with the provided id does not exist"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectOpenError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that the project cannot be open due to boot failures.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4005,
|
|
|
|
"message" : "A boot failure."
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectNotOpenError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that cannot close project that is not open.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4006,
|
|
|
|
"message" : "Cannot close project that is not open"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `ProjectOpenByOtherPeersError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that cannot close a project that is open by other clients.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4007,
|
|
|
|
"message" : "Cannot close project because it is open by other peers"
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `CannotRemoveOpenProjectError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-05-15 13:41:26 +03:00
|
|
|
Signals that cannot remove open project.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4008,
|
|
|
|
"message" : "Cannot remove open project"
|
|
|
|
}
|
|
|
|
```
|
2020-07-01 16:55:50 +03:00
|
|
|
|
|
|
|
### `ProjectCloseError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-07-01 16:55:50 +03:00
|
|
|
Signals failures during shutdown of a server.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4009,
|
|
|
|
"message" : "A shutdown failure."
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
### `LanguageServerError`
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-07-01 16:55:50 +03:00
|
|
|
Signals generic language server errors.
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
"error" : {
|
|
|
|
"code" : 4010,
|
|
|
|
"message" : "The language server is unresponsive"
|
|
|
|
}
|
2020-07-21 15:59:40 +03:00
|
|
|
```
|