major refactor
All checks were successful
Build and Publish / Metadata (push) Successful in 4s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 49s
Build and Publish / BuildAndDeployArm64 (push) Successful in 3m49s

This commit is contained in:
2025-10-11 10:22:47 +02:00
parent e48a2590bd
commit 24cd0b6ad7
7 changed files with 278 additions and 573 deletions

View File

@@ -3,6 +3,7 @@ package main
import (
"fmt"
"log"
"net/http"
"sync"
"time"
@@ -47,11 +48,16 @@ type GrainPool interface {
Apply(id CartId, mutation interface{}) (*CartGrain, error)
Get(id CartId) (*CartGrain, error)
// OwnerHost returns the primary owner host for a given cart id.
OwnerHost(id CartId) string
OwnerHost(id CartId) (Host, bool)
// Hostname returns the hostname of the local pool implementation.
Hostname() string
}
type Host interface {
Name() string
Proxy(id CartId, w http.ResponseWriter, r *http.Request) (bool, error)
}
// Ttl keeps expiry info
type Ttl struct {
Expires time.Time
@@ -269,8 +275,8 @@ func (p *GrainLocalPool) UnsafePointerToLegacyMap() uintptr {
// OwnerHost implements the extended GrainPool interface for the standalone
// local pool. Since the local pool has no concept of multi-host ownership,
// it returns an empty string. Callers can treat empty as "local host".
func (p *GrainLocalPool) OwnerHost(id CartId) string {
return ""
func (p *GrainLocalPool) OwnerHost(id CartId) (Host, bool) {
return nil, false
}
// Hostname returns a blank string because GrainLocalPool does not track a node