Exemplo n.º 1
0
        internal async Task RestoreCurrentPartition(Guid task_id, Guid version, EventArgs e)
        {
            var downloader = await m_pstore.Download(version, m_namesvc.PartitionId, 0, 0);

            await m_backupmgr.Restore(downloader, e);

            // After the backup manager finishes state restoration, chunk tables,
            // name service, pending tasks should be all restored. Thus we load
            // chunks into replicas as per described by the chunk table.

            List <PersistedLoadTask> passive_tasks = new List <PersistedLoadTask>();
            var cts = m_dmc.m_cloudidx.GetMyPartitionReplicaChunks();

            foreach (var(rep, cks) in cts)
            {
                passive_tasks.Add(new PersistedLoadTask(cks
                                                        .Select(ck => (rep, new PersistedSlice(version, ck.LowKey, ck.HighKey)))));
            }
            GroupedTask gt = new GroupedTask(passive_tasks, task_id);
            await m_taskqueue.PostTask(gt);

            await m_taskqueue.Wait(task_id);
        }