public AgentActor() { Become(new Behavior <IPeerActor <TKey, TValue> >( a => { IFuture <IEnumerable <TKey> > keys = a.AskKeys(); IFuture <IEnumerable <IPeerActor <TKey> > > peers = a.AskPeers(); // peek key out of centroid TKey key = CenterKey.Calc(keys.Result()); // calc nearest peer IOrderedEnumerable <IPeerActor <TKey> > orderedPeers = peers.Result().OrderBy(n => n.GetPeerHashKey().ToString()); HashKey hashKey = HashKey.ComputeHash(key.ToString()); foreach (IPeerActor <TKey> peer in orderedPeers) { if (hashKey.CompareTo(peer.GetPeerHashKey()) > 0) { // deposit // get current K V TValue result = a.GetNode(key).Result(); if (result != null) { // set current K V (peer as IPeerActor <TKey, TValue>).StoreNode(key, result); } break; } } })); }
public void ActorProxyTest() { TestLauncherActor.Test(() => { string data = "ARn was here !"; IActorProxy actorTest = new ActorProxy(); actorTest.Store(data); IFuture <string> result = actorTest.Retrieve(); Assert.AreEqual(data, result.Result()); }); }