Пример #1
0
        private static TaskCache[] LoadTasks(IEnumerable <string> resourceNames)
        {
            lock (_dumpedLock)
            {
                var loaded = _dumpedTasks.Values.ToArray();
                //_dumpedTasks.Clear();
                return(loaded);
            }

            return(new TaskCache[0]);


            var collection = Mongo.GetCollection <TaskCache>();
            var tasks      = collection.AsQueryable <TaskCache>()
                             .Where(t =>
                                    t.Context.Resource.ResourceName.In(resourceNames) &&
                                    t.StateInfo.State == TaskState.Started
                                    ).ToArray();

            foreach (var task in tasks)
            {
                SetControllerForLoadedTask(task);
            }

            return(tasks);
        }
Пример #2
0
        private static NodeStateInfo[] LoadStates(IEnumerable <string> resourceNames)
        {
            return(new NodeStateInfo[0]); // todo : node save

            var collection = Mongo.GetCollection <NodeStateInfo[]>();
            var nodeStates = collection.AsQueryable <NodeStateInfo>().Where(n => n.ResourceName.In(resourceNames)).ToArray();

            return(nodeStates);
        }
Пример #3
0
        public void Save()
        {
            return; // todo: node save

            var collection = Mongo.GetCollection <NodeStateInfo[]>();

            lock (StateLock)
            {
                collection.Save(NodeStateInfo);
            }
        }
Пример #4
0
        private static TaskCache LoadTask(ulong taskId)
        {
            var collection = Mongo.GetCollection <TaskCache>();
            var task       = collection.AsQueryable <TaskCache>().Where(t => t.Context.TaskId == taskId).SingleOrDefault();

            if (task != null)
            {
                SetControllerForLoadedTask(task);
            }

            return(task);
        }
Пример #5
0
        private void Save()
        {
            lock (_dumpedLock)
            {
                _dumpedTasks[this.Context.TaskId] = this;
            }

            var collection = Mongo.GetCollection <TaskCache>();

            lock (this.StateLock)
            {
                collection.Save(this);
            }
        }