예제 #1
0
        public Task UpdateIndexVolumeAsync(IndexVolumeWriter indexvolume, BlockVolumeWriter blockvolume)
        {
            if (indexvolume != null)
            {
                return(Task.FromResult <bool>(true));
            }

            return(RunOnMain(() =>
            {
                m_database.AddIndexBlockLink(indexvolume.VolumeID, blockvolume.VolumeID, m_transaction);
                indexvolume.StartVolume(blockvolume.RemoteFilename);

                foreach (var b in m_database.GetBlocks(blockvolume.VolumeID, m_transaction))
                {
                    indexvolume.AddBlock(b.Hash, b.Size);
                }

                m_database.UpdateRemoteVolume(indexvolume.RemoteFilename, RemoteVolumeState.Uploading, -1, null, m_transaction);
            }));
        }