public void Write(ThriftProtocol oprot)
        {
            TStruct struc = new TStruct(/*"TApplicationException"*/);
            TField  field = new TField();

            oprot.WriteStructBegin(struc);

            if (!string.IsNullOrEmpty(Message))
            {
//				field.Name = "message";
                field.Type = TType.String;
                field.ID   = 1;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(Message);
                oprot.WriteFieldEnd();
            }

//			field.Name = "type";
            field.Type = TType.I32;
            field.ID   = 2;
            oprot.WriteFieldBegin(field);
            oprot.WriteI32((int)type);
            oprot.WriteFieldEnd();

            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Esempio n. 2
0
            public void Write(ThriftProtocol oprot)
            {
                oprot.IncrementRecursionDepth();
                try
                {
                    var struc = new TStruct(/*"Log_result"*/);
                    oprot.WriteStructBegin(struc);
                    var field = new TField();

                    if (this.Success != null)
                    {
//						field.Name = "Success";
                        field.Type = TType.I32;
                        field.ID   = 0;
                        oprot.WriteFieldBegin(field);
                        oprot.WriteI32((int)Success.Value);
                        oprot.WriteFieldEnd();
                    }
                    oprot.WriteFieldStop();
                    oprot.WriteStructEnd();
                }
                finally
                {
                    oprot.DecrementRecursionDepth();
                }
            }
Esempio n. 3
0
            public void Write(ThriftProtocol oprot)
            {
                oprot.IncrementRecursionDepth();
                try
                {
                    var struc = new TStruct(/*"Log_args"*/);
                    oprot.WriteStructBegin(struc);
                    TField field = new TField();
                    if (Messages != null)
                    {
//						field.Name = "messages";
                        field.Type = TType.List;
                        field.ID   = 1;
                        oprot.WriteFieldBegin(field);
                        {
                            oprot.WriteListBegin(new TList(TType.Struct, Messages.Count));
                            foreach (LogEntry logEntry in Messages)
                            {
                                // logEntry.Write(oprot);
                                LogEntrySerializer.Write(oprot, logEntry);
                            }
                            oprot.WriteListEnd();
                        }
                        oprot.WriteFieldEnd();
                    }
                    oprot.WriteFieldStop();
                    oprot.WriteStructEnd();
                }
                finally
                {
                    oprot.DecrementRecursionDepth();
                }
            }
Esempio n. 4
0
        public static void Write(Endpoint endpoint, ThriftProtocol oprot)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                TStruct struc = new TStruct(/*"Endpoint"*/);
                oprot.WriteStructBegin(struc);
                TField field = new TField();
                if (endpoint.IPAddress != null)
                {
//					field.Name = "ipv4";
                    field.Type = TType.I32;
                    field.ID   = 1;
                    oprot.WriteFieldBegin(field);
                    // oprot.WriteI32(endpoint.IPAddress.);

                    var address = endpoint.IPAddress.GetAddressBytes();
                    oprot.WriteI32(BitConverter.ToInt32(address, 0));

                    oprot.WriteFieldEnd();
                }
                if (endpoint.Port.HasValue)
                {
//					field.Name = "port";
                    field.Type = TType.I16;
                    field.ID   = 2;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI16((short)endpoint.Port.Value);
                    oprot.WriteFieldEnd();
                }
                if (endpoint.ServiceName != null)
                {
//					field.Name = "service_name";
                    field.Type = TType.String;
                    field.ID   = 3;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteString(endpoint.ServiceName);
                    oprot.WriteFieldEnd();
                }
                oprot.WriteFieldStop();
                oprot.WriteStructEnd();
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Esempio n. 5
0
        public static void Write(Annotation annotation, ThriftProtocol oprot)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                TStruct struc = new TStruct(/*"Annotation"*/);
                oprot.WriteStructBegin(struc);
                TField field = new TField();
                // if (annotation.Timestamp != DateTimeOffset.MinValue)
                {
//					field.Name = "timestamp";
                    field.Type = TType.I64;
                    field.ID   = 1;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(annotation.Timestamp.ToNixTimeMicro());
                    oprot.WriteFieldEnd();
                }
                if (annotation.Value != null)
                {
//					field.Name = "value";
                    field.Type = TType.String;
                    field.ID   = 2;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteString(annotation.Value);
                    oprot.WriteFieldEnd();
                }
                if (annotation.Host != null)
                {
//					field.Name = "host";
                    field.Type = TType.Struct;
                    field.ID   = 3;
                    oprot.WriteFieldBegin(field);
                    // annotation.Host.Write(oprot);
                    EndpointSerializer.Write(annotation.Host, oprot);
                    oprot.WriteFieldEnd();
                }
                oprot.WriteFieldStop();
                oprot.WriteStructEnd();
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Esempio n. 6
0
        public static void Write(Span span, ThriftProtocol oprot)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct(/*"Span"*/);
                oprot.WriteStructBegin(struc);
                var field = new TField();
                if (span.TraceId != 0L)
                {
//					field.Name = "trace_id";
                    field.Type = TType.I64;
                    field.ID   = 1;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(span.TraceId);
                    oprot.WriteFieldEnd();
                }
                if (span.Name != null)
                {
//					field.Name = "name";
                    field.Type = TType.String;
                    field.ID   = 3;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteString(span.Name);
                    oprot.WriteFieldEnd();
                }
                if (span.Id != 0)
                {
//					field.Name = "id";
                    field.Type = TType.I64;
                    field.ID   = 4;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(span.Id);
                    oprot.WriteFieldEnd();
                }
                if (span.ParentId.HasValue)
                {
//					field.Name = "parent_id";
                    field.Type = TType.I64;
                    field.ID   = 5;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(span.ParentId.Value);
                    oprot.WriteFieldEnd();
                }
                if (span.Annotations != null && span.Annotations.Count != 0)
                {
//					field.Name = "annotations";
                    field.Type = TType.List;
                    field.ID   = 6;
                    oprot.WriteFieldBegin(field);
                    {
                        oprot.WriteListBegin(new TList(TType.Struct, span.Annotations.Count));
                        foreach (var annotation in span.Annotations)
                        {
                            AnnotationSerializer.Write(annotation, oprot);
                        }
                        oprot.WriteListEnd();
                    }
                    oprot.WriteFieldEnd();
                }
                if (span.BinaryAnnotations != null && span.BinaryAnnotations.Count != 0)
                {
//					field.Name = "binary_annotations";
                    field.Type = TType.List;
                    field.ID   = 8;
                    oprot.WriteFieldBegin(field);
                    {
                        oprot.WriteListBegin(new TList(TType.Struct, span.BinaryAnnotations.Count));
                        foreach (BinaryAnnotation annotation in span.BinaryAnnotations)
                        {
                            BinaryAnnotationSerializer.Write(annotation, oprot);
                            // _iter7.Write(oprot);
                        }
                        oprot.WriteListEnd();
                    }
                    oprot.WriteFieldEnd();
                }
                if (span.IsDebug)
                {
//					field.Name = "debug";
                    field.Type = TType.Bool;
                    field.ID   = 9;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteBool(span.IsDebug);
                    oprot.WriteFieldEnd();
                }
                if (span.Timestamp != null)
                {
//					field.Name = "timestamp";
                    field.Type = TType.I64;
                    field.ID   = 10;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(span.Timestamp.Value.ToNixTimeMicro());
                    oprot.WriteFieldEnd();
                }
                if (span.DurationInMicroseconds.HasValue)
                {
//					field.Name = "duration";
                    field.Type = TType.I64;
                    field.ID   = 11;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI64(span.DurationInMicroseconds.Value);
                    oprot.WriteFieldEnd();
                }
                oprot.WriteFieldStop();
                oprot.WriteStructEnd();
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Esempio n. 7
0
        public static void Write(BinaryAnnotation annotation, ThriftProtocol oprot)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct(/*"BinaryAnnotation"*/);
                oprot.WriteStructBegin(struc);
                var field = new TField();
                if (annotation.Key != null)
                {
//					field.Name = "key";
                    field.Type = TType.String;
                    field.ID   = 1;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteString(annotation.Key);
                    oprot.WriteFieldEnd();
                }
                // if (annotation.Value != null)
                {
//					field.Name = "value";
                    field.Type = TType.String;
                    field.ID   = 2;
                    oprot.WriteFieldBegin(field);

                    switch (annotation.AnnotationType)
                    {
                    case AnnotationType.BOOL:
                        oprot.WriteI32(1);
                        oprot.WriteByte((sbyte)(annotation.ValAsBool ? 1 : 0));
                        break;

                    case AnnotationType.I16:
                        oprot.WriteI32(2);
                        oprot.WriteI16(annotation.ValAsI16);
                        break;

                    case AnnotationType.I32:
                        oprot.WriteI32(4);
                        oprot.WriteI32(annotation.ValAsI32);
                        break;

                    case AnnotationType.I64:
                        oprot.WriteI32(8);
                        oprot.WriteI64(annotation.ValAsI64);
                        break;

                    case AnnotationType.DOUBLE:
                        oprot.WriteI32(8);
                        oprot.WriteDouble(annotation.ValAsDouble);
                        break;

                    case AnnotationType.BYTES:
                        oprot.WriteBinary(annotation.ValAsBArray, 0, annotation.ValAsBArray.Length);
                        break;

                    case AnnotationType.STRING:
                        oprot.WriteString(annotation.ValAsString);
                        break;
                    }

                    // oprot.WriteBinary(annotation.Value);
                    oprot.WriteFieldEnd();
                }
                // if (annotation.AnnotationType != null)
                {
//					field.Name = "annotation_type";
                    field.Type = TType.I32;
                    field.ID   = 3;
                    oprot.WriteFieldBegin(field);
                    oprot.WriteI32((int)annotation.AnnotationType);
                    oprot.WriteFieldEnd();
                }
                if (annotation.Host != null)
                {
//					field.Name = "host";
                    field.Type = TType.Struct;
                    field.ID   = 4;
                    oprot.WriteFieldBegin(field);
                    EndpointSerializer.Write(annotation.Host, oprot);
                    //annotation.Host.Write(oprot);
                    oprot.WriteFieldEnd();
                }
                oprot.WriteFieldStop();
                oprot.WriteStructEnd();
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }