コード例 #1
0
 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();
 }
コード例 #2
0
ファイル: HdfsClient.cs プロジェクト: cvs1989/hooyeswidget
        /// <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;
        }
コード例 #3
0
ファイル: HdfsClient.cs プロジェクト: cvs1989/hooyeswidget
 //剪切
 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;
 }
コード例 #4
0
 public List<BlockLocation> getFileBlockLocations(Pathname path, long start, long length)
 {
     send_getFileBlockLocations(path, start, length);
     return recv_getFileBlockLocations();
 }
コード例 #5
0
 public bool mkdirs(Pathname path)
 {
     send_mkdirs(path);
     return recv_mkdirs();
 }
コード例 #6
0
 public void chown(Pathname path, string owner, string group)
 {
     send_chown(path, owner, group);
     recv_chown();
 }
コード例 #7
0
 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();
 }
コード例 #8
0
 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();
 }
コード例 #9
0
 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();
 }
コード例 #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();
 }
コード例 #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();
 }
コード例 #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();
 }
コード例 #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();
 }
コード例 #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();
 }
コード例 #15
0
 public ThriftHandle append(Pathname path)
 {
     send_append(path);
     return recv_append();
 }
コード例 #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();
 }
コード例 #17
0
 public void chmod(Pathname path, short mode)
 {
     send_chmod(path, mode);
     recv_chmod();
 }
コード例 #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();
 }
コード例 #19
0
 public ThriftHandle create(Pathname path)
 {
     send_create(path);
     return recv_create();
 }
コード例 #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();
 }
コード例 #21
0
 public bool exists(Pathname path)
 {
     send_exists(path);
     return recv_exists();
 }
コード例 #22
0
 public void setReplication(Pathname path, short replication)
 {
     send_setReplication(path, replication);
     recv_setReplication();
 }
コード例 #23
0
 public List<FileStatus> listStatus(Pathname path)
 {
     send_listStatus(path);
     return recv_listStatus();
 }
コード例 #24
0
 public FileStatus stat(Pathname path)
 {
     send_stat(path);
     return recv_stat();
 }
コード例 #25
0
 public ThriftHandle open(Pathname path)
 {
     send_open(path);
     return recv_open();
 }
コード例 #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();
 }
コード例 #27
0
ファイル: HdfsClient.cs プロジェクト: cvs1989/hooyeswidget
 //新建文件夹
 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;
 }
コード例 #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();
 }
コード例 #29
0
ファイル: HdfsClient.cs プロジェクト: cvs1989/hooyeswidget
        //重命名文件或文件夹
        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;
        }
コード例 #30
0
 public bool rm(Pathname path, bool recursive)
 {
     send_rm(path, recursive);
     return recv_rm();
 }