public void send_chmod(Pathname path, short mode)
 {
     oprot_.WriteMessageBegin(new TMessage("chmod", TMessageType.Call, seqid_));
     chmod_args args = new chmod_args();
     args.Path = path;
     args.Mode = mode;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 2
0
        /// <summary>
        /// 删除文件或文件夹
        /// </summary>
        /// <param name="path"></param>
        /// <param name="recursive">是否删除子文件夹</param>
        /// <returns></returns>
        public bool Delete(string path,bool recursive)
        {
            TBufferedTransport tsport = null;
               ThriftHadoopFileSystem.Client client = Connect(out tsport);
               bool result = false;
               if (client != null)
               {
               Pathname pn = new Pathname() { pathname = path };
               if (client.exists(pn))//如果不存在才执行
                   result = client.rm(pn, recursive);
               tsport.Close();

               }
               return result;
        }
Exemplo n.º 3
0
 //剪切
 public List<string> Move(string[] sourcePath, string dectPath)
 {
     TBufferedTransport tsport = null;
        ThriftHadoopFileSystem.Client client = Connect(out tsport);
        List<string> result = new List<string>();
        if (client != null)
        {
        foreach (string itemSource in sourcePath)
        {
            Pathname pn = new Pathname() { pathname = itemSource };
           string fileName= itemSource.Substring(itemSource.LastIndexOf('/')+1);
           if (client.exists(pn))//如果存在才执行
           {
             bool thResult=  client.rename(pn, new Pathname() { pathname = dectPath + "/" + fileName });
             if (!thResult)
             {
                 result.Add(fileName);
             }
           }
        }
        tsport.Close();
        }
        return result;
 }
 public List<BlockLocation> getFileBlockLocations(Pathname path, long start, long length)
 {
     send_getFileBlockLocations(path, start, length);
     return recv_getFileBlockLocations();
 }
 public bool mkdirs(Pathname path)
 {
     send_mkdirs(path);
     return recv_mkdirs();
 }
 public void chown(Pathname path, string owner, string group)
 {
     send_chown(path, owner, group);
     recv_chown();
 }
 public ThriftHandle createFile(Pathname path, short mode, bool overwrite, int bufferSize, short block_replication, long blocksize)
 {
     send_createFile(path, mode, overwrite, bufferSize, block_replication, blocksize);
     return recv_createFile();
 }
 public void send_mkdirs(Pathname path)
 {
     oprot_.WriteMessageBegin(new TMessage("mkdirs", TMessageType.Call, seqid_));
     mkdirs_args args = new mkdirs_args();
     args.Path = path;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
 public void send_rename(Pathname path, Pathname dest)
 {
     oprot_.WriteMessageBegin(new TMessage("rename", TMessageType.Call, seqid_));
     rename_args args = new rename_args();
     args.Path = path;
     args.Dest = dest;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 10
0
 public void send_getFileBlockLocations(Pathname path, long start, long length)
 {
     oprot_.WriteMessageBegin(new TMessage("getFileBlockLocations", TMessageType.Call, seqid_));
     getFileBlockLocations_args args = new getFileBlockLocations_args();
     args.Path = path;
     args.Start = start;
     args.Length = length;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 11
0
 public void send_listStatus(Pathname path)
 {
     oprot_.WriteMessageBegin(new TMessage("listStatus", TMessageType.Call, seqid_));
     listStatus_args args = new listStatus_args();
     args.Path = path;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 12
0
 public void send_createFile(Pathname path, short mode, bool overwrite, int bufferSize, short block_replication, long blocksize)
 {
     oprot_.WriteMessageBegin(new TMessage("createFile", TMessageType.Call, seqid_));
     createFile_args args = new createFile_args();
     args.Path = path;
     args.Mode = mode;
     args.Overwrite = overwrite;
     args.BufferSize = bufferSize;
     args.Block_replication = block_replication;
     args.Blocksize = blocksize;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 13
0
 public void send_create(Pathname path)
 {
     oprot_.WriteMessageBegin(new TMessage("create", TMessageType.Call, seqid_));
     create_args args = new create_args();
     args.Path = path;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 14
0
 public void send_chown(Pathname path, string owner, string group)
 {
     oprot_.WriteMessageBegin(new TMessage("chown", TMessageType.Call, seqid_));
     chown_args args = new chown_args();
     args.Path = path;
     args.Owner = owner;
     args.Group = group;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 15
0
 public ThriftHandle append(Pathname path)
 {
     send_append(path);
     return recv_append();
 }
Exemplo n.º 16
0
 public void send_rm(Pathname path, bool recursive)
 {
     oprot_.WriteMessageBegin(new TMessage("rm", TMessageType.Call, seqid_));
     rm_args args = new rm_args();
     args.Path = path;
     args.Recursive = recursive;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 17
0
 public void chmod(Pathname path, short mode)
 {
     send_chmod(path, mode);
     recv_chmod();
 }
Exemplo n.º 18
0
 public void send_setReplication(Pathname path, short replication)
 {
     oprot_.WriteMessageBegin(new TMessage("setReplication", TMessageType.Call, seqid_));
     setReplication_args args = new setReplication_args();
     args.Path = path;
     args.Replication = replication;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 19
0
 public ThriftHandle create(Pathname path)
 {
     send_create(path);
     return recv_create();
 }
Exemplo n.º 20
0
 public void send_stat(Pathname path)
 {
     oprot_.WriteMessageBegin(new TMessage("stat", TMessageType.Call, seqid_));
     stat_args args = new stat_args();
     args.Path = path;
     args.Write(oprot_);
     oprot_.WriteMessageEnd();
     oprot_.Transport.Flush();
 }
Exemplo n.º 21
0
 public bool exists(Pathname path)
 {
     send_exists(path);
     return recv_exists();
 }
Exemplo n.º 22
0
 public void setReplication(Pathname path, short replication)
 {
     send_setReplication(path, replication);
     recv_setReplication();
 }
Exemplo n.º 23
0
 public List<FileStatus> listStatus(Pathname path)
 {
     send_listStatus(path);
     return recv_listStatus();
 }
Exemplo n.º 24
0
 public FileStatus stat(Pathname path)
 {
     send_stat(path);
     return recv_stat();
 }
Exemplo n.º 25
0
 public ThriftHandle open(Pathname path)
 {
     send_open(path);
     return recv_open();
 }
Exemplo n.º 26
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) {
     break;
       }
       switch (field.ID)
       {
     case 1:
       if (field.Type == TType.Struct) {
     Path = new Pathname();
     Path.Read(iprot);
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 2:
       if (field.Type == TType.I16) {
     Mode = iprot.ReadI16();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 3:
       if (field.Type == TType.Bool) {
     Overwrite = iprot.ReadBool();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 4:
       if (field.Type == TType.I32) {
     BufferSize = iprot.ReadI32();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 5:
       if (field.Type == TType.I16) {
     Block_replication = iprot.ReadI16();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 6:
       if (field.Type == TType.I64) {
     Blocksize = iprot.ReadI64();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 27
0
 //新建文件夹
 public bool MakeDir(string path)
 {
     TBufferedTransport tsport = null;
        ThriftHadoopFileSystem.Client client = Connect(out tsport);
        bool result = false;
        if (client != null)
        {
        Pathname pn = new Pathname() { pathname = path };
        if (!client.exists(pn))//如果不存在才执行
            result = client.mkdirs(pn);
        tsport.Close();
        }
        return result;
 }
Exemplo n.º 28
0
 public void Read(TProtocol iprot)
 {
     TField field;
     iprot.ReadStructBegin();
     while (true)
     {
       field = iprot.ReadFieldBegin();
       if (field.Type == TType.Stop) {
     break;
       }
       switch (field.ID)
       {
     case 1:
       if (field.Type == TType.Struct) {
     Path = new Pathname();
     Path.Read(iprot);
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 2:
       if (field.Type == TType.String) {
     Owner = iprot.ReadString();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     case 3:
       if (field.Type == TType.String) {
     Group = iprot.ReadString();
       } else {
     TProtocolUtil.Skip(iprot, field.Type);
       }
       break;
     default:
       TProtocolUtil.Skip(iprot, field.Type);
       break;
       }
       iprot.ReadFieldEnd();
     }
     iprot.ReadStructEnd();
 }
Exemplo n.º 29
0
        //重命名文件或文件夹
        public bool ReName(string oldPath,string newPath)
        {
            TBufferedTransport tsport = null;
               ThriftHadoopFileSystem.Client client = Connect(out tsport);
               bool result = false;
               if (client != null)
               {
               Pathname pn=new Pathname() { pathname = oldPath };
               if (client.exists(pn))//如果存在才执行
                   result = client.rename(pn, new Pathname() { pathname = newPath });

               tsport.Close();
               }
               return result;
        }
Exemplo n.º 30
0
 public bool rm(Pathname path, bool recursive)
 {
     send_rm(path, recursive);
     return recv_rm();
 }