This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Design Documents

Capa design overview.

Background

In cross-cloud and hybrid cloud scenarios, we want applications to use a single codebase and deploy to different cloud environments. At runtime, use the cloud-native implementation provided by the corresponding cloud environment.

Technical Approach

api design

Define an API layer that is independent of specific middleware (no strong binding), so that applications only depend on this API layer during programming. This decouples the application itself from specific middleware; then when deployed to different cloud environments, the different cloud implementation layers of the API are loaded into the application process.

1 - Configuration Service Invocation

Perform application-level configuration management.

Introduction

Manage application-level configuration by calling the Capa SDK API. The underlying implementation uses SPI to register adapter implementations for various platforms.

Invocation Logic

The following diagram shows the Capa Configuration service invocation logic:

Configuration

  • Service (appid:A): the service invoker, CloudX Configuration Service is the service being invoked, which can be any cloud vendor’s configuration service
  • Service (appid:A) initiates a service call to the Cloud Configuration Service through the Capa SDK
  • Capa Configuration API is a unified API specification
  • Capa-CloudX Configuration Adaptor SDK is Capa’s adapter implementation class, registered via SPI
  • CloudX Configuration Service provides the actual configuration service

API Design

The design of the Capa Configuration API follows community standards:

The meanings of specific parameters are as follows:

ParameterMeaning
storeNameStorage name
appIdUnique service ID within the same namespace
keysList of configuration keys
metadataMetadata for sending configuration requests
groupConfiguration group (Optional)
labelConfiguration label (Optional)
typeThe specific type corresponding to the generic in the request response object
ConfigurationRequestItemRequest object
ConfigurationItemResponse object for getting configuration
SubConfigurationRespResponse object for subscribing to configuration

2 - RPC Service Invocation

Perform direct, secure, service-to-service method calls.

Introduction

Invocation Logic

The following diagram shows the RPC service invocation logic of Capa:

  • Service A is the service invoker, Service B is the service being invoked
  • Service A initiates a service call to Service B through the Capa SDK
  • Capa RPC API is a unified API specification
  • The specific RPC implementation RPC Impl of the Capa RPC API can be found through the SPI mechanism
  • Obtain the return data from Service B and return it to the service invoker Service A

API Design

Capa’s API design follows community standards:

The meanings of specific parameters are as follows:

ParameterMeaning
appIdUnique service ID within the same namespace
methodNameMethod name of the service being invoked
requestService request to be sent for invocation
httpExtensionHTTP request method
metadataMetadata for sending requests (GRPC) or headers (HTTP)
clazzType of request response
typeType of request response
invokeMethodRequestRequest object