Exemplo n.º 1
0
 public override void Eval(Client c, IFSObject obj)
 {
     base.Eval(c, obj);
     var srcFile = obj as BaseFile;
     c.Log(LogLevel.Info, "Отсылаю команду \"удалить файл {0}\"", srcFile.Name);
     c.Environment.SendToAll(new DeleteFSObjMessage(srcFile));
 }
Exemplo n.º 2
0
 public override void Eval(Client c, IFSObject obj)
 {
     base.Eval(c, obj);
     var srcFile = obj as BaseFile;
     if (c.GetFileReplics(srcFile).Contains(c))/// srcFile.InReplics(c.Id))
     {
         var owner = c.GetFileOwner(srcFile);
         c.Log(LogLevel.Info, "Получение реплики для {0}", srcFile.Name);
         if (owner != null && owner.IsRemote)
             (owner as RemoteClient).Send(new DownloadFileMessage(srcFile, null));
     }
 }
Exemplo n.º 3
0
        public override void Eval(Client c, IFSObject obj)
        {
            base.Eval(c, obj);
            var srcFile = obj as BaseFile;
            c.Log(LogLevel.Info, "становлюсь координатором {0}", srcFile.Name);
            srcFile.SetOwner(c.Id.ToString());

            lock (c.RemoteClients)
            {
                foreach (var r in c.GetRandomClients(2, c.RemoteClients))
                    srcFile.AddReplica(r.Id.ToString());

            }
            c.Log(LogLevel.Info, "Рассылаю обновленную метаинформацию", srcFile.Name);
            env.SendToAll(new NewFileMessage(srcFile));
        }