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); }
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); }
public void Save() { return; // todo: node save var collection = Mongo.GetCollection <NodeStateInfo[]>(); lock (StateLock) { collection.Save(NodeStateInfo); } }
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); }
private void Save() { lock (_dumpedLock) { _dumpedTasks[this.Context.TaskId] = this; } var collection = Mongo.GetCollection <TaskCache>(); lock (this.StateLock) { collection.Save(this); } }