From c4157688167100b88773d25fd3ce8fa9f8d2d520 Mon Sep 17 00:00:00 2001 From: yangfeng <1719957182@qq.com> Date: Sat, 26 Aug 2023 21:09:21 +0800 Subject: [PATCH] feat(feed): add `QueryVideoSummaryAndKeywords` rpc --- src/idl/feed.proto | 15 ++- src/rpc/feed/feed.pb.go | 249 ++++++++++++++++++++++++++++++----- src/rpc/feed/feed_grpc.pb.go | 45 ++++++- src/services/feed/handler.go | 5 + 4 files changed, 273 insertions(+), 41 deletions(-) diff --git a/src/idl/feed.proto b/src/idl/feed.proto index 8de461d..aaef2a8 100644 --- a/src/idl/feed.proto +++ b/src/idl/feed.proto @@ -38,7 +38,7 @@ message QueryVideosResponse { } message VideoExistRequest { - uint32 video_id = 1; // 用户id + uint32 video_id = 1; // 视频id } message VideoExistResponse { @@ -47,8 +47,21 @@ message VideoExistResponse { bool existed = 3; } +message QueryVideoSummaryAndKeywordsRequest { + uint32 actor_id = 1; + uint32 video_id = 2; +} + +message QueryVideoSummaryAndKeywordsResponse { + int32 status_code = 1; // 状态码,0-成功,其他值-失败 + string status_msg = 2; // 返回状态描述 + string summary = 3; + string keywords = 4; +} + service FeedService { rpc ListVideos(ListFeedRequest) returns (ListFeedResponse); rpc QueryVideos(QueryVideosRequest) returns (QueryVideosResponse); rpc QueryVideoExisted(VideoExistRequest) returns (VideoExistResponse); + rpc QueryVideoSummaryAndKeywords(QueryVideoSummaryAndKeywordsRequest) returns (QueryVideoSummaryAndKeywordsResponse); } diff --git a/src/rpc/feed/feed.pb.go b/src/rpc/feed/feed.pb.go index 343c43d..9f0a98e 100644 --- a/src/rpc/feed/feed.pb.go +++ b/src/rpc/feed/feed.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.31.0 -// protoc v3.21.12 +// protoc v4.23.4 // source: feed.proto package feed @@ -373,7 +373,7 @@ type VideoExistRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - VideoId uint32 `protobuf:"varint,1,opt,name=video_id,json=videoId,proto3" json:"video_id,omitempty"` // 用户id + VideoId uint32 `protobuf:"varint,1,opt,name=video_id,json=videoId,proto3" json:"video_id,omitempty"` // 视频id } func (x *VideoExistRequest) Reset() { @@ -478,6 +478,132 @@ func (x *VideoExistResponse) GetExisted() bool { return false } +type QueryVideoSummaryAndKeywordsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ActorId uint32 `protobuf:"varint,1,opt,name=actor_id,json=actorId,proto3" json:"actor_id,omitempty"` + VideoId uint32 `protobuf:"varint,2,opt,name=video_id,json=videoId,proto3" json:"video_id,omitempty"` +} + +func (x *QueryVideoSummaryAndKeywordsRequest) Reset() { + *x = QueryVideoSummaryAndKeywordsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_feed_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryVideoSummaryAndKeywordsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryVideoSummaryAndKeywordsRequest) ProtoMessage() {} + +func (x *QueryVideoSummaryAndKeywordsRequest) ProtoReflect() protoreflect.Message { + mi := &file_feed_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryVideoSummaryAndKeywordsRequest.ProtoReflect.Descriptor instead. +func (*QueryVideoSummaryAndKeywordsRequest) Descriptor() ([]byte, []int) { + return file_feed_proto_rawDescGZIP(), []int{7} +} + +func (x *QueryVideoSummaryAndKeywordsRequest) GetActorId() uint32 { + if x != nil { + return x.ActorId + } + return 0 +} + +func (x *QueryVideoSummaryAndKeywordsRequest) GetVideoId() uint32 { + if x != nil { + return x.VideoId + } + return 0 +} + +type QueryVideoSummaryAndKeywordsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StatusCode int32 `protobuf:"varint,1,opt,name=status_code,json=statusCode,proto3" json:"status_code,omitempty"` // 状态码,0-成功,其他值-失败 + StatusMsg string `protobuf:"bytes,2,opt,name=status_msg,json=statusMsg,proto3" json:"status_msg,omitempty"` // 返回状态描述 + Summary string `protobuf:"bytes,3,opt,name=summary,proto3" json:"summary,omitempty"` + Keywords string `protobuf:"bytes,4,opt,name=keywords,proto3" json:"keywords,omitempty"` +} + +func (x *QueryVideoSummaryAndKeywordsResponse) Reset() { + *x = QueryVideoSummaryAndKeywordsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_feed_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *QueryVideoSummaryAndKeywordsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryVideoSummaryAndKeywordsResponse) ProtoMessage() {} + +func (x *QueryVideoSummaryAndKeywordsResponse) ProtoReflect() protoreflect.Message { + mi := &file_feed_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryVideoSummaryAndKeywordsResponse.ProtoReflect.Descriptor instead. +func (*QueryVideoSummaryAndKeywordsResponse) Descriptor() ([]byte, []int) { + return file_feed_proto_rawDescGZIP(), []int{8} +} + +func (x *QueryVideoSummaryAndKeywordsResponse) GetStatusCode() int32 { + if x != nil { + return x.StatusCode + } + return 0 +} + +func (x *QueryVideoSummaryAndKeywordsResponse) GetStatusMsg() string { + if x != nil { + return x.StatusMsg + } + return "" +} + +func (x *QueryVideoSummaryAndKeywordsResponse) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *QueryVideoSummaryAndKeywordsResponse) GetKeywords() string { + if x != nil { + return x.Keywords + } + return "" +} + var File_feed_proto protoreflect.FileDescriptor var file_feed_proto_rawDesc = []byte{ @@ -541,24 +667,47 @@ var file_feed_proto_rawDesc = []byte{ 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x78, 0x69, 0x73, 0x74, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x78, 0x69, 0x73, 0x74, 0x65, 0x64, - 0x32, 0xee, 0x01, 0x0a, 0x0b, 0x46, 0x65, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x43, 0x0a, 0x0a, 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, 0x12, 0x19, - 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, - 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, - 0x66, 0x65, 0x65, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, - 0x64, 0x65, 0x6f, 0x73, 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x4e, 0x0a, 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x45, - 0x78, 0x69, 0x73, 0x74, 0x65, 0x64, 0x12, 0x1b, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, - 0x64, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x56, - 0x69, 0x64, 0x65, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x42, 0x16, 0x5a, 0x14, 0x47, 0x75, 0x47, 0x6f, 0x54, 0x69, 0x6b, 0x2f, 0x73, 0x72, 0x63, - 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x66, 0x65, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x22, 0x5b, 0x0a, 0x23, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x53, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x6f, 0x72, + 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x61, 0x63, 0x74, 0x6f, 0x72, + 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x69, 0x64, 0x65, 0x6f, 0x49, 0x64, 0x22, 0x9c, 0x01, + 0x0a, 0x24, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x53, 0x75, 0x6d, 0x6d, + 0x61, 0x72, 0x79, 0x41, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x4d, 0x73, 0x67, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, + 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x32, 0xed, 0x02, 0x0a, + 0x0b, 0x46, 0x65, 0x65, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0a, + 0x4c, 0x69, 0x73, 0x74, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, 0x12, 0x19, 0x2e, 0x72, 0x70, 0x63, + 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x64, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x4a, 0x0a, 0x0b, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, + 0x12, 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, + 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, + 0x69, 0x64, 0x65, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4e, 0x0a, + 0x11, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, + 0x65, 0x64, 0x12, 0x1b, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x56, 0x69, + 0x64, 0x65, 0x6f, 0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x56, 0x69, 0x64, 0x65, 0x6f, + 0x45, 0x78, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7d, 0x0a, + 0x1c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, 0x65, 0x6f, 0x53, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x41, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, 0x2d, 0x2e, + 0x72, 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, + 0x64, 0x65, 0x6f, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x6e, 0x64, 0x4b, 0x65, 0x79, + 0x77, 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x72, + 0x70, 0x63, 0x2e, 0x66, 0x65, 0x65, 0x64, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x56, 0x69, 0x64, + 0x65, 0x6f, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x41, 0x6e, 0x64, 0x4b, 0x65, 0x79, 0x77, + 0x6f, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x16, 0x5a, 0x14, + 0x47, 0x75, 0x47, 0x6f, 0x54, 0x69, 0x6b, 0x2f, 0x73, 0x72, 0x63, 0x2f, 0x72, 0x70, 0x63, 0x2f, + 0x66, 0x65, 0x65, 0x64, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -573,29 +722,33 @@ func file_feed_proto_rawDescGZIP() []byte { return file_feed_proto_rawDescData } -var file_feed_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_feed_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_feed_proto_goTypes = []interface{}{ - (*Video)(nil), // 0: rpc.feed.Video - (*ListFeedRequest)(nil), // 1: rpc.feed.ListFeedRequest - (*ListFeedResponse)(nil), // 2: rpc.feed.ListFeedResponse - (*QueryVideosRequest)(nil), // 3: rpc.feed.QueryVideosRequest - (*QueryVideosResponse)(nil), // 4: rpc.feed.QueryVideosResponse - (*VideoExistRequest)(nil), // 5: rpc.feed.VideoExistRequest - (*VideoExistResponse)(nil), // 6: rpc.feed.VideoExistResponse - (*user.User)(nil), // 7: rpc.user.User + (*Video)(nil), // 0: rpc.feed.Video + (*ListFeedRequest)(nil), // 1: rpc.feed.ListFeedRequest + (*ListFeedResponse)(nil), // 2: rpc.feed.ListFeedResponse + (*QueryVideosRequest)(nil), // 3: rpc.feed.QueryVideosRequest + (*QueryVideosResponse)(nil), // 4: rpc.feed.QueryVideosResponse + (*VideoExistRequest)(nil), // 5: rpc.feed.VideoExistRequest + (*VideoExistResponse)(nil), // 6: rpc.feed.VideoExistResponse + (*QueryVideoSummaryAndKeywordsRequest)(nil), // 7: rpc.feed.QueryVideoSummaryAndKeywordsRequest + (*QueryVideoSummaryAndKeywordsResponse)(nil), // 8: rpc.feed.QueryVideoSummaryAndKeywordsResponse + (*user.User)(nil), // 9: rpc.user.User } var file_feed_proto_depIdxs = []int32{ - 7, // 0: rpc.feed.Video.author:type_name -> rpc.user.User + 9, // 0: rpc.feed.Video.author:type_name -> rpc.user.User 0, // 1: rpc.feed.ListFeedResponse.video_list:type_name -> rpc.feed.Video 0, // 2: rpc.feed.QueryVideosResponse.video_list:type_name -> rpc.feed.Video 1, // 3: rpc.feed.FeedService.ListVideos:input_type -> rpc.feed.ListFeedRequest 3, // 4: rpc.feed.FeedService.QueryVideos:input_type -> rpc.feed.QueryVideosRequest 5, // 5: rpc.feed.FeedService.QueryVideoExisted:input_type -> rpc.feed.VideoExistRequest - 2, // 6: rpc.feed.FeedService.ListVideos:output_type -> rpc.feed.ListFeedResponse - 4, // 7: rpc.feed.FeedService.QueryVideos:output_type -> rpc.feed.QueryVideosResponse - 6, // 8: rpc.feed.FeedService.QueryVideoExisted:output_type -> rpc.feed.VideoExistResponse - 6, // [6:9] is the sub-list for method output_type - 3, // [3:6] is the sub-list for method input_type + 7, // 6: rpc.feed.FeedService.QueryVideoSummaryAndKeywords:input_type -> rpc.feed.QueryVideoSummaryAndKeywordsRequest + 2, // 7: rpc.feed.FeedService.ListVideos:output_type -> rpc.feed.ListFeedResponse + 4, // 8: rpc.feed.FeedService.QueryVideos:output_type -> rpc.feed.QueryVideosResponse + 6, // 9: rpc.feed.FeedService.QueryVideoExisted:output_type -> rpc.feed.VideoExistResponse + 8, // 10: rpc.feed.FeedService.QueryVideoSummaryAndKeywords:output_type -> rpc.feed.QueryVideoSummaryAndKeywordsResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] is the sub-list for method input_type 3, // [3:3] is the sub-list for extension type_name 3, // [3:3] is the sub-list for extension extendee 0, // [0:3] is the sub-list for field type_name @@ -691,6 +844,30 @@ func file_feed_proto_init() { return nil } } + file_feed_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryVideoSummaryAndKeywordsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_feed_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*QueryVideoSummaryAndKeywordsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } file_feed_proto_msgTypes[1].OneofWrappers = []interface{}{} file_feed_proto_msgTypes[2].OneofWrappers = []interface{}{} @@ -700,7 +877,7 @@ func file_feed_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_feed_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 9, NumExtensions: 0, NumServices: 1, }, diff --git a/src/rpc/feed/feed_grpc.pb.go b/src/rpc/feed/feed_grpc.pb.go index 9aa7a9e..92cb75c 100644 --- a/src/rpc/feed/feed_grpc.pb.go +++ b/src/rpc/feed/feed_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v3.21.12 +// - protoc v4.23.4 // source: feed.proto package feed @@ -19,9 +19,10 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - FeedService_ListVideos_FullMethodName = "/rpc.feed.FeedService/ListVideos" - FeedService_QueryVideos_FullMethodName = "/rpc.feed.FeedService/QueryVideos" - FeedService_QueryVideoExisted_FullMethodName = "/rpc.feed.FeedService/QueryVideoExisted" + FeedService_ListVideos_FullMethodName = "/rpc.feed.FeedService/ListVideos" + FeedService_QueryVideos_FullMethodName = "/rpc.feed.FeedService/QueryVideos" + FeedService_QueryVideoExisted_FullMethodName = "/rpc.feed.FeedService/QueryVideoExisted" + FeedService_QueryVideoSummaryAndKeywords_FullMethodName = "/rpc.feed.FeedService/QueryVideoSummaryAndKeywords" ) // FeedServiceClient is the client API for FeedService service. @@ -31,6 +32,7 @@ type FeedServiceClient interface { ListVideos(ctx context.Context, in *ListFeedRequest, opts ...grpc.CallOption) (*ListFeedResponse, error) QueryVideos(ctx context.Context, in *QueryVideosRequest, opts ...grpc.CallOption) (*QueryVideosResponse, error) QueryVideoExisted(ctx context.Context, in *VideoExistRequest, opts ...grpc.CallOption) (*VideoExistResponse, error) + QueryVideoSummaryAndKeywords(ctx context.Context, in *QueryVideoSummaryAndKeywordsRequest, opts ...grpc.CallOption) (*QueryVideoSummaryAndKeywordsResponse, error) } type feedServiceClient struct { @@ -68,6 +70,15 @@ func (c *feedServiceClient) QueryVideoExisted(ctx context.Context, in *VideoExis return out, nil } +func (c *feedServiceClient) QueryVideoSummaryAndKeywords(ctx context.Context, in *QueryVideoSummaryAndKeywordsRequest, opts ...grpc.CallOption) (*QueryVideoSummaryAndKeywordsResponse, error) { + out := new(QueryVideoSummaryAndKeywordsResponse) + err := c.cc.Invoke(ctx, FeedService_QueryVideoSummaryAndKeywords_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // FeedServiceServer is the server API for FeedService service. // All implementations must embed UnimplementedFeedServiceServer // for forward compatibility @@ -75,6 +86,7 @@ type FeedServiceServer interface { ListVideos(context.Context, *ListFeedRequest) (*ListFeedResponse, error) QueryVideos(context.Context, *QueryVideosRequest) (*QueryVideosResponse, error) QueryVideoExisted(context.Context, *VideoExistRequest) (*VideoExistResponse, error) + QueryVideoSummaryAndKeywords(context.Context, *QueryVideoSummaryAndKeywordsRequest) (*QueryVideoSummaryAndKeywordsResponse, error) mustEmbedUnimplementedFeedServiceServer() } @@ -91,6 +103,9 @@ func (UnimplementedFeedServiceServer) QueryVideos(context.Context, *QueryVideosR func (UnimplementedFeedServiceServer) QueryVideoExisted(context.Context, *VideoExistRequest) (*VideoExistResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryVideoExisted not implemented") } +func (UnimplementedFeedServiceServer) QueryVideoSummaryAndKeywords(context.Context, *QueryVideoSummaryAndKeywordsRequest) (*QueryVideoSummaryAndKeywordsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryVideoSummaryAndKeywords not implemented") +} func (UnimplementedFeedServiceServer) mustEmbedUnimplementedFeedServiceServer() {} // UnsafeFeedServiceServer may be embedded to opt out of forward compatibility for this service. @@ -158,6 +173,24 @@ func _FeedService_QueryVideoExisted_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +func _FeedService_QueryVideoSummaryAndKeywords_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryVideoSummaryAndKeywordsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FeedServiceServer).QueryVideoSummaryAndKeywords(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: FeedService_QueryVideoSummaryAndKeywords_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FeedServiceServer).QueryVideoSummaryAndKeywords(ctx, req.(*QueryVideoSummaryAndKeywordsRequest)) + } + return interceptor(ctx, in, info, handler) +} + // FeedService_ServiceDesc is the grpc.ServiceDesc for FeedService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -177,6 +210,10 @@ var FeedService_ServiceDesc = grpc.ServiceDesc{ MethodName: "QueryVideoExisted", Handler: _FeedService_QueryVideoExisted_Handler, }, + { + MethodName: "QueryVideoSummaryAndKeywords", + Handler: _FeedService_QueryVideoSummaryAndKeywords_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "feed.proto", diff --git a/src/services/feed/handler.go b/src/services/feed/handler.go index 1570a82..70db06d 100644 --- a/src/services/feed/handler.go +++ b/src/services/feed/handler.go @@ -183,6 +183,11 @@ func (s FeedServiceImpl) QueryVideoExisted(ctx context.Context, req *feed.VideoE return } +// QueryVideoSummaryAndKeywords TODO +func (s FeedServiceImpl) QueryVideoSummaryAndKeywords(ctx context.Context, req *feed.QueryVideoSummaryAndKeywordsRequest) (resp *feed.QueryVideoSummaryAndKeywordsResponse, err error) { + return +} + func findVideos(ctx context.Context, latestTime int64) ([]*models.Video, time.Time, error) { logger := logging.LogService("ListVideos.findVideos").WithContext(ctx)