作者:bado
项目:thunde
func (s *StatsCtx) RequestConfigJson(rctx gpbrpc.RequestT, request *badoo_service.RequestConfigJson) gpbrpc.ResultT {
buf, err := json.Marshal(config)
if err != nil {
return gpbrpc.Result(&badoo_service.ResponseGeneric{
ErrorCode: proto.Int32(-int32(badoo_service.Errno_ERRNO_GENERIC)),
ErrorText: proto.String(fmt.Sprintf("error while marshalling config to json: %s", err)),
})
}
result := badoo_service.ResponseConfigJson{Json: proto.String(string(buf))}
return gpbrpc.Result(&result)
}
作者:bado
项目:thunde
func (GpbrpcType) OK(args ...interface{}) gpbrpc.ResultT {
if len(args) == 0 {
return okResult
}
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(0),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (s *StatsCtx) RequestStats(rctx gpbrpc.RequestT, request *badoo_service.RequestStats) gpbrpc.ResultT {
stats, err := GatherServiceStats()
if err != nil {
return badoo_service.Gpbrpc.ErrorGeneric(err.Error())
}
return gpbrpc.Result(stats)
}
作者:bado
项目:thunde
func (GpbrpcType) ErrorGeneric(args ...interface{}) gpbrpc.ResultT {
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_GENERIC)),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (GpbrpcType) ErrorStartChildFailed(args ...interface{}) gpbrpc.ResultT {
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_START_CHILD_FAILED)),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (GpbrpcType) ErrorWaitForFree(args ...interface{}) gpbrpc.ResultT {
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_WAIT_FOR_FREE)),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (GpbrpcType) ErrorFailedFinished(args ...interface{}) gpbrpc.ResultT {
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_FAILED_FINISHED)),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (GpbrpcType) ErrorAlreadyRunning(args ...interface{}) gpbrpc.ResultT {
return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_ALREADY_RUNNING)),
ErrorText: proto.String(fmt.Sprint(args...))})
}
作者:bado
项目:thunde
func (s *StatsCtx) RequestVersion(rctx gpbrpc.RequestT, request *badoo_service.RequestVersion) gpbrpc.ResultT {
return gpbrpc.Result(&VersionInfo)
}