代码拉取完成,页面将自动刷新
package cluster
import (
"time"
"gitee.com/wujianhai/protoactor-go/actor"
)
const (
placementActorName = "placement-activator"
pidClusterIdentityStartIndex = len(placementActorName) + 1
)
// IdentityStorageLookup contains
type IdentityStorageLookup struct {
Storage StorageLookup
cluster *Cluster
isClient bool
placementActor *actor.PID
system *actor.ActorSystem
router *actor.PID
memberID string
}
func newIdentityStorageLookup(storage StorageLookup) *IdentityStorageLookup {
this := &IdentityStorageLookup{
Storage: storage,
}
return this
}
// RemoveMember from identity storage
func (i *IdentityStorageLookup) RemoveMember(memberID string) {
i.Storage.RemoveMemberId(memberID)
}
// RemotePlacementActor returns the PID of the remote placement actor
func RemotePlacementActor(address string) *actor.PID {
return actor.NewPID(address, placementActorName)
}
//
// Interface: IdentityLookup
//
// Get returns a PID for a given ClusterIdentity
func (id *IdentityStorageLookup) Get(clusterIdentity *ClusterIdentity) *actor.PID {
msg := newGetPid(clusterIdentity)
timeout := 5 * time.Second
res, _ := id.system.Root.RequestFuture(id.router, msg, timeout).Result()
response := res.(*actor.Future)
return response.PID()
}
func (id *IdentityStorageLookup) Setup(cluster *Cluster, kinds []string, isClient bool) {
id.cluster = cluster
id.system = cluster.ActorSystem
id.memberID = cluster.ActorSystem.ID
// workerProps := actor.PropsFromProducer(func() actor.Actor { return newIdentityStorageWorker(identity) })
// routerProps := identity.system.Root.(workerProps, 50);
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。