Commit 4731a195 authored by Vaastav Anand's avatar Vaastav Anand

Fix generated lua files to work with context propagation

parent 32240055
...@@ -6,8 +6,18 @@ ...@@ -6,8 +6,18 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
local CastInfo = media_service_ttypes.CastInfo
CastInfoServiceClient = __TObject.new(__TClient, { CastInfoServiceClient = __TObject.new(__TClient, {
__type = 'CastInfoServiceClient' __type = 'CastInfoServiceClient'
...@@ -441,4 +451,6 @@ function ReadCastInfo_result:write(oprot) ...@@ -441,4 +451,6 @@ function ReadCastInfo_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return CastInfoServiceClient
...@@ -6,8 +6,17 @@ ...@@ -6,8 +6,17 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
MovieIdServiceClient = __TObject.new(__TClient, { MovieIdServiceClient = __TObject.new(__TClient, {
__type = 'MovieIdServiceClient' __type = 'MovieIdServiceClient'
...@@ -418,4 +427,6 @@ function RegisterMovieId_result:write(oprot) ...@@ -418,4 +427,6 @@ function RegisterMovieId_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return MovieIdServiceClient
...@@ -6,8 +6,19 @@ ...@@ -6,8 +6,19 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
local MovieInfo = media_service_ttypes.MovieInfo
local Cast = media_service_ttypes.Cast
MovieInfoServiceClient = __TObject.new(__TClient, { MovieInfoServiceClient = __TObject.new(__TClient, {
__type = 'MovieInfoServiceClient' __type = 'MovieInfoServiceClient'
...@@ -739,4 +750,6 @@ function UpdateRating_result:write(oprot) ...@@ -739,4 +750,6 @@ function UpdateRating_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return MovieInfoServiceClient
...@@ -6,8 +6,18 @@ ...@@ -6,8 +6,18 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
local Review = media_service_ttypes.Review
MovieReviewServiceClient = __TObject.new(__TClient, { MovieReviewServiceClient = __TObject.new(__TClient, {
__type = 'MovieReviewServiceClient' __type = 'MovieReviewServiceClient'
...@@ -444,4 +454,6 @@ function ReadMovieReviews_result:write(oprot) ...@@ -444,4 +454,6 @@ function ReadMovieReviews_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return MovieReviewServiceClient
...@@ -6,8 +6,18 @@ ...@@ -6,8 +6,18 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
local Page = media_service_ttypes.Page
PageServiceClient = __TObject.new(__TClient, { PageServiceClient = __TObject.new(__TClient, {
__type = 'PageServiceClient' __type = 'PageServiceClient'
...@@ -242,4 +252,7 @@ function ReadPage_result:write(oprot) ...@@ -242,4 +252,7 @@ function ReadPage_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return PageServiceClient
...@@ -6,8 +6,17 @@ ...@@ -6,8 +6,17 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
PlotServiceClient = __TObject.new(__TClient, { PlotServiceClient = __TObject.new(__TClient, {
__type = 'PlotServiceClient' __type = 'PlotServiceClient'
...@@ -405,4 +414,6 @@ function ReadPlot_result:write(oprot) ...@@ -405,4 +414,6 @@ function ReadPlot_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return PlotServiceClient
...@@ -6,8 +6,17 @@ ...@@ -6,8 +6,17 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
TextServiceClient = __TObject.new(__TClient, { TextServiceClient = __TObject.new(__TClient, {
__type = 'TextServiceClient' __type = 'TextServiceClient'
...@@ -216,4 +225,6 @@ function UploadText_result:write(oprot) ...@@ -216,4 +225,6 @@ function UploadText_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return TextServiceClient
...@@ -6,8 +6,17 @@ ...@@ -6,8 +6,17 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
UniqueIdServiceClient = __TObject.new(__TClient, { UniqueIdServiceClient = __TObject.new(__TClient, {
__type = 'UniqueIdServiceClient' __type = 'UniqueIdServiceClient'
...@@ -203,4 +212,6 @@ function UploadUniqueId_result:write(oprot) ...@@ -203,4 +212,6 @@ function UploadUniqueId_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return UniqueIdServiceClient
...@@ -6,8 +6,18 @@ ...@@ -6,8 +6,18 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
local Review = media_service_ttypes.Review
UserReviewServiceClient = __TObject.new(__TClient, { UserReviewServiceClient = __TObject.new(__TClient, {
__type = 'UserReviewServiceClient' __type = 'UserReviewServiceClient'
...@@ -444,4 +454,6 @@ function ReadUserReviews_result:write(oprot) ...@@ -444,4 +454,6 @@ function ReadUserReviews_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return UserReviewServiceClient
...@@ -6,8 +6,17 @@ ...@@ -6,8 +6,17 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
require 'media_service_ttypes' local TType = Thrift.TType
local TMessageType = Thrift.TMessageType
local __TObject = Thrift.__TObject
local TApplicationException = Thrift.TApplicationException
local __TClient = Thrift.__TClient
local __TProcessor = Thrift.__TProcessor
local ttype = Thrift.ttype
local ttable_size = Thrift.ttable_size
local media_service_ttypes = require 'media_service_ttypes'
local ServiceException = media_service_ttypes.ServiceException
UserServiceClient = __TObject.new(__TClient, { UserServiceClient = __TObject.new(__TClient, {
__type = 'UserServiceClient' __type = 'UserServiceClient'
...@@ -1024,4 +1033,6 @@ function UploadUserWithUsername_result:write(oprot) ...@@ -1024,4 +1033,6 @@ function UploadUserWithUsername_result:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return UserServiceClient
...@@ -6,7 +6,10 @@ ...@@ -6,7 +6,10 @@
-- --
require 'Thrift' local Thrift = require 'Thrift'
local TType = Thrift.TType
local __TObject = Thrift.__TObject
local TException = Thrift.TException
require 'media_service_constants' require 'media_service_constants'
ErrorCode = { ErrorCode = {
...@@ -1004,4 +1007,7 @@ function ServiceException:write(oprot) ...@@ -1004,4 +1007,7 @@ function ServiceException:write(oprot)
end end
oprot:writeFieldStop() oprot:writeFieldStop()
oprot:writeStructEnd() oprot:writeStructEnd()
end end
\ No newline at end of file
return {ErrorCode, User=User, Review=Review, CastInfo=CastInfo, Cast=Cast,
MovieInfo=MovieInfo, Page=Page, ServiceException=ServiceException}
...@@ -44,9 +44,9 @@ function _M.WriteCastInfo() ...@@ -44,9 +44,9 @@ function _M.WriteCastInfo()
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(CastInfoServiceClient, "cast-info-service", 9090) local client = GenericObjectPool:connection(CastInfoServiceClient, "cast-info-service", 9090)
local status, err = client:WriteCastInfo(req_id, cast_info["cast_info_id"], cast_info["name"], local status = client:WriteCastInfo(req_id, cast_info["cast_info_id"], cast_info["name"],
cast_info["gender"], cast_info["intro"], carrier) cast_info["gender"], cast_info["intro"], carrier)
xtracer.JoinBaggage(err.baggage) xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client) GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage() xtracer.DeleteBaggage()
end end
......
...@@ -58,12 +58,12 @@ function _M.WriteMovieInfo() ...@@ -58,12 +58,12 @@ function _M.WriteMovieInfo()
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(MovieInfoServiceClient, "movie-info-service", 9090) local client = GenericObjectPool:connection(MovieInfoServiceClient, "movie-info-service", 9090)
local status, err = client:WriteMovieInfo(req_id, movie_info["movie_id"], movie_info["title"], local status = client:WriteMovieInfo(req_id, movie_info["movie_id"], movie_info["title"],
casts, movie_info["plot_id"], movie_info["thumbnail_ids"], casts, movie_info["plot_id"], movie_info["thumbnail_ids"],
movie_info["photo_ids"], movie_info["video_ids"], tostring(movie_info["avg_rating"]), movie_info["photo_ids"], movie_info["video_ids"], tostring(movie_info["avg_rating"]),
movie_info["num_rating"], carrier) movie_info["num_rating"], carrier)
ngx.say(movie_info["avg_rating"]) ngx.say(movie_info["avg_rating"])
xtracer.JoinBaggag(err.baggage) xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client) GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage() xtracer.DeleteBaggage()
......
...@@ -36,8 +36,8 @@ function _M.RegisterMovie() ...@@ -36,8 +36,8 @@ function _M.RegisterMovie()
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(MovieIdServiceClient,"movie-id-service",9090) local client = GenericObjectPool:connection(MovieIdServiceClient,"movie-id-service",9090)
local status, err = client:RegisterMovieId(req_id, post.title, tostring(post.movie_id), carrier) local status = client:RegisterMovieId(req_id, post.title, tostring(post.movie_id), carrier)
xtracer.JoinBaggage(err.baggage) xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client) GenericObjectPool:returnConnection(client)
span:finish() span:finish()
......
...@@ -42,8 +42,8 @@ function _M.WritePlot() ...@@ -42,8 +42,8 @@ function _M.WritePlot()
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(PlotServiceClient, "plot-service", 9090) local client = GenericObjectPool:connection(PlotServiceClient, "plot-service", 9090)
local status, err = client:WritePlot(req_id, plot["plot_id"], plot["plot"], carrier) local status = client:WritePlot(req_id, plot["plot_id"], plot["plot"], carrier)
xtracer.JoinBaggage(err.baggage) xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client) GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage() xtracer.DeleteBaggage()
end end
......
...@@ -12,8 +12,9 @@ local function _UploadUserId(req_id, post, carrier, baggage) ...@@ -12,8 +12,9 @@ local function _UploadUserId(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local user_client = GenericObjectPool:connection( local user_client = GenericObjectPool:connection(
UserServiceClient,"user-service",9090) UserServiceClient,"user-service",9090)
local status, err = user_client:UploadUserWithUsername(req_id, post.username, carrier) local status = user_client:UploadUserWithUsername(req_id, post.username, carrier)
xtracer.JoinBaggage(err.baggage) print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(user_client) GenericObjectPool:returnConnection(user_client)
end end
...@@ -24,8 +25,9 @@ local function _UploadText(req_id, post, carrier, baggage) ...@@ -24,8 +25,9 @@ local function _UploadText(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local text_client = GenericObjectPool:connection( local text_client = GenericObjectPool:connection(
TextServiceClient,"text-service",9090) TextServiceClient,"text-service",9090)
local status, err = text_client:UploadText(req_id, post.text, carrier) local status = text_client:UploadText(req_id, post.text, carrier)
xtracer.JoinBaggage(err.baggage) print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(text_client) GenericObjectPool:returnConnection(text_client)
end end
...@@ -36,8 +38,9 @@ local function _UploadMovieId(req_id, post, carrier, baggage) ...@@ -36,8 +38,9 @@ local function _UploadMovieId(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local movie_id_client = GenericObjectPool:connection( local movie_id_client = GenericObjectPool:connection(
MovieIdServiceClient,"movie-id-service",9090) MovieIdServiceClient,"movie-id-service",9090)
local status, err = movie_id_client:UploadMovieId(req_id, post.title, tonumber(post.rating), carrier) local status = movie_id_client:UploadMovieId(req_id, post.title, tonumber(post.rating), carrier)
xtracer.JoinBaggage(err.baggage) print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(movie_id_client) GenericObjectPool:returnConnection(movie_id_client)
end end
...@@ -48,8 +51,9 @@ local function _UploadUniqueId(req_id, carrier, baggage) ...@@ -48,8 +51,9 @@ local function _UploadUniqueId(req_id, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local unique_id_client = GenericObjectPool:connection( local unique_id_client = GenericObjectPool:connection(
UniqueIdServiceClient,"unique-id-service",9090) UniqueIdServiceClient,"unique-id-service",9090)
status, err = unique_id_client:UploadUniqueId(req_id, carrier) status = unique_id_client:UploadUniqueId(req_id, carrier)
xtracer.JoinBaggage(err.baggage) print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(unique_id_client) GenericObjectPool:returnConnection(unique_id_client)
end end
...@@ -106,9 +110,9 @@ function _M.ComposeReview() ...@@ -106,9 +110,9 @@ function _M.ComposeReview()
end end
end end
span:finish() span:finish()
xtrace.LogXTrace("Request processing finished") xtracer.LogXTrace("Request processing finished")
ngx.exit(status) ngx.exit(status)
xtrace.DeleteBaggage() xtracer.DeleteBaggage()
end end
......
...@@ -36,10 +36,10 @@ function _M.RegisterUser() ...@@ -36,10 +36,10 @@ function _M.RegisterUser()
local client = GenericObjectPool:connection(UserServiceClient, "user-service", 9090) local client = GenericObjectPool:connection(UserServiceClient, "user-service", 9090)
carrier["baggage"] = xtracer.BranchBaggage() carrier["baggage"] = xtracer.BranchBaggage()
local status, err = client:RegisterUser(req_id, post.first_name, post.last_name, local status = client:RegisterUser(req_id, post.first_name, post.last_name,
post.username, post.password, carrier) post.username, post.password, carrier)
xtracer.JoinBaggage(err.baggage) xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client) GenericObjectPool:returnConnection(client)
span:finish() span:finish()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment