Exemple #1
0
func (p *LogEntry) ReadField2(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v2, err3 := iprot.ReadString()
	if err3 != nil {
		return thrift.NewTProtocolExceptionReadField(2, "message", p.ThriftName(), err3)
	}
	p.Message = v2
	return err
}
Exemple #2
0
func (p *LogResult) ReadField0(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v24, err25 := iprot.ReadI32()
	if err25 != nil {
		return thrift.NewTProtocolExceptionReadField(0, "success", p.ThriftName(), err25)
	}
	p.Success = ResultCode(v24)
	return err
}
Exemple #3
0
func (p *LogEntry) ReadField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	v0, err1 := iprot.ReadString()
	if err1 != nil {
		return thrift.NewTProtocolExceptionReadField(1, "category", p.ThriftName(), err1)
	}
	p.Category = v0
	return err
}
Exemple #4
0
func (p *LogArgs) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	if p.Messages != nil {
		err = oprot.WriteFieldBegin("messages", thrift.LIST, 1)
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "messages", p.ThriftName(), err)
		}
		err = oprot.WriteListBegin(thrift.STRUCT, p.Messages.Len())
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
		}
		for Iter22 := range p.Messages.Iter() {
			Iter23 := Iter22.(*LogEntry)
			err = Iter23.Write(oprot)
			if err != nil {
				return thrift.NewTProtocolExceptionWriteStruct("LogEntry", err)
			}
		}
		err = oprot.WriteListEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(-1, "", "list", err)
		}
		err = oprot.WriteFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionWriteField(1, "messages", p.ThriftName(), err)
		}
	}
	return err
}
Exemple #5
0
func (p *LogArgs) ReadField1(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	_etype16, _size13, err := iprot.ReadListBegin()
	if err != nil {
		return thrift.NewTProtocolExceptionReadField(-1, "p.Messages", "", err)
	}
	p.Messages = thrift.NewTList(_etype16, _size13)
	for _i17 := 0; _i17 < _size13; _i17++ {
		_elem18 := NewLogEntry()
		err21 := _elem18.Read(iprot)
		if err21 != nil {
			return thrift.NewTProtocolExceptionReadStruct("_elem18LogEntry", err21)
		}
		p.Messages.Push(_elem18)
	}
	err = iprot.ReadListEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionReadField(-1, "", "list", err)
	}
	return err
}
Exemple #6
0
func (p *LogEntry) WriteField2(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("message", thrift.STRING, 2)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.Message))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(2, "message", p.ThriftName(), err)
	}
	return err
}
Exemple #7
0
func (p *LogEntry) WriteField1(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("category", thrift.STRING, 1)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
	}
	err = oprot.WriteString(string(p.Category))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(1, "category", p.ThriftName(), err)
	}
	return err
}
Exemple #8
0
func (p *LogResult) WriteField0(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteFieldBegin("success", thrift.I32, 0)
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
	}
	err = oprot.WriteI32(int32(p.Success))
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
	}
	err = oprot.WriteFieldEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(0, "success", p.ThriftName(), err)
	}
	return err
}
Exemple #9
0
func (p *LogArgs) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("Log_args")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	err = p.WriteField1(oprot)
	if err != nil {
		return err
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
Exemple #10
0
func (p *LogResult) Write(oprot thrift.TProtocol) (err thrift.TProtocolException) {
	err = oprot.WriteStructBegin("Log_result")
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	switch {
	default:
		if err = p.WriteField0(oprot); err != nil {
			return err
		}
	}
	err = oprot.WriteFieldStop()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteField(-1, "STOP", p.ThriftName(), err)
	}
	err = oprot.WriteStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionWriteStruct(p.ThriftName(), err)
	}
	return err
}
Exemple #11
0
func (p *LogEntry) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	_, err = iprot.ReadStructBegin()
	if err != nil {
		return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
	}
	for {
		fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if fieldId < 0 {
			fieldId = int16(p.FieldIdFromFieldName(fieldName))
		} else if fieldName == "" {
			fieldName = p.FieldNameFromFieldId(int(fieldId))
		}
		if fieldTypeId == thrift.GENERIC {
			fieldTypeId = p.FieldFromFieldId(int(fieldId)).TypeId()
		}
		if err != nil {
			return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		if fieldId == 1 || fieldName == "category" {
			if fieldTypeId == thrift.STRING {
				err = p.ReadField1(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField1(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else if fieldId == 2 || fieldName == "message" {
			if fieldTypeId == thrift.STRING {
				err = p.ReadField2(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField2(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else {
			err = iprot.Skip(fieldTypeId)
			if err != nil {
				return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
			}
		}
		err = iprot.ReadFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
		}
	}
	err = iprot.ReadStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
	}
	return err
}
Exemple #12
0
func (p *LogResult) Read(iprot thrift.TProtocol) (err thrift.TProtocolException) {
	_, err = iprot.ReadStructBegin()
	if err != nil {
		return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
	}
	for {
		fieldName, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if fieldId < 0 {
			fieldId = int16(p.FieldIdFromFieldName(fieldName))
		} else if fieldName == "" {
			fieldName = p.FieldNameFromFieldId(int(fieldId))
		}
		if fieldTypeId == thrift.GENERIC {
			fieldTypeId = p.FieldFromFieldId(int(fieldId)).TypeId()
		}
		if err != nil {
			return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		if fieldId == 0 || fieldName == "success" {
			if fieldTypeId == thrift.I32 {
				err = p.ReadField0(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else if fieldTypeId == thrift.VOID {
				err = iprot.Skip(fieldTypeId)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			} else {
				err = p.ReadField0(iprot)
				if err != nil {
					return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
				}
			}
		} else {
			err = iprot.Skip(fieldTypeId)
			if err != nil {
				return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
			}
		}
		err = iprot.ReadFieldEnd()
		if err != nil {
			return thrift.NewTProtocolExceptionReadField(int(fieldId), fieldName, p.ThriftName(), err)
		}
	}
	err = iprot.ReadStructEnd()
	if err != nil {
		return thrift.NewTProtocolExceptionReadStruct(p.ThriftName(), err)
	}
	return err
}
Exemple #13
0
func (p *scribeProcessorLog) Process(seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	args := NewLogArgs()
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Transport().Flush()
		return
	}
	iprot.ReadMessageEnd()
	result := NewLogResult()
	if result.Success, err = p.handler.Log(args.Messages); err != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing Log: "+err.Error())
		oprot.WriteMessageBegin("Log", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Transport().Flush()
		return
	}
	if err2 := oprot.WriteMessageBegin("Log", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 := result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 := oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 := oprot.Transport().Flush(); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}