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 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'CastInfoServiceClient'
......@@ -441,4 +451,6 @@ function ReadCastInfo_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return CastInfoServiceClient
......@@ -6,8 +6,17 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'MovieIdServiceClient'
......@@ -418,4 +427,6 @@ function RegisterMovieId_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return MovieIdServiceClient
......@@ -6,8 +6,19 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'MovieInfoServiceClient'
......@@ -739,4 +750,6 @@ function UpdateRating_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return MovieInfoServiceClient
......@@ -6,8 +6,18 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'MovieReviewServiceClient'
......@@ -444,4 +454,6 @@ function ReadMovieReviews_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return MovieReviewServiceClient
......@@ -6,8 +6,18 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'PageServiceClient'
......@@ -242,4 +252,7 @@ function ReadPage_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return PageServiceClient
......@@ -6,8 +6,17 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'PlotServiceClient'
......@@ -405,4 +414,6 @@ function ReadPlot_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return PlotServiceClient
......@@ -6,8 +6,17 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'TextServiceClient'
......@@ -216,4 +225,6 @@ function UploadText_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return TextServiceClient
......@@ -6,8 +6,17 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'UniqueIdServiceClient'
......@@ -203,4 +212,6 @@ function UploadUniqueId_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return UniqueIdServiceClient
......@@ -6,8 +6,18 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'UserReviewServiceClient'
......@@ -444,4 +454,6 @@ function ReadUserReviews_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return UserReviewServiceClient
......@@ -6,8 +6,17 @@
--
require 'Thrift'
require 'media_service_ttypes'
local Thrift = require 'Thrift'
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, {
__type = 'UserServiceClient'
......@@ -1024,4 +1033,6 @@ function UploadUserWithUsername_result:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return UserServiceClient
......@@ -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'
ErrorCode = {
......@@ -1004,4 +1007,7 @@ function ServiceException:write(oprot)
end
oprot:writeFieldStop()
oprot:writeStructEnd()
end
\ No newline at end of file
end
return {ErrorCode, User=User, Review=Review, CastInfo=CastInfo, Cast=Cast,
MovieInfo=MovieInfo, Page=Page, ServiceException=ServiceException}
......@@ -44,9 +44,9 @@ function _M.WriteCastInfo()
carrier["baggage"] = xtracer.BranchBaggage()
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)
xtracer.JoinBaggage(err.baggage)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage()
end
......
......@@ -58,12 +58,12 @@ function _M.WriteMovieInfo()
carrier["baggage"] = xtracer.BranchBaggage()
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"],
movie_info["photo_ids"], movie_info["video_ids"], tostring(movie_info["avg_rating"]),
movie_info["num_rating"], carrier)
ngx.say(movie_info["avg_rating"])
xtracer.JoinBaggag(err.baggage)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage()
......
......@@ -36,8 +36,8 @@ function _M.RegisterMovie()
carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(MovieIdServiceClient,"movie-id-service",9090)
local status, err = client:RegisterMovieId(req_id, post.title, tostring(post.movie_id), carrier)
xtracer.JoinBaggage(err.baggage)
local status = client:RegisterMovieId(req_id, post.title, tostring(post.movie_id), carrier)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client)
span:finish()
......
......@@ -42,8 +42,8 @@ function _M.WritePlot()
carrier["baggage"] = xtracer.BranchBaggage()
local client = GenericObjectPool:connection(PlotServiceClient, "plot-service", 9090)
local status, err = client:WritePlot(req_id, plot["plot_id"], plot["plot"], carrier)
xtracer.JoinBaggage(err.baggage)
local status = client:WritePlot(req_id, plot["plot_id"], plot["plot"], carrier)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client)
xtracer.DeleteBaggage()
end
......
......@@ -12,8 +12,9 @@ local function _UploadUserId(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage()
local user_client = GenericObjectPool:connection(
UserServiceClient,"user-service",9090)
local status, err = user_client:UploadUserWithUsername(req_id, post.username, carrier)
xtracer.JoinBaggage(err.baggage)
local status = user_client:UploadUserWithUsername(req_id, post.username, carrier)
print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(user_client)
end
......@@ -24,8 +25,9 @@ local function _UploadText(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage()
local text_client = GenericObjectPool:connection(
TextServiceClient,"text-service",9090)
local status, err = text_client:UploadText(req_id, post.text, carrier)
xtracer.JoinBaggage(err.baggage)
local status = text_client:UploadText(req_id, post.text, carrier)
print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(text_client)
end
......@@ -36,8 +38,9 @@ local function _UploadMovieId(req_id, post, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage()
local movie_id_client = GenericObjectPool:connection(
MovieIdServiceClient,"movie-id-service",9090)
local status, err = movie_id_client:UploadMovieId(req_id, post.title, tonumber(post.rating), carrier)
xtracer.JoinBaggage(err.baggage)
local status = movie_id_client:UploadMovieId(req_id, post.title, tonumber(post.rating), carrier)
print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(movie_id_client)
end
......@@ -48,8 +51,9 @@ local function _UploadUniqueId(req_id, carrier, baggage)
carrier["baggage"] = xtracer.BranchBaggage()
local unique_id_client = GenericObjectPool:connection(
UniqueIdServiceClient,"unique-id-service",9090)
status, err = unique_id_client:UploadUniqueId(req_id, carrier)
xtracer.JoinBaggage(err.baggage)
status = unique_id_client:UploadUniqueId(req_id, carrier)
print("Status is:", status)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(unique_id_client)
end
......@@ -106,9 +110,9 @@ function _M.ComposeReview()
end
end
span:finish()
xtrace.LogXTrace("Request processing finished")
xtracer.LogXTrace("Request processing finished")
ngx.exit(status)
xtrace.DeleteBaggage()
xtracer.DeleteBaggage()
end
......
......@@ -36,10 +36,10 @@ function _M.RegisterUser()
local client = GenericObjectPool:connection(UserServiceClient, "user-service", 9090)
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)
xtracer.JoinBaggage(err.baggage)
xtracer.JoinBaggage(status.baggage)
GenericObjectPool:returnConnection(client)
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