major refactor
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user