Skip to content

capa-cloud/cloud-runtimes-golang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Cloud Runtimes Golang

Cloud Runtimes Golang

Multi-Runtime Standard API for Go

Capa Β· Dapr Β· Layotto

Go Version License


πŸ“– Introduction

Cloud Runtimes Golang provides the Multi-Runtime Standard API for Mecha architecture projects in Go.

This project defines a unified, vendor-neutral API specification that enables Go applications to use standardized interfaces for distributed system capabilities across different runtime implementations.

Supported Runtimes

Runtime Status Description
Capa βœ… Used Primary Mecha SDK implementation
Dapr πŸ“‹ Follow Sidecar runtime reference
Layotto πŸ“‹ Follow MOSN-based sidecar implementation

πŸ—οΈ Architecture

Cloud Runtimes Golang Architecture

Module Structure

cloud-runtimes-golang/
β”œβ”€β”€ api/                    # Core API definitions (interfaces)
β”‚   β”œβ”€β”€ rpc/
β”‚   β”œβ”€β”€ configuration/
β”‚   β”œβ”€β”€ pubsub/
β”‚   β”œβ”€β”€ state/
β”‚   β”œβ”€β”€ secret/
β”‚   └── telemetry/
└── go.mod                  # Go module definition

Key Design Principles:

  • API-First: Clean interfaces separate specification from implementation
  • Runtime Agnostic: Works with Capa SDK, Dapr, Layotto, and future runtimes
  • Idiomatic Go: Follows Go best practices and patterns
  • Vendor Neutral: No lock-in to specific cloud providers

✨ Features

Cloud Runtimes Golang Features

Stable Features

Feature Interface Description Status
πŸ”— Service Invocation RpcService RPC service-to-service communication βœ… Stable
βš™οΈ Configuration ConfigurationService Dynamic configuration management βœ… Stable
πŸ“¨ Pub/Sub PubSubService Publish/Subscribe messaging βœ… Stable
πŸ’Ύ State Management StateService Key-value state storage βœ… Stable
πŸ” Secret Management SecretService Secure secret retrieval βœ… Stable
πŸ“Š Telemetry TelemetryService Logs, metrics, and traces βœ… Stable
πŸ“ File System FileService File storage operations βœ… Stable
πŸ”’ Distributed Lock LockService Distributed locking βœ… Stable

Alpha Features

Feature Interface Description Status
πŸ—„οΈ Database DatabaseService SQL database operations πŸ”¬ Alpha
⏰ Schedule ScheduleService Scheduled task management πŸ”¬ Alpha

🎯 Motivation

Cloud Runtimes Golang was created to bring standardized, portable APIs to the Go ecosystem:


πŸš€ Getting Started

Installation

go get github.com/capa-cloud/cloud-runtimes-golang/api

Quick Example

package main

import (
    "context"
    "log"

    "github.com/capa-cloud/cloud-runtimes-golang/api"
)

func main() {
    // Create a runtime client (implementation-specific)
    client := api.NewClient()

    // Use the RPC service
    resp, err := client.Rpc().InvokeMethod(context.Background(), "service-name", "method", data)
    if err != nil {
        log.Fatal(err)
    }

    // Use the State service
    err = client.State().Save(context.Background(), "state-store", state)
    if err != nil {
        log.Fatal(err)
    }
}

Runtime Implementations

Choose your runtime implementation:

# For Capa SDK
go get github.com/capa-cloud/cloud-runtimes-capa

# For Dapr
go get github.com/capa-cloud/cloud-runtimes-dapr

# For Layotto
go get github.com/capa-cloud/cloud-runtimes-layotto

πŸ“š API Interfaces

Service Invocation

type RpcService interface {
    InvokeMethod(ctx context.Context, service, method string, data []byte) ([]byte, error)
    InvokeMethodWithContent(ctx context.Context, service, method string, contentType string, data []byte) ([]byte, error)
}

Configuration

type ConfigurationService interface {
    GetConfiguration(ctx context.Context, storeName string, keys []string) (map[string]string, error)
    SubscribeConfiguration(ctx context.Context, storeName string, keys []string) (<-chan ConfigurationEvent, error)
}

State Management

type StateService interface {
    Get(ctx context.Context, storeName, key string) ([]byte, error)
    Save(ctx context.Context, storeName string, states []StateItem) error
    Delete(ctx context.Context, storeName, key string) error
}

🌐 Ecosystem

Cloud Runtimes Golang is part of the broader Capa Cloud ecosystem:

Project Language Description
cloud-runtimes-jvm Java JVM API specification
cloud-runtimes-python Python Python API specification
capa-go Go Go SDK implementation

🀝 Contributing

We welcome contributions from the Go community!

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Setup

# Clone the repository
git clone https://github.com/capa-cloud/cloud-runtimes-golang.git
cd cloud-runtimes-golang

# Download dependencies
go mod download

# Run tests
go test ./...

πŸ“œ License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.


Building portable, vendor-neutral cloud APIs for Go

Capa Cloud Β· Documentation

About

Cloud Runtimes Specification for the Golang.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages