public async Task<ActionResult> GetGrainKeyFromType(string type)
		{
		    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var grainInfoGrain = clusterClient.GetGrain<IMethodInvocationGrain>(type);
			var grainKeyType = await grainInfoGrain.GetGrainKeyType();
			return Json(grainKeyType, JsonRequestBehavior.AllowGet);
		}
		public async Task<ActionResult> GetAllGrainTypes()
		{
		    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var dashboardCollectorGrain = clusterClient.GetGrain<IDashboardCollectorGrain>(Guid.Empty);
			var types = await dashboardCollectorGrain.GetGrainTypes();
			return Json(types, JsonRequestBehavior.AllowGet);
		}
		public async Task<ActionResult> GetGrainInfo(GetGrainInfoRequest grainInfoRequest)
		{
		    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var typeFilterGrain = clusterClient.GetGrain<IFilterGrain>(Guid.Empty);
			var filters = await typeFilterGrain.GetFilters(grainInfoRequest.GrainType, grainInfoRequest.GrainId);
			return Json(filters);
		}
Esempio n. 4
0
        public async Task SetSummaryViewLimit(int summaryViewLimit)
        {
            var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);

            var dashboardInstanceGrain = clusterClient.GetGrain <IDashboardInstanceGrain>(0);
            await dashboardInstanceGrain.SetSummaryViewLimit(summaryViewLimit);
        }
Esempio n. 5
0
        public async Task <DiffModel> GetCurrentSnapshot(AppliedFilter filter, string grainSessionId)
        {
            var clusterClient = await GrainClientMultiton.GetAndConnectClient(grainSessionId);

            var dashboardInstanceGrain = clusterClient.GetGrain <IDashboardInstanceGrain>(0);

            var diffmodel = await dashboardInstanceGrain.GetAll(filter);

            return(diffmodel);
        }
		public async Task<ActionResult> GetFilters(GetFiltersRequest filtersRequest)
		{
			if (filtersRequest?.Types == null)
				return null;

		    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var filterGrain = clusterClient.GetGrain<IFilterGrain>(Guid.Empty);
			var filters = await filterGrain.GetGroupedFilterValues(filtersRequest.Types);
			return Json(filters, JsonRequestBehavior.AllowGet);
		}
        public async Task<ActionResult> GetDashboardInfo()
		{
            var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var dashboardCollectorGrain = clusterClient.GetGrain<IDashboardCollectorGrain>(Guid.Empty);

		    var types = await dashboardCollectorGrain.GetGrainTypes();

			var dashboardInfo = new DashboardInfo
			{
				Silos = await dashboardCollectorGrain.GetSilos(),
				AvailableTypes = types
			};

			return Json(dashboardInfo, JsonRequestBehavior.AllowGet);
		}
		public async Task<ActionResult> GetInfoForGrainType(string type)
		{
		    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
            var dashboardCollectorGrain = clusterClient.GetGrain<IDashboardCollectorGrain>(Guid.Empty);
			var ids = await dashboardCollectorGrain.GetGrainIdsForType(type);

            var grainInfoGrain = clusterClient.GetGrain<IMethodInvocationGrain>(type);
			var methods = new List<GrainMethod>();
			if (_allowMethodsInvocation)
			{
				methods = await grainInfoGrain.GetAvailableMethods();
			}
			var keyType = await grainInfoGrain.GetGrainKeyType();

			return Json(new {Methods = methods, Ids = ids, KeyType = keyType}, JsonRequestBehavior.AllowGet);
		}
Esempio n. 9
0
        public async Task RegisterGrainClient(string grainSessionId)
        {
            await _semaphoreSlim.WaitAsync();

            try
            {
                if (!StreamHandles.ContainsKey(grainSessionId))
                {
                    var clusterClient = await GrainClientMultiton.GetAndConnectClient(grainSessionId);

                    var streamprovider = clusterClient.GetStreamProvider(StreamKeys.StreamProvider);
                    var stream         = streamprovider.GetStream <DiffModel>(Guid.Empty, StreamKeys.OrniscientClient);
                    StreamHandles.Add(grainSessionId, await stream.SubscribeAsync(this));
                }
            }
            finally
            {
                _semaphoreSlim.Release();
            }
        }
Esempio n. 10
0
		public async Task<ActionResult> InvokeGrainMethod(string type, string id, string methodId, string parametersJson,
			bool invokeOnNewGrain = false)
		{
			if (_allowMethodsInvocation)
			{
				try
				{
				    var clusterClient = await GrainClientMultiton.GetAndConnectClient(GrainSessionId);
                    var methodGrain = clusterClient.GetGrain<IMethodInvocationGrain>(type);
					var methodReturnData = await methodGrain.InvokeGrainMethod(id, methodId, parametersJson);
					return Json(methodReturnData, JsonRequestBehavior.AllowGet);

				}
				catch (Exception ex)
				{
					return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Error: " + ex.Message);
				}
			}
			return new HttpStatusCodeResult(HttpStatusCode.Forbidden, "Error: This method cannot be invoked");
		}