refactor once again
This commit is contained in:
@@ -17,7 +17,7 @@ import (
|
||||
// from the new CartID base62 representation). For backward compatibility,
|
||||
// a deprecated legacy map keyed by CartId is maintained so existing code
|
||||
// that directly indexes pool.grains with a CartId continues to compile
|
||||
// until the full refactor across SyncedPool / remoteIndex is completed.
|
||||
// until the full refactor across SyncedPool is completed.
|
||||
//
|
||||
// Authoritative storage: grains (map[uint64]*CartGrain)
|
||||
// Legacy compatibility: grainsLegacy (map[CartId]*CartGrain) - kept in sync.
|
||||
@@ -46,6 +46,10 @@ var (
|
||||
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
|
||||
// Hostname returns the hostname of the local pool implementation.
|
||||
Hostname() string
|
||||
}
|
||||
|
||||
// Ttl keeps expiry info
|
||||
@@ -242,3 +246,16 @@ func (p *GrainLocalPool) UnsafePointerToLegacyMap() uintptr {
|
||||
// Legacy map removed; retained only to satisfy any transitional callers.
|
||||
return 0
|
||||
}
|
||||
|
||||
// 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 ""
|
||||
}
|
||||
|
||||
// Hostname returns a blank string because GrainLocalPool does not track a node
|
||||
// identity. (SyncedPool will return the real hostname.)
|
||||
func (p *GrainLocalPool) Hostname() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user