Merge pull request #25 from ahmetb/frontend-ads

frontend: add integration for adservice
This commit is contained in:
Ahmet Alp Balkan 2018-08-17 09:10:50 -07:00 committed by GitHub
commit 3c86418822
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 374 additions and 121 deletions

View file

@ -56,6 +56,8 @@ spec:
value: "shippingservice:50051"
- name: CHECKOUT_SERVICE_ADDR
value: "checkoutservice:5050"
- name: AD_SERVICE_ADDR
value: "adservice:9555"
resources:
requests:
cpu: 100m

View file

@ -35,7 +35,7 @@ func (m *CartItem) Reset() { *m = CartItem{} }
func (m *CartItem) String() string { return proto.CompactTextString(m) }
func (*CartItem) ProtoMessage() {}
func (*CartItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{0}
return fileDescriptor_demo_c812a73334c7ff0d, []int{0}
}
func (m *CartItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CartItem.Unmarshal(m, b)
@ -81,7 +81,7 @@ func (m *AddItemRequest) Reset() { *m = AddItemRequest{} }
func (m *AddItemRequest) String() string { return proto.CompactTextString(m) }
func (*AddItemRequest) ProtoMessage() {}
func (*AddItemRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{1}
return fileDescriptor_demo_c812a73334c7ff0d, []int{1}
}
func (m *AddItemRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AddItemRequest.Unmarshal(m, b)
@ -126,7 +126,7 @@ func (m *EmptyCartRequest) Reset() { *m = EmptyCartRequest{} }
func (m *EmptyCartRequest) String() string { return proto.CompactTextString(m) }
func (*EmptyCartRequest) ProtoMessage() {}
func (*EmptyCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{2}
return fileDescriptor_demo_c812a73334c7ff0d, []int{2}
}
func (m *EmptyCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_EmptyCartRequest.Unmarshal(m, b)
@ -164,7 +164,7 @@ func (m *GetCartRequest) Reset() { *m = GetCartRequest{} }
func (m *GetCartRequest) String() string { return proto.CompactTextString(m) }
func (*GetCartRequest) ProtoMessage() {}
func (*GetCartRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{3}
return fileDescriptor_demo_c812a73334c7ff0d, []int{3}
}
func (m *GetCartRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetCartRequest.Unmarshal(m, b)
@ -203,7 +203,7 @@ func (m *Cart) Reset() { *m = Cart{} }
func (m *Cart) String() string { return proto.CompactTextString(m) }
func (*Cart) ProtoMessage() {}
func (*Cart) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{4}
return fileDescriptor_demo_c812a73334c7ff0d, []int{4}
}
func (m *Cart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Cart.Unmarshal(m, b)
@ -247,7 +247,7 @@ func (m *Empty) Reset() { *m = Empty{} }
func (m *Empty) String() string { return proto.CompactTextString(m) }
func (*Empty) ProtoMessage() {}
func (*Empty) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{5}
return fileDescriptor_demo_c812a73334c7ff0d, []int{5}
}
func (m *Empty) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Empty.Unmarshal(m, b)
@ -279,7 +279,7 @@ func (m *ListRecommendationsRequest) Reset() { *m = ListRecommendationsR
func (m *ListRecommendationsRequest) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsRequest) ProtoMessage() {}
func (*ListRecommendationsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{6}
return fileDescriptor_demo_c812a73334c7ff0d, []int{6}
}
func (m *ListRecommendationsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsRequest.Unmarshal(m, b)
@ -324,7 +324,7 @@ func (m *ListRecommendationsResponse) Reset() { *m = ListRecommendations
func (m *ListRecommendationsResponse) String() string { return proto.CompactTextString(m) }
func (*ListRecommendationsResponse) ProtoMessage() {}
func (*ListRecommendationsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{7}
return fileDescriptor_demo_c812a73334c7ff0d, []int{7}
}
func (m *ListRecommendationsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListRecommendationsResponse.Unmarshal(m, b)
@ -366,7 +366,7 @@ func (m *Product) Reset() { *m = Product{} }
func (m *Product) String() string { return proto.CompactTextString(m) }
func (*Product) ProtoMessage() {}
func (*Product) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{8}
return fileDescriptor_demo_c812a73334c7ff0d, []int{8}
}
func (m *Product) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Product.Unmarshal(m, b)
@ -432,7 +432,7 @@ func (m *ListProductsResponse) Reset() { *m = ListProductsResponse{} }
func (m *ListProductsResponse) String() string { return proto.CompactTextString(m) }
func (*ListProductsResponse) ProtoMessage() {}
func (*ListProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{9}
return fileDescriptor_demo_c812a73334c7ff0d, []int{9}
}
func (m *ListProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ListProductsResponse.Unmarshal(m, b)
@ -470,7 +470,7 @@ func (m *GetProductRequest) Reset() { *m = GetProductRequest{} }
func (m *GetProductRequest) String() string { return proto.CompactTextString(m) }
func (*GetProductRequest) ProtoMessage() {}
func (*GetProductRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{10}
return fileDescriptor_demo_c812a73334c7ff0d, []int{10}
}
func (m *GetProductRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetProductRequest.Unmarshal(m, b)
@ -508,7 +508,7 @@ func (m *SearchProductsRequest) Reset() { *m = SearchProductsRequest{} }
func (m *SearchProductsRequest) String() string { return proto.CompactTextString(m) }
func (*SearchProductsRequest) ProtoMessage() {}
func (*SearchProductsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{11}
return fileDescriptor_demo_c812a73334c7ff0d, []int{11}
}
func (m *SearchProductsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsRequest.Unmarshal(m, b)
@ -546,7 +546,7 @@ func (m *SearchProductsResponse) Reset() { *m = SearchProductsResponse{}
func (m *SearchProductsResponse) String() string { return proto.CompactTextString(m) }
func (*SearchProductsResponse) ProtoMessage() {}
func (*SearchProductsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{12}
return fileDescriptor_demo_c812a73334c7ff0d, []int{12}
}
func (m *SearchProductsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SearchProductsResponse.Unmarshal(m, b)
@ -585,7 +585,7 @@ func (m *GetQuoteRequest) Reset() { *m = GetQuoteRequest{} }
func (m *GetQuoteRequest) String() string { return proto.CompactTextString(m) }
func (*GetQuoteRequest) ProtoMessage() {}
func (*GetQuoteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{13}
return fileDescriptor_demo_c812a73334c7ff0d, []int{13}
}
func (m *GetQuoteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteRequest.Unmarshal(m, b)
@ -630,7 +630,7 @@ func (m *GetQuoteResponse) Reset() { *m = GetQuoteResponse{} }
func (m *GetQuoteResponse) String() string { return proto.CompactTextString(m) }
func (*GetQuoteResponse) ProtoMessage() {}
func (*GetQuoteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{14}
return fileDescriptor_demo_c812a73334c7ff0d, []int{14}
}
func (m *GetQuoteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetQuoteResponse.Unmarshal(m, b)
@ -669,7 +669,7 @@ func (m *ShipOrderRequest) Reset() { *m = ShipOrderRequest{} }
func (m *ShipOrderRequest) String() string { return proto.CompactTextString(m) }
func (*ShipOrderRequest) ProtoMessage() {}
func (*ShipOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{15}
return fileDescriptor_demo_c812a73334c7ff0d, []int{15}
}
func (m *ShipOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderRequest.Unmarshal(m, b)
@ -714,7 +714,7 @@ func (m *ShipOrderResponse) Reset() { *m = ShipOrderResponse{} }
func (m *ShipOrderResponse) String() string { return proto.CompactTextString(m) }
func (*ShipOrderResponse) ProtoMessage() {}
func (*ShipOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{16}
return fileDescriptor_demo_c812a73334c7ff0d, []int{16}
}
func (m *ShipOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ShipOrderResponse.Unmarshal(m, b)
@ -756,7 +756,7 @@ func (m *Address) Reset() { *m = Address{} }
func (m *Address) String() string { return proto.CompactTextString(m) }
func (*Address) ProtoMessage() {}
func (*Address) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{17}
return fileDescriptor_demo_c812a73334c7ff0d, []int{17}
}
func (m *Address) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Address.Unmarshal(m, b)
@ -834,7 +834,7 @@ func (m *Money) Reset() { *m = Money{} }
func (m *Money) String() string { return proto.CompactTextString(m) }
func (*Money) ProtoMessage() {}
func (*Money) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{18}
return fileDescriptor_demo_c812a73334c7ff0d, []int{18}
}
func (m *Money) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Money.Unmarshal(m, b)
@ -887,7 +887,7 @@ func (m *GetSupportedCurrenciesResponse) Reset() { *m = GetSupportedCurr
func (m *GetSupportedCurrenciesResponse) String() string { return proto.CompactTextString(m) }
func (*GetSupportedCurrenciesResponse) ProtoMessage() {}
func (*GetSupportedCurrenciesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{19}
return fileDescriptor_demo_c812a73334c7ff0d, []int{19}
}
func (m *GetSupportedCurrenciesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSupportedCurrenciesResponse.Unmarshal(m, b)
@ -927,7 +927,7 @@ func (m *CurrencyConversionRequest) Reset() { *m = CurrencyConversionReq
func (m *CurrencyConversionRequest) String() string { return proto.CompactTextString(m) }
func (*CurrencyConversionRequest) ProtoMessage() {}
func (*CurrencyConversionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{20}
return fileDescriptor_demo_c812a73334c7ff0d, []int{20}
}
func (m *CurrencyConversionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CurrencyConversionRequest.Unmarshal(m, b)
@ -975,7 +975,7 @@ func (m *CreditCardInfo) Reset() { *m = CreditCardInfo{} }
func (m *CreditCardInfo) String() string { return proto.CompactTextString(m) }
func (*CreditCardInfo) ProtoMessage() {}
func (*CreditCardInfo) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{21}
return fileDescriptor_demo_c812a73334c7ff0d, []int{21}
}
func (m *CreditCardInfo) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CreditCardInfo.Unmarshal(m, b)
@ -1035,7 +1035,7 @@ func (m *ChargeRequest) Reset() { *m = ChargeRequest{} }
func (m *ChargeRequest) String() string { return proto.CompactTextString(m) }
func (*ChargeRequest) ProtoMessage() {}
func (*ChargeRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{22}
return fileDescriptor_demo_c812a73334c7ff0d, []int{22}
}
func (m *ChargeRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeRequest.Unmarshal(m, b)
@ -1080,7 +1080,7 @@ func (m *ChargeResponse) Reset() { *m = ChargeResponse{} }
func (m *ChargeResponse) String() string { return proto.CompactTextString(m) }
func (*ChargeResponse) ProtoMessage() {}
func (*ChargeResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{23}
return fileDescriptor_demo_c812a73334c7ff0d, []int{23}
}
func (m *ChargeResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ChargeResponse.Unmarshal(m, b)
@ -1119,7 +1119,7 @@ func (m *OrderItem) Reset() { *m = OrderItem{} }
func (m *OrderItem) String() string { return proto.CompactTextString(m) }
func (*OrderItem) ProtoMessage() {}
func (*OrderItem) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{24}
return fileDescriptor_demo_c812a73334c7ff0d, []int{24}
}
func (m *OrderItem) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderItem.Unmarshal(m, b)
@ -1168,7 +1168,7 @@ func (m *OrderResult) Reset() { *m = OrderResult{} }
func (m *OrderResult) String() string { return proto.CompactTextString(m) }
func (*OrderResult) ProtoMessage() {}
func (*OrderResult) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{25}
return fileDescriptor_demo_c812a73334c7ff0d, []int{25}
}
func (m *OrderResult) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OrderResult.Unmarshal(m, b)
@ -1235,7 +1235,7 @@ func (m *SendOrderConfirmationRequest) Reset() { *m = SendOrderConfirmat
func (m *SendOrderConfirmationRequest) String() string { return proto.CompactTextString(m) }
func (*SendOrderConfirmationRequest) ProtoMessage() {}
func (*SendOrderConfirmationRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{26}
return fileDescriptor_demo_c812a73334c7ff0d, []int{26}
}
func (m *SendOrderConfirmationRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SendOrderConfirmationRequest.Unmarshal(m, b)
@ -1284,7 +1284,7 @@ func (m *PlaceOrderRequest) Reset() { *m = PlaceOrderRequest{} }
func (m *PlaceOrderRequest) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderRequest) ProtoMessage() {}
func (*PlaceOrderRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{27}
return fileDescriptor_demo_c812a73334c7ff0d, []int{27}
}
func (m *PlaceOrderRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderRequest.Unmarshal(m, b)
@ -1350,7 +1350,7 @@ func (m *PlaceOrderResponse) Reset() { *m = PlaceOrderResponse{} }
func (m *PlaceOrderResponse) String() string { return proto.CompactTextString(m) }
func (*PlaceOrderResponse) ProtoMessage() {}
func (*PlaceOrderResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_e1d03823e14b5fb0, []int{28}
return fileDescriptor_demo_c812a73334c7ff0d, []int{28}
}
func (m *PlaceOrderResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_PlaceOrderResponse.Unmarshal(m, b)
@ -1377,6 +1377,131 @@ func (m *PlaceOrderResponse) GetOrder() *OrderResult {
return nil
}
type AdsRequest struct {
// List of important key words from the current page describing the context.
ContextKeys []string `protobuf:"bytes,1,rep,name=context_keys,json=contextKeys" json:"context_keys,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AdsRequest) Reset() { *m = AdsRequest{} }
func (m *AdsRequest) String() string { return proto.CompactTextString(m) }
func (*AdsRequest) ProtoMessage() {}
func (*AdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_c812a73334c7ff0d, []int{29}
}
func (m *AdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AdsRequest.Unmarshal(m, b)
}
func (m *AdsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AdsRequest.Marshal(b, m, deterministic)
}
func (dst *AdsRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_AdsRequest.Merge(dst, src)
}
func (m *AdsRequest) XXX_Size() int {
return xxx_messageInfo_AdsRequest.Size(m)
}
func (m *AdsRequest) XXX_DiscardUnknown() {
xxx_messageInfo_AdsRequest.DiscardUnknown(m)
}
var xxx_messageInfo_AdsRequest proto.InternalMessageInfo
func (m *AdsRequest) GetContextKeys() []string {
if m != nil {
return m.ContextKeys
}
return nil
}
type AdsResponse struct {
Ads []*Ad `protobuf:"bytes,1,rep,name=ads" json:"ads,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *AdsResponse) Reset() { *m = AdsResponse{} }
func (m *AdsResponse) String() string { return proto.CompactTextString(m) }
func (*AdsResponse) ProtoMessage() {}
func (*AdsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_c812a73334c7ff0d, []int{30}
}
func (m *AdsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_AdsResponse.Unmarshal(m, b)
}
func (m *AdsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_AdsResponse.Marshal(b, m, deterministic)
}
func (dst *AdsResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_AdsResponse.Merge(dst, src)
}
func (m *AdsResponse) XXX_Size() int {
return xxx_messageInfo_AdsResponse.Size(m)
}
func (m *AdsResponse) XXX_DiscardUnknown() {
xxx_messageInfo_AdsResponse.DiscardUnknown(m)
}
var xxx_messageInfo_AdsResponse proto.InternalMessageInfo
func (m *AdsResponse) GetAds() []*Ad {
if m != nil {
return m.Ads
}
return nil
}
type Ad struct {
// url to redirect to when an ad is clicked.
RedirectUrl string `protobuf:"bytes,1,opt,name=redirect_url,json=redirectUrl" json:"redirect_url,omitempty"`
// short advertisement text to display.
Text string `protobuf:"bytes,2,opt,name=text" json:"text,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Ad) Reset() { *m = Ad{} }
func (m *Ad) String() string { return proto.CompactTextString(m) }
func (*Ad) ProtoMessage() {}
func (*Ad) Descriptor() ([]byte, []int) {
return fileDescriptor_demo_c812a73334c7ff0d, []int{31}
}
func (m *Ad) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Ad.Unmarshal(m, b)
}
func (m *Ad) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Ad.Marshal(b, m, deterministic)
}
func (dst *Ad) XXX_Merge(src proto.Message) {
xxx_messageInfo_Ad.Merge(dst, src)
}
func (m *Ad) XXX_Size() int {
return xxx_messageInfo_Ad.Size(m)
}
func (m *Ad) XXX_DiscardUnknown() {
xxx_messageInfo_Ad.DiscardUnknown(m)
}
var xxx_messageInfo_Ad proto.InternalMessageInfo
func (m *Ad) GetRedirectUrl() string {
if m != nil {
return m.RedirectUrl
}
return ""
}
func (m *Ad) GetText() string {
if m != nil {
return m.Text
}
return ""
}
func init() {
proto.RegisterType((*CartItem)(nil), "hipstershop.CartItem")
proto.RegisterType((*AddItemRequest)(nil), "hipstershop.AddItemRequest")
@ -1407,6 +1532,9 @@ func init() {
proto.RegisterType((*SendOrderConfirmationRequest)(nil), "hipstershop.SendOrderConfirmationRequest")
proto.RegisterType((*PlaceOrderRequest)(nil), "hipstershop.PlaceOrderRequest")
proto.RegisterType((*PlaceOrderResponse)(nil), "hipstershop.PlaceOrderResponse")
proto.RegisterType((*AdsRequest)(nil), "hipstershop.AdsRequest")
proto.RegisterType((*AdsResponse)(nil), "hipstershop.AdsResponse")
proto.RegisterType((*Ad)(nil), "hipstershop.Ad")
}
// Reference imports to suppress errors if they are not otherwise used.
@ -2127,95 +2255,165 @@ var _CheckoutService_serviceDesc = grpc.ServiceDesc{
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_e1d03823e14b5fb0) }
var fileDescriptor_demo_e1d03823e14b5fb0 = []byte{
// 1389 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x72, 0xd3, 0xc6,
0x17, 0x8f, 0x12, 0x3b, 0xb6, 0x8f, 0x63, 0x27, 0xd9, 0x7f, 0xc2, 0xdf, 0x28, 0x7c, 0xa4, 0x9b,
0x81, 0x42, 0x81, 0x94, 0x49, 0x3b, 0xc3, 0x45, 0x69, 0x29, 0x63, 0x32, 0xc6, 0x33, 0x50, 0xa8,
0x02, 0x1d, 0x3a, 0x74, 0xea, 0x11, 0xda, 0x05, 0xab, 0x44, 0x5a, 0xb1, 0xbb, 0xca, 0xd4, 0x5c,
0xb6, 0x0f, 0xd0, 0xfb, 0x3e, 0x42, 0x5f, 0xa0, 0xef, 0xd0, 0xfb, 0xbe, 0x42, 0x9f, 0xa3, 0xb3,
0x2b, 0xad, 0xbe, 0x62, 0x25, 0xe1, 0xa6, 0x77, 0xda, 0xb3, 0xbf, 0x3d, 0xe7, 0x77, 0xce, 0x9e,
0x73, 0xf6, 0x08, 0x80, 0xd0, 0x80, 0xed, 0x46, 0x9c, 0x49, 0x86, 0xba, 0x53, 0x3f, 0x12, 0x92,
0x72, 0x31, 0x65, 0x11, 0xde, 0x87, 0xf6, 0xd0, 0xe5, 0x72, 0x2c, 0x69, 0x80, 0x2e, 0x02, 0x44,
0x9c, 0x91, 0xd8, 0x93, 0x13, 0x9f, 0x0c, 0xac, 0x6d, 0xeb, 0x5a, 0xc7, 0xe9, 0xa4, 0x92, 0x31,
0x41, 0x36, 0xb4, 0xdf, 0xc5, 0x6e, 0x28, 0x7d, 0x39, 0x1b, 0x2c, 0x6e, 0x5b, 0xd7, 0x9a, 0x4e,
0xb6, 0xc6, 0xcf, 0xa0, 0x7f, 0x9f, 0x10, 0xa5, 0xc5, 0xa1, 0xef, 0x62, 0x2a, 0x24, 0xfa, 0x3f,
0xb4, 0x62, 0x41, 0x79, 0xae, 0x69,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 0x38, 0xec, 0x39, 0xed, 0x1b, 0x2f, 0xec, 0x3d, 0x87, 0xfe,
0x53, 0x77, 0x16, 0xd0, 0x30, 0xab, 0xe0, 0x21, 0x2c, 0x27, 0x6f, 0x1e, 0xb2, 0xcb, 0x9a, 0x8b,
0x6f, 0xb0, 0xbd, 0x35, 0x77, 0x2f, 0x0b, 0xc8, 0x14, 0x56, 0xf6, 0x55, 0x8f, 0x32, 0x4a, 0x5f,
0xa8, 0x5f, 0x82, 0x39, 0xad, 0x1a, 0x5d, 0xaf, 0x64, 0x43, 0x7d, 0x3b, 0xaf, 0xa9, 0xd9, 0x57,
0xb0, 0x3a, 0x9c, 0x52, 0xef, 0x2d, 0x8b, 0x33, 0x0f, 0x9e, 0x00, 0xe4, 0x9d, 0xad, 0x92, 0xdd,
0xc7, 0x3a, 0xb9, 0x7d, 0xb9, 0x76, 0xdf, 0x78, 0xf3, 0x6a, 0x59, 0xff, 0xd4, 0x7f, 0xf6, 0x6f,
0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0xab, 0x01, 0x43, 0xe2, 0x0f, 0x00, 0x00,
// AdsServiceClient is the client API for AdsService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type AdsServiceClient interface {
GetAds(ctx context.Context, in *AdsRequest, opts ...grpc.CallOption) (*AdsResponse, error)
}
type adsServiceClient struct {
cc *grpc.ClientConn
}
func NewAdsServiceClient(cc *grpc.ClientConn) AdsServiceClient {
return &adsServiceClient{cc}
}
func (c *adsServiceClient) GetAds(ctx context.Context, in *AdsRequest, opts ...grpc.CallOption) (*AdsResponse, error) {
out := new(AdsResponse)
err := c.cc.Invoke(ctx, "/hipstershop.AdsService/GetAds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AdsServiceServer is the server API for AdsService service.
type AdsServiceServer interface {
GetAds(context.Context, *AdsRequest) (*AdsResponse, error)
}
func RegisterAdsServiceServer(s *grpc.Server, srv AdsServiceServer) {
s.RegisterService(&_AdsService_serviceDesc, srv)
}
func _AdsService_GetAds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AdsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AdsServiceServer).GetAds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/hipstershop.AdsService/GetAds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AdsServiceServer).GetAds(ctx, req.(*AdsRequest))
}
return interceptor(ctx, in, info, handler)
}
var _AdsService_serviceDesc = grpc.ServiceDesc{
ServiceName: "hipstershop.AdsService",
HandlerType: (*AdsServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetAds",
Handler: _AdsService_GetAds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "demo.proto",
}
func init() { proto.RegisterFile("demo.proto", fileDescriptor_demo_c812a73334c7ff0d) }
var fileDescriptor_demo_c812a73334c7ff0d = []byte{
// 1484 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xdd, 0x72, 0x13, 0xb7,
0x17, 0xcf, 0x26, 0x71, 0x1c, 0x1f, 0xc7, 0x76, 0xa2, 0x7f, 0x02, 0x66, 0xc3, 0x47, 0x50, 0x06,
0xfe, 0x50, 0x20, 0x30, 0x69, 0x67, 0xb8, 0x00, 0x4a, 0x33, 0x26, 0x63, 0x3c, 0x40, 0xa1, 0x1b,
0xe8, 0xd0, 0xa1, 0x53, 0xcf, 0xb2, 0x12, 0x78, 0x4b, 0x76, 0xb5, 0x48, 0xda, 0x0c, 0xe6, 0xb2,
0x7d, 0x80, 0xde, 0xf7, 0x11, 0xfa, 0x02, 0x7d, 0x87, 0xde, 0xf7, 0x15, 0xfa, 0x1c, 0x1d, 0x69,
0x57, 0xfb, 0x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 0x70, 0x0f,
0x96, 0x92, 0x9e, 0x8c, 0xec, 0xb2, 0xe4, 0xe2, 0x8c, 0x60, 0x6f, 0x4e, 0x3d, 0xcb, 0x1c, 0x32,
0x82, 0x95, 0x7d, 0x55, 0x43, 0x8d, 0xd0, 0x97, 0xea, 0x27, 0xcb, 0x94, 0x56, 0x82, 0xae, 0x56,
0xa2, 0x61, 0x76, 0xbb, 0x99, 0x91, 0xb3, 0xaf, 0xa1, 0xd3, 0x1b, 0x51, 0xef, 0x1d, 0x8b, 0x33,
0x0b, 0x9e, 0x02, 0xe4, 0x95, 0xb7, 0x12, 0xdd, 0x13, 0x9d, 0xc6, 0xbe, 0x30, 0xf3, 0x3c, 0xb3,
0xe6, 0x91, 0x2e, 0xc2, 0x46, 0xfc, 0x3d, 0x58, 0xea, 0xab, 0x31, 0x5c, 0xa0, 0xd3, 0x95, 0x0a,
0x97, 0xc5, 0x78, 0x77, 0xf2, 0xc0, 0x08, 0x7b, 0xbd, 0xa4, 0xff, 0xc1, 0xf8, 0xf2, 0xdf, 0x00,
0x00, 0x00, 0xff, 0xff, 0x0d, 0x93, 0x0f, 0x58, 0xcf, 0x10, 0x00, 0x00,
}

View file

@ -15,8 +15,10 @@
package main
import (
"context"
"fmt"
"html/template"
"math/rand"
"net/http"
"os"
"strconv"
@ -78,6 +80,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
"products": ps,
"cart_size": len(cart),
"banner_color": os.Getenv("BANNER_COLOR"), // illustrates canary deployments
"ad": fe.chooseAd(r.Context(), log),
}); err != nil {
log.Error(err)
}
@ -130,6 +133,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
if err := templates.ExecuteTemplate(w, "product", map[string]interface{}{
"session_id": sessionID(r),
"request_id": r.Context().Value(ctxKeyRequestID{}),
"ad": fe.chooseAd(r.Context(), log),
"user_currency": currentCurrency(r),
"currencies": currencies,
"product": product,
@ -340,6 +344,17 @@ func (fe *frontendServer) setCurrencyHandler(w http.ResponseWriter, r *http.Requ
w.WriteHeader(http.StatusFound)
}
// chooseAd queries for advertisements available and randomly chooses one, if
// available. It ignores the error retrieving the ad since it is not critical.
func (fe *frontendServer) chooseAd(ctx context.Context, log logrus.FieldLogger) *pb.Ad {
ads, err := fe.getAd(ctx)
if err != nil {
log.WithField("error", err).Warn("failed to retrieve ads")
return nil
}
return ads[rand.Intn(len(ads))]
}
func renderHTTPError(log logrus.FieldLogger, r *http.Request, w http.ResponseWriter, err error, code int) {
log.WithField("error", err).Error("request error")
errMsg := fmt.Sprintf("%+v", err)

View file

@ -73,6 +73,9 @@ type frontendServer struct {
shippingSvcAddr string
shippingSvcConn *grpc.ClientConn
adSvcAddr string
adSvcConn *grpc.ClientConn
}
func main() {
@ -96,6 +99,7 @@ func main() {
mustMapEnv(&svc.recommendationSvcAddr, "RECOMMENDATION_SERVICE_ADDR")
mustMapEnv(&svc.checkoutSvcAddr, "CHECKOUT_SERVICE_ADDR")
mustMapEnv(&svc.shippingSvcAddr, "SHIPPING_SERVICE_ADDR")
mustMapEnv(&svc.adSvcAddr, "AD_SERVICE_ADDR")
mustConnGRPC(ctx, &svc.currencySvcConn, svc.currencySvcAddr)
mustConnGRPC(ctx, &svc.productCatalogSvcConn, svc.productCatalogSvcAddr)
@ -103,6 +107,7 @@ func main() {
mustConnGRPC(ctx, &svc.recommendationSvcConn, svc.recommendationSvcAddr)
mustConnGRPC(ctx, &svc.shippingSvcConn, svc.shippingSvcAddr)
mustConnGRPC(ctx, &svc.checkoutSvcConn, svc.checkoutSvcAddr)
mustConnGRPC(ctx, &svc.adSvcConn, svc.adSvcAddr)
r := mux.NewRouter()
r.HandleFunc("/", svc.homeHandler).Methods(http.MethodGet, http.MethodHead)

View file

@ -114,3 +114,22 @@ func (fe *frontendServer) getRecommendations(ctx context.Context, userID string,
}
return out, err
}
func (fe *frontendServer) getAd(ctx context.Context) ([]*pb.Ad, error) {
return []*pb.Ad{
&pb.Ad{
Text: "Try this OG insta camera from 1960s!",
RedirectUrl: "https://en.wikipedia.org/wiki/Instant_camera#Polaroid_cameras",
},
&pb.Ad{
Text: "Check out the new instagrammy vacation destinations!",
RedirectUrl: "https://en.wikipedia.org/wiki/Italy",
},
}, nil
// TODO(rghetia): uncomment below and revove the code above
// resp, err := pb.NewAdsServiceClient(fe.adSvcConn).GetAds(ctx, &pb.AdsRequest{
// ContextKeys: nil,
// })
// return resp.GetAds(), errors.Wrap(err, "failed to get ads")
}

View file

@ -0,0 +1,10 @@
{{ define "text_ad" }}
<div class="container">
<div class="alert alert-dark" role="alert">
<strong>Advertisement:</strong>
<a href="{{.RedirectUrl}}" rel="nofollow" target="_blank" class="alert-link">
{{.Text}}
</a>
</div>
</div>
{{ end }}

View file

@ -51,6 +51,9 @@
</div>
{{ end }}
</div>
<div class="row">
{{ with $.ad }}{{ template "text_ad" . }}{{ end}}
</div>
</div>
</div>
</main>

View file

@ -47,9 +47,10 @@
{{ template "recommendations" $.recommendations }}
{{ end }}
{{ with $.ad }}{{ template "text_ad" . }}{{ end}}
</div>
</div>
</main>
{{ template "footer" . }}
{{ end }}