Ejemplo n.º 1
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteLong(this.ClientId, "clientId");
             archive.WriteInt(this.Cxid, "cxid");
             archive.WriteLong(this.Zxid, "zxid");
             archive.WriteLong(this.Time, "time");
             archive.WriteInt(this.Type, "type");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 2
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteInt(this.ProtocolVersion, "protocolVersion");
             archive.WriteLong(this.LastZxidSeen, "lastZxidSeen");
             archive.WriteInt(this.TimeOut, "timeOut");
             archive.WriteLong(this.SessionId, "sessionId");
             archive.WriteBuffer(this.Passwd, "passwd");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 3
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (IkZooKeeperNet.IO.EndianBinaryWriter writer =
                    new IkZooKeeperNet.IO.EndianBinaryWriter(IkZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteLong(Czxid, "czxid");
             a_.WriteLong(Mzxid, "mzxid");
             a_.WriteLong(Ctime, "ctime");
             a_.WriteLong(Mtime, "mtime");
             a_.WriteInt(Version, "version");
             a_.WriteInt(Cversion, "cversion");
             a_.WriteInt(Aversion, "aversion");
             a_.WriteLong(EphemeralOwner, "ephemeralOwner");
             a_.WriteLong(Pzxid, "pzxid");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 4
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (ZooKeeperNet.IO.EndianBinaryWriter writer =
                    new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteInt(ProtocolVersion, "protocolVersion");
             a_.WriteLong(LastZxidSeen, "lastZxidSeen");
             a_.WriteInt(TimeOut, "timeOut");
             a_.WriteLong(SessionId, "sessionId");
             a_.WriteBuffer(Passwd, "passwd");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 5
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (Newegg.EC.Zookeeper.Client.Core.IO.EndianBinaryWriter writer =
                    new Newegg.EC.Zookeeper.Client.Core.IO.EndianBinaryWriter(Newegg.EC.Zookeeper.Client.Core.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteLong(ClientId, "clientId");
             a_.WriteInt(Cxid, "cxid");
             a_.WriteLong(Zxid, "zxid");
             a_.WriteLong(Time, "time");
             a_.WriteInt(Type, "type");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 6
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (IkZooKeeperNet.IO.EndianBinaryWriter writer =
                    new IkZooKeeperNet.IO.EndianBinaryWriter(IkZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteInt(Magic, "magic");
             a_.WriteInt(Version, "version");
             a_.WriteLong(Dbid, "dbid");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 7
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteLong(this.Czxid, "czxid");
             binaryOutputArchive.WriteLong(this.Mzxid, "mzxid");
             binaryOutputArchive.WriteLong(this.Ctime, "ctime");
             binaryOutputArchive.WriteLong(this.Mtime, "mtime");
             binaryOutputArchive.WriteInt(this.Version, "version");
             binaryOutputArchive.WriteInt(this.Cversion, "cversion");
             binaryOutputArchive.WriteInt(this.Aversion, "aversion");
             binaryOutputArchive.WriteLong(this.EphemeralOwner, "ephemeralOwner");
             binaryOutputArchive.WriteInt(this.DataLength, "dataLength");
             binaryOutputArchive.WriteInt(this.NumChildren, "numChildren");
             binaryOutputArchive.WriteLong(this.Pzxid, "pzxid");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         Stat.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 8
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteLong(this.Czxid, "czxid");
             archive.WriteLong(this.Mzxid, "mzxid");
             archive.WriteLong(this.Ctime, "ctime");
             archive.WriteLong(this.Mtime, "mtime");
             archive.WriteInt(this.Version, "version");
             archive.WriteInt(this.Cversion, "cversion");
             archive.WriteInt(this.Aversion, "aversion");
             archive.WriteLong(this.EphemeralOwner, "ephemeralOwner");
             archive.WriteLong(this.Pzxid, "pzxid");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 9
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (ZooKeeperNet.IO.EndianBinaryWriter writer =
                    new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteInt(Type, "type");
             a_.WriteInt(State, "state");
             a_.WriteString(Path, "path");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 10
0
 public override String ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (Newegg.EC.Zookeeper.Client.Core.IO.EndianBinaryWriter writer =
                    new Newegg.EC.Zookeeper.Client.Core.IO.EndianBinaryWriter(Newegg.EC.Zookeeper.Client.Core.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteString(Path, "path");
             a_.WriteBuffer(Data, "data");
             a_.WriteInt(Version, "version");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 11
0
   public override String ToString()
   {
       try {
           System.IO.MemoryStream ms = new System.IO.MemoryStream();
           using (ZooKeeperNet.IO.EndianBinaryWriter writer =
                      new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
               BinaryOutputArchive a_ =
                   new BinaryOutputArchive(writer);
               a_.StartRecord(this, string.Empty);
               a_.WriteString(Path, "path");
               a_.WriteBuffer(Data, "data");
               {
                   a_.StartVector(Acl, "acl");
                   if (Acl != null)
                   {
                       foreach (var e1 in Acl)
                       {
                           a_.WriteRecord(e1, "e1");
                       }
                   }
                   a_.EndVector(Acl, "acl");
               }
               a_.WriteInt(Flags, "flags");
               a_.EndRecord(this, string.Empty);
               ms.Position = 0;
               return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
           }
       } catch (Exception ex) {
   #if !NET_CORE
           log.Error(ex);
 #endif
       }
       return("ERROR");
   }
Ejemplo n.º 12
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteInt(this.Type, "type");
             archive.WriteLong(this.Zxid, "zxid");
             archive.WriteBuffer(this.Data, "data");
             archive.StartVector <ZKId>(this.Authinfo, "authinfo");
             if (this.Authinfo != null)
             {
                 foreach (ZKId id in this.Authinfo)
                 {
                     archive.WriteRecord(id, "e1");
                 }
             }
             archive.EndVector <ZKId>(this.Authinfo, "authinfo");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 13
0
 public override String ToString()
 {
     try {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (ZooKeeperNet.IO.EndianBinaryWriter writer =
                    new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
             BinaryOutputArchive a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteInt(Type, "type");
             a_.WriteLong(Zxid, "zxid");
             a_.WriteBuffer(Data, "data");
             {
                 a_.StartVector(Authinfo, "authinfo");
                 if (Authinfo != null)
                 {
                     foreach (var e1 in Authinfo)
                     {
                         a_.WriteRecord(e1, "e1");
                     }
                 }
                 a_.EndVector(Authinfo, "authinfo");
             }
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     } catch (Exception ex) {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 14
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteString(this.Path, "path");
             binaryOutputArchive.StartVector <ACL>(this.Acl, "acl");
             if (this.Acl != null)
             {
                 foreach (ACL acl in this.Acl)
                 {
                     binaryOutputArchive.WriteRecord((IRecord)acl, "e1");
                 }
             }
             binaryOutputArchive.EndVector <ACL>(this.Acl, "acl");
             binaryOutputArchive.WriteInt(this.Version, "version");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         SetACLRequest.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 15
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ = new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteString(Path, "path");
             {
                 a_.StartVector(Acl, "acl");
                 if (Acl != null)
                 {
                     foreach (var e1 in Acl)
                     {
                         a_.WriteRecord(e1, "e1");
                     }
                 }
                 a_.EndVector(Acl, "acl");
             }
             a_.WriteInt(Version, "version");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 16
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteInt(this.Type, "type");
             binaryOutputArchive.WriteLong(this.Zxid, "zxid");
             binaryOutputArchive.WriteBuffer(this.Data, "data");
             binaryOutputArchive.StartVector <ZKId>(this.Authinfo, "authinfo");
             if (this.Authinfo != null)
             {
                 foreach (ZKId zkId in this.Authinfo)
                 {
                     binaryOutputArchive.WriteRecord((IRecord)zkId, "e1");
                 }
             }
             binaryOutputArchive.EndVector <ZKId>(this.Authinfo, "authinfo");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         QuorumPacket.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 17
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteString(this.Path, "path");
             archive.WriteBuffer(this.Data, "data");
             archive.StartVector <ACL>(this.Acl, "acl");
             if (this.Acl != null)
             {
                 foreach (ACL acl in this.Acl)
                 {
                     archive.WriteRecord(acl, "e1");
                 }
             }
             archive.EndVector <ACL>(this.Acl, "acl");
             archive.WriteInt(this.Flags, "flags");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 18
0
 public override String ToString() {
   try {
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     using(ZooKeeperNet.IO.EndianBinaryWriter writer =
       new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
     BinaryOutputArchive a_ = 
       new BinaryOutputArchive(writer);
     a_.StartRecord(this,string.Empty);
   a_.WriteInt(Xid,"xid");
   a_.WriteInt(Type,"type");
     a_.EndRecord(this,string.Empty);
     ms.Position = 0;
     return System.Text.Encoding.UTF8.GetString(ms.ToArray());
   }    } catch (Exception ex) {
     log.Error(ex);
   }
   return "ERROR";
 }
Ejemplo n.º 19
0
 public override String ToString() {
   try {
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     using(ZooKeeperNet.IO.EndianBinaryWriter writer =
       new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
     BinaryOutputArchive a_ = 
       new BinaryOutputArchive(writer);
     a_.StartRecord(this,string.Empty);
   a_.WriteInt(ProtocolVersion,"protocolVersion");
   a_.WriteInt(TimeOut,"timeOut");
   a_.WriteLong(SessionId,"sessionId");
   a_.WriteBuffer(Passwd,"passwd");
     a_.EndRecord(this,string.Empty);
     ms.Position = 0;
     return System.Text.Encoding.UTF8.GetString(ms.ToArray());
   }    } catch (Exception ex) {
     log.Error(ex);
   }
   return "ERROR";
 }
Ejemplo n.º 20
0
 public override String ToString()
 {
     try {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         IkZooKeeperNet.IO.EndianBinaryWriter writer =
             new IkZooKeeperNet.IO.EndianBinaryWriter(IkZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8);
         BinaryOutputArchive a_ =
             new BinaryOutputArchive(writer);
         a_.StartRecord(this, "");
         a_.WriteInt(Rc, "rc");
         a_.WriteInt(Op, "op");
         a_.WriteBuffer(Response, "response");
         a_.EndRecord(this, "");
         ms.Position = 0;
         return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
     } catch (Exception ex) {
         Console.WriteLine(ex.StackTrace);
     }
     return("ERROR");
 }
Ejemplo n.º 21
0
 public override String ToString()
 {
     try {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         IkZooKeeperNet.IO.EndianBinaryWriter writer =
             new IkZooKeeperNet.IO.EndianBinaryWriter(IkZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8);
         BinaryOutputArchive a_ =
             new BinaryOutputArchive(writer);
         a_.StartRecord(this, "");
         a_.WriteInt(ProtocolVersion, "protocolVersion");
         a_.WriteInt(TimeOut, "timeOut");
         a_.WriteLong(SessionId, "sessionId");
         a_.WriteBuffer(Passwd, "passwd");
         a_.EndRecord(this, "");
         ms.Position = 0;
         return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
     } catch (Exception ex) {
         Console.WriteLine(ex.StackTrace);
     }
     return("ERROR");
 }
Ejemplo n.º 22
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteInt(this.Xid, "xid");
             binaryOutputArchive.WriteInt(this.Type, "type");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         RequestHeader.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 23
0
   public override String ToString()
   {
       try {
           System.IO.MemoryStream ms = new System.IO.MemoryStream();
           using (ZooKeeperNet.IO.EndianBinaryWriter writer =
                      new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
               BinaryOutputArchive a_ =
                   new BinaryOutputArchive(writer);
               a_.StartRecord(this, string.Empty);
               a_.WriteInt(Xid, "xid");
               a_.WriteLong(Zxid, "zxid");
               a_.WriteInt(Err, "err");
               a_.EndRecord(this, string.Empty);
               ms.Position = 0;
               return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
           }
       } catch (Exception ex) {
   #if !NET_CORE
           log.Error(ex);
 #endif
       }
       return("ERROR");
   }
Ejemplo n.º 24
0
 public override string ToString()
 {
     try
     {
         MemoryStream stream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, stream, Encoding.UTF8))
         {
             BinaryOutputArchive archive = new BinaryOutputArchive(writer);
             archive.StartRecord(this, string.Empty);
             archive.WriteInt(this.Magic, "magic");
             archive.WriteInt(this.Version, "version");
             archive.WriteLong(this.Dbid, "dbid");
             archive.EndRecord(this, string.Empty);
             stream.Position = 0L;
             return(Encoding.UTF8.GetString(stream.ToArray()));
         }
     }
     catch (Exception exception)
     {
         log.Error(exception);
     }
     return("ERROR");
 }
Ejemplo n.º 25
0
 internal Packet(RequestHeader header, ReplyHeader replyHeader, IRecord request, IRecord response, byte[] data, ZooKeeper.WatchRegistration watchRegistration, string serverPath, string clientPath)
 {
     this.header      = header;
     this.replyHeader = replyHeader;
     this.request     = request;
     this.response    = response;
     this.serverPath  = serverPath;
     this.clientPath  = clientPath;
     if (data != null)
     {
         this.data = data;
     }
     else
     {
         try
         {
             MemoryStream ms = new MemoryStream();
             using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, ms, Encoding.UTF8))
             {
                 BinaryOutputArchive boa = BinaryOutputArchive.getArchive(writer);
                 boa.WriteInt(-1, "len"); // We'll fill this in later
                 if (header != null)
                 {
                     header.Serialize(boa, "header");
                 }
                 if (request != null)
                 {
                     request.Serialize(boa, "request");
                 }
                 ms.Position = 0;
                 int len = Convert.ToInt32(ms.Length); // now we have the real length
                 writer.Write(len - 4);                // update the length info
                 this.data = ms.ToArray();
             }
         }
         #if !NET_CORE
         catch (IOException e)
         {
             LOG.Warn("Ignoring unexpected exception", e);
         }
         #endif
         #if NET_CORE
         catch (Exception e)
         {
         }
         #endif
     }
     this.watchRegistration = watchRegistration;
 }
Ejemplo n.º 26
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteInt(this.ProtocolVersion, "protocolVersion");
             binaryOutputArchive.WriteInt(this.TimeOut, "timeOut");
             binaryOutputArchive.WriteLong(this.SessionId, "sessionId");
             binaryOutputArchive.WriteBuffer(this.Passwd, "passwd");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         ConnectResponse.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 27
0
        private void PrimeConnection(TcpClient client)
        {
            LOG.Info(string.Format("Socket connection established to {0}, initiating session", client.Client.RemoteEndPoint));

            ConnectRequest conReq = new ConnectRequest(0, lastZxid, Convert.ToInt32(conn.SessionTimeout.TotalMilliseconds), conn.SessionId, conn.SessionPassword);

            byte[] buffer;
            using (MemoryStream ms = new MemoryStream())
                using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, ms, Encoding.UTF8))
                {
                    BinaryOutputArchive boa = BinaryOutputArchive.getArchive(writer);
                    boa.WriteInt(-1, "len");
                    conReq.Serialize(boa, "connect");
                    ms.Position = 0;
                    writer.Write(ms.ToArray().Length - 4);
                    buffer = ms.ToArray();
                }
            lock (outgoingQueueLock)
            {
                if (!ClientConnection.disableAutoWatchReset && (!zooKeeper.DataWatches.IsEmpty() || !zooKeeper.ExistWatches.IsEmpty() || !zooKeeper.ChildWatches.IsEmpty()))
                {
                    var sw = new SetWatches(lastZxid, zooKeeper.DataWatches, zooKeeper.ExistWatches, zooKeeper.ChildWatches);
                    var h  = new RequestHeader();
                    h.Type = (int)OpCode.SetWatches;
                    h.Xid  = -8;
                    Packet packet = new Packet(h, new ReplyHeader(), sw, null, null, null, null, null);
                    outgoingQueue.AddFirst(packet);
                }

                foreach (ClientConnection.AuthData id in conn.authInfo)
                {
                    outgoingQueue.AddFirst(new Packet(new RequestHeader(-4, (int)OpCode.Auth), null, new AuthPacket(0, id.scheme, id.data), null, null, null, null, null));
                }
                outgoingQueue.AddFirst((new Packet(null, null, null, null, buffer, null, null, null)));
            }

            lock (this)
            {
                EnableWrite();
            }

            if (LOG.IsDebugEnabled)
            {
                LOG.Debug("Session establishment request sent on " + client.Client.RemoteEndPoint);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     try
     {
         System.IO.MemoryStream ms = new System.IO.MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter(EndianBitConverter.Big, ms, System.Text.Encoding.UTF8))
         {
             BinaryOutputArchive a_ = new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteInt(Max, "max");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(System.Text.Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 29
0
 public override string ToString()
 {
     try
     {
         MemoryStream memoryStream = new MemoryStream();
         using (EndianBinaryWriter writer = new EndianBinaryWriter((EndianBitConverter)EndianBitConverter.Big, (Stream)memoryStream, Encoding.UTF8))
         {
             BinaryOutputArchive binaryOutputArchive = new BinaryOutputArchive(writer);
             binaryOutputArchive.StartRecord((IRecord)this, string.Empty);
             binaryOutputArchive.WriteString(this.Path, "path");
             binaryOutputArchive.WriteInt(this.Max, "max");
             binaryOutputArchive.EndRecord((IRecord)this, string.Empty);
             memoryStream.Position = 0L;
             return(Encoding.UTF8.GetString(memoryStream.ToArray()));
         }
     }
     catch (Exception ex)
     {
         SetMaxChildrenTxn.log.Error((object)ex);
     }
     return("ERROR");
 }
Ejemplo n.º 30
0
 public override string ToString()
 {
     try
     {
         var ms = new MemoryStream();
         using (var writer =
                    new EndianBinaryWriter(EndianBitConverter.Big, ms, Encoding.UTF8))
         {
             var a_ =
                 new BinaryOutputArchive(writer);
             a_.StartRecord(this, string.Empty);
             a_.WriteString(Path, "path");
             a_.WriteBuffer(Data, "data");
             {
                 a_.StartVector(Acl, "acl");
                 if (Acl != null)
                 {
                     foreach (ACL e1 in Acl)
                     {
                         a_.WriteRecord(e1, "e1");
                     }
                 }
                 a_.EndVector(Acl, "acl");
             }
             a_.WriteInt(Flags, "flags");
             a_.EndRecord(this, string.Empty);
             ms.Position = 0;
             return(Encoding.UTF8.GetString(ms.ToArray()));
         }
     }
     catch (Exception ex)
     {
         log.Error(ex);
     }
     return("ERROR");
 }
Ejemplo n.º 31
0
 public override String ToString() {
   try {
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     using(ZooKeeperNet.IO.EndianBinaryWriter writer =
       new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
     BinaryOutputArchive a_ = 
       new BinaryOutputArchive(writer);
     a_.StartRecord(this,string.Empty);
   a_.WriteInt(Type,"type");
   a_.WriteLong(Zxid,"zxid");
   a_.WriteBuffer(Data,"data");
   {
     a_.StartVector(Authinfo,"authinfo");
     if (Authinfo!= null) {          foreach(var e1 in Authinfo) {
   a_.WriteRecord(e1,"e1");
         }
     }
     a_.EndVector(Authinfo,"authinfo");
   }
     a_.EndRecord(this,string.Empty);
     ms.Position = 0;
     return System.Text.Encoding.UTF8.GetString(ms.ToArray());
   }    } catch (Exception ex) {
     log.Error(ex);
   }
   return "ERROR";
 }
Ejemplo n.º 32
0
 public override String ToString() {
   try {
     System.IO.MemoryStream ms = new System.IO.MemoryStream();
     using(ZooKeeperNet.IO.EndianBinaryWriter writer =
       new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
     BinaryOutputArchive a_ = 
       new BinaryOutputArchive(writer);
     a_.StartRecord(this,string.Empty);
   a_.WriteLong(Czxid,"czxid");
   a_.WriteLong(Mzxid,"mzxid");
   a_.WriteLong(Ctime,"ctime");
   a_.WriteLong(Mtime,"mtime");
   a_.WriteInt(Version,"version");
   a_.WriteInt(Cversion,"cversion");
   a_.WriteInt(Aversion,"aversion");
   a_.WriteLong(EphemeralOwner,"ephemeralOwner");
   a_.WriteInt(DataLength,"dataLength");
   a_.WriteInt(NumChildren,"numChildren");
   a_.WriteLong(Pzxid,"pzxid");
     a_.EndRecord(this,string.Empty);
     ms.Position = 0;
     return System.Text.Encoding.UTF8.GetString(ms.ToArray());
   }    } catch (Exception ex) {
     log.Error(ex);
   }
   return "ERROR";
 }
Ejemplo n.º 33
0
 public override String ToString()
 {
     try {
       System.IO.MemoryStream ms = new System.IO.MemoryStream();
       using(ZooKeeperNet.IO.EndianBinaryWriter writer =
     new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
       BinaryOutputArchive a_ =
     new BinaryOutputArchive(writer);
       a_.StartRecord(this,string.Empty);
     a_.WriteInt(Magic,"magic");
     a_.WriteInt(Version,"version");
     a_.WriteLong(Dbid,"dbid");
       a_.EndRecord(this,string.Empty);
       ms.Position = 0;
       return System.Text.Encoding.UTF8.GetString(ms.ToArray());
     }    } catch (Exception ex) {
     #if !NET_CORE
       log.Error(ex);
       #endif
     }
     return "ERROR";
 }
Ejemplo n.º 34
0
 public override String ToString()
 {
     try {
       System.IO.MemoryStream ms = new System.IO.MemoryStream();
       using(ZooKeeperNet.IO.EndianBinaryWriter writer =
     new ZooKeeperNet.IO.EndianBinaryWriter(ZooKeeperNet.IO.EndianBitConverter.Big, ms, System.Text.Encoding.UTF8)){
       BinaryOutputArchive a_ =
     new BinaryOutputArchive(writer);
       a_.StartRecord(this,string.Empty);
     a_.WriteString(Path,"path");
     {
       a_.StartVector(Acl,"acl");
       if (Acl!= null) {          foreach(var e1 in Acl) {
     a_.WriteRecord(e1,"e1");
       }
       }
       a_.EndVector(Acl,"acl");
     }
     a_.WriteInt(Version,"version");
       a_.EndRecord(this,string.Empty);
       ms.Position = 0;
       return System.Text.Encoding.UTF8.GetString(ms.ToArray());
     }    } catch (Exception ex) {
     #if !NET_CORE
       log.Error(ex);
       #endif
     }
     return "ERROR";
 }