Skip to content

Latest commit

 

History

History
116 lines (83 loc) · 3.19 KB

File metadata and controls

116 lines (83 loc) · 3.19 KB

Cloud Runtimes Golang

Cloud Runtimes Golang

Compatibility-sensitive Go interfaces for multi-runtime application capabilities. This module defines API contracts only; applications must supply a concrete runtime implementation.

Capa Cloud · Documentation · Issues

Requirements and module path

  • Go 1.17 or later
  • Go modules enabled

The source repository moved to the capa-cloud organization, but the published module path remains github.com/reactivegroup/cloud-runtimes-golang for compatibility:

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

Import the canonical module path declared by go.mod, not the GitHub repository URL:

import "github.com/reactivegroup/cloud-runtimes-golang/api"

API status

The module currently defines interfaces for:

Domain Main interface
Service invocation InvocationRuntimes
Bindings BindingRuntimes
Pub/Sub PubSubRuntimes
State StateRuntimes
Secrets SecretsRuntimes
Trace context TraceRuntimes
Authentication context AuthRuntimes

“Defined” means the interface and related types exist in this module. It does not mean a Capa, Dapr, Layotto, or provider adapter is bundled or production-ready.

Use the interfaces

Depend on the narrowest interface needed by application code and inject an implementation:

package service

import (
    "context"

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

func Invoke(ctx context.Context, runtime api.InvocationRuntimes) error {
    _, err := runtime.InvokeMethod(ctx, "service-name", "method", "POST")
    return err
}

The composite core interface is:

type CoreCloudRuntimes interface {
    InvocationRuntimes
    BindingRuntimes
    PubSubRuntimes
    SecretsRuntimes
    StateRuntimes
}

Adapters should document which interfaces they implement and return explicit errors for unsupported operations.

Repository layout

.
├── api/
│   ├── core.go             # Core runtime interfaces and domain types
│   ├── enhance.go          # Trace and authentication context interfaces
│   └── client.go           # Composite client interface
├── docs/
└── go.mod

Develop and verify

git clone https://github.com/capa-cloud/cloud-runtimes-golang.git
cd cloud-runtimes-golang
go mod download
go test ./...
go vet ./...

CI runs the tests on Go 1.17.x and the current stable Go release.

When changing an interface:

  1. Preserve the module path and existing exported names unless a breaking change is intentional.
  2. Update domain types and tests with the interface change.
  3. Document the adapter compatibility impact.
  4. Run gofmt on changed Go files and the commands above.

Related projects

License

Apache License 2.0. See LICENSE.