Example #1
0
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)
}
Example #2
0
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...))})
}
Example #3
0
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)
}
Example #4
0
func (GpbrpcType) ErrorGeneric(args ...interface{}) gpbrpc.ResultT {
	return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_GENERIC)),
		ErrorText: proto.String(fmt.Sprint(args...))})
}
Example #5
0
	switch RequestMsgid(rctx.MessageId) {
	case RequestMsgid_REQUEST_ADD_JOBS:
		r := rctx.Message.(*RequestAddJobs)
		return service.RequestAddJobs(rctx, r)
	case RequestMsgid_REQUEST_UPDATE_STATUS:
		r := rctx.Message.(*RequestUpdateStatus)
		return service.RequestUpdateStatus(rctx, r)
	case RequestMsgid_REQUEST_LOG_FINISH:
		r := rctx.Message.(*RequestLogFinish)
		return service.RequestLogFinish(rctx, r)
	default:
		panic("screw you")
	}
}

var okResult = gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(0)})

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...))})
}

func (GpbrpcType) ErrorGeneric(args ...interface{}) gpbrpc.ResultT {
	return gpbrpc.Result(&ResponseGeneric{ErrorCode: proto.Int32(-int32(Errno_ERRNO_GENERIC)),
		ErrorText: proto.String(fmt.Sprint(args...))})
}

/*
Example #6
0
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...))})
}
Example #7
0
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...))})
}
Example #8
0
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...))})
}
Example #9
0
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...))})
}
Example #10
0
func (s *StatsCtx) RequestVersion(rctx gpbrpc.RequestT, request *badoo_service.RequestVersion) gpbrpc.ResultT {
	return gpbrpc.Result(&VersionInfo)
}