The Content Service API defines the gRPC interfaces for the Content Service, which is responsible for managing various types of content within the Gitpod platform, including workspace files, blobs, logs, and IDE plugins.
This API provides a standardized interface for other components to interact with the Content Service, enabling operations such as:
- Managing workspace content (downloading, deleting, checking snapshots)
- Handling blob storage (uploading, downloading, deleting)
- Accessing headless logs
- Managing IDE plugins
- Defining workspace initialization methods
The Content Service API is implemented as a set of gRPC services defined in Protocol Buffer files. These definitions are used to generate client and server code in various languages (Go, TypeScript) for use by other components in the system.
Provides core content management functionality:
DeleteUserContent
: Deletes all content associated with a user
Manages workspace content:
WorkspaceDownloadURL
: Provides a URL from which workspace content can be downloadedDeleteWorkspace
: Deletes the content of a single workspaceWorkspaceSnapshotExists
: Checks whether a workspace snapshot exists
Handles blob storage operations:
UploadUrl
: Provides a URL to which clients can upload content via HTTP PUTDownloadUrl
: Provides a URL from which clients can download content via HTTP GETDelete
: Deletes uploaded content
Manages access to headless logs:
LogDownloadURL
: Provides a URL from which logs can be downloadedListLogs
: Returns a list of task IDs for a specified workspace instance
Manages IDE plugins:
UploadURL
: Provides a URL for uploading plugin contentDownloadURL
: Provides a URL for downloading plugin contentPluginHash
: Provides a hash of a plugin
Defines how a workspace is initialized, with several initialization methods:
EmptyInitializer
: Creates an empty workspaceGitInitializer
: Initializes from a Git repositorySnapshotInitializer
: Initializes from a snapshotPrebuildInitializer
: Combines snapshots with GitCompositeInitializer
: Uses multiple initializers in sequenceFileDownloadInitializer
: Downloads files for workspace contentFromBackupInitializer
: Initializes from a backup
Describes the current Git working copy status, similar to a combination of "git status" and "git branch".
- The API uses gRPC for efficient, typed communication between services
- Many operations return URLs rather than content directly, allowing for efficient transfer of large files
- Authentication information is passed in request messages
- Used by various components that need to interact with workspace content
- Depends on underlying storage systems (not specified in the API)
- Workspace Manager uses this API to initialize workspaces
- Dashboard uses this API to provide download links for workspace content
- IDE components use this API to access plugins
The API uses Protocol Buffers version 3 (proto3) syntax, which provides forward and backward compatibility features.
The Content Service API uses Protocol Buffers and gRPC for defining interfaces. When changes are made to the .proto
files, the corresponding code in various languages needs to be regenerated.
To regenerate the code:
-
Navigate to the content-service-api directory:
cd components/content-service-api
-
Run the generate script:
./generate.sh
This script performs the following actions:
- Installs necessary dependencies (protoc plugins)
- Generates Go code using
protoc-gen-go
andprotoc-gen-go-grpc
- Generates TypeScript code
- Updates license headers
The generate.sh
script uses functions from the shared script at scripts/protoc-generator.sh
, which provides common functionality for all API components:
install_dependencies
: Installs required protoc pluginsprotoc_buf_generate
: Uses thebuf
tool to generate code based on the configuration inbuf.gen.yaml
update_license
: Updates license headers in generated files
After regenerating the code, you may need to rebuild components that depend on the Content Service API. This typically involves:
-
For Go components:
cd <component-directory> go build ./...
-
For TypeScript components:
cd <component-directory> yarn install yarn build
-
Using Leeway (for CI/CD):
leeway build -D components/<component-name>:app