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

Building Runtime Handler interface specifications to reduce the burden of platform and resource integration #189

Open
jianzs opened this issue Apr 18, 2024 · 0 comments
Labels
sdk Client SDK and Infra SDK

Comments

@jianzs
Copy link
Contributor

jianzs commented Apr 18, 2024

Users interact with resources through a unified interface, regardless of the specific cloud platform. However, when deploying user-written business logic to a cloud platform, adaptation is required. Payload obtained from the platform runtime needs to be converted into parameters that the business logic code can accept. Furthermore, the execution results of the business logic must be adapted to the platform's standards for response.

request → biz_input → biz_function → biz_output → response

The current implementation method is that each type of resource directly faces the platform's standards and directly adapts to the platform's standards. With n types of resources and m platforms, the cost of adaptation is n * m.

We can define a set of Runtime Handler interface specifications between the platform and the resource types. The input of the interface is the platform input, and the output is the business logic result. Each type of resource only needs to implement one Runtime Handler to adapt the business logic. Each platform only needs to implement one Runtime adaptation function, converting the platform's input into the input type of the Runtime Handler, and calling the Runtime Handler. Finally, the output of the Runtime Handler is converted into the platform output. The complexity is reduced to n + m.

In this way, to integrate a platform, you only need to create a file, adapt the platform's input and output, and call the Runtime Handler, and all resources can be deployed to this platform. Similarly, to integrate a new type of resource, you only need to create a file, adapt the business logic interface and the Runtime Handler interface, and it can be deployed to various platforms. This reduces the cost of integrating resources and platforms.

infra/
├── handlers  # runtime handlers
│   ├── python
│   │   ├── function.py
│   │   ├── queue.py
│   │   └── router.py
│   └── typescript
│       ├── function.ts
│       ├── queue.ts
│       └── router.ts
├── aws
│   ├── adapters # runtime adapters for AWS
│   │   ├── runtime_adapter.py
│   │   └── runtime_adapter.ts
│   ├── router.apigateway.ts
│   └── sns.queue.ts
└── k8s
    ├── adapters # runtime adapters for Kubernetes
    │   ├── runtime_adapter.py
    │   └── runtime_adapter.ts
    ├── queue.redis.ts
    └── router.ingress.ts
@jianzs jianzs added the sdk Client SDK and Infra SDK label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sdk Client SDK and Infra SDK
Projects
None yet
Development

No branches or pull requests

1 participant