コード例 #1
0
        private static async void LookupGrain(string[] args)
        {
            var grainId = ConstructGrainId(args, "lookup");

            var silo = GetSiloAddress();

            if (silo == null)
            {
                return;
            }

            var directory = RemoteGrainDirectoryFactory.GetSystemTarget(Constants.DirectoryServiceId, silo);

            WriteStatus(string.Format("**Calling LookupGrain({0}, {1}, {2})", silo, grainId, RETRIES));
            Tuple <List <Tuple <SiloAddress, ActivationId> >, int> lookupResult = await directory.LookUp(grainId, RETRIES);

            WriteStatus(string.Format("**LookupGrain finished OK. Lookup result is:"));
            List <Tuple <SiloAddress, ActivationId> > list = lookupResult.Item1;

            if (list == null)
            {
                WriteStatus(string.Format("**The returned activation list is null."));
                return;
            }
            if (list.Count == 0)
            {
                WriteStatus(string.Format("**The returned activation list is empty."));
                return;
            }
            Console.WriteLine("**There {0} {1} activations registered in the directory for this grain. The activations are:", (list.Count > 1) ? "are" : "is", list.Count);
            foreach (Tuple <SiloAddress, ActivationId> tuple in list)
            {
                WriteStatus(string.Format("**Activation {0} on silo {1}", tuple.Item2, tuple.Item1));
            }
        }
コード例 #2
0
        private static void UnregisterGrain(string[] args)
        {
            var grainId = ConstructGrainId(args, "unregister");

            var silo = GetSiloAddress();

            if (silo == null)
            {
                return;
            }

            var directory = RemoteGrainDirectoryFactory.GetSystemTarget(Constants.DirectoryServiceId, silo);

            WriteStatus(string.Format("**Calling DeleteGrain({0}, {1}, {2})", silo, grainId, RETRIES));
            directory.DeleteGrain(grainId, RETRIES).Wait();
            WriteStatus(string.Format("**DeleteGrain finished OK."));
        }
コード例 #3
0
        private void SendBatchCacheRefreshRequests(Dictionary <SiloAddress, List <GrainId> > refreshRequests)
        {
            foreach (SiloAddress silo in refreshRequests.Keys)
            {
                List <Tuple <GrainId, int> > cachedGrainAndETagList = BuildGrainAndETagList(refreshRequests[silo]);

                SiloAddress capture = silo;

                router.CacheValidationsSent.Increment();
                // Send all of the items in one large request
                var validator = RemoteGrainDirectoryFactory.GetSystemTarget(Constants.DirectoryCacheValidatorId, capture);

                router.Scheduler.QueueTask(async() =>
                {
                    var response = await validator.LookUpMany(cachedGrainAndETagList);
                    ProcessCacheRefreshResponse(capture, response);
                }, router.CacheValidator.SchedulingContext).Ignore();

                if (Log.IsVerbose2)
                {
                    Log.Verbose2("Silo {0} is sending request to silo {1} with {2} entries", router.MyAddress, silo, cachedGrainAndETagList.Count);
                }
            }
        }
コード例 #4
0
 internal IRemoteGrainDirectory GetDirectoryReference(SiloAddress silo)
 {
     return(RemoteGrainDirectoryFactory.GetSystemTarget(Constants.DirectoryServiceId, silo));
 }
コード例 #5
0
 private IRemoteGrainDirectory GetDirectoryReference(SiloAddress target)
 {
     return(RemoteGrainDirectoryFactory.GetSystemTarget(Constants.DirectoryServiceId, target));
 }