From 1c1d10eb48c26f4176fa1c0bb350e90ac0c548f4 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 9 Sep 2025 19:34:41 +0300 Subject: [PATCH] =?UTF-8?q?v0.0.32=20=D0=A0=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B0=20=D0=BF=D0=BE=D1=82=D0=BE=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=D0=B0?= =?UTF-8?q?=D1=87=D0=B0=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BE=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B8=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D0=B8=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B8=D0=BF=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/http/graph/clip_resolvers.go | 53 +++- proto/clip.pb.go | 412 +++++++++++++++----------- proto/clip.proto | 14 +- proto/clip_grpc.pb.go | 52 ++-- 4 files changed, 323 insertions(+), 208 deletions(-) diff --git a/internal/http/graph/clip_resolvers.go b/internal/http/graph/clip_resolvers.go index 77172c1..b135511 100644 --- a/internal/http/graph/clip_resolvers.go +++ b/internal/http/graph/clip_resolvers.go @@ -79,21 +79,54 @@ func (r *mutationResolver) CreateClip(ctx context.Context, title *string, video clipTitle = *title } - // Читаем данные видео - videoData, err := io.ReadAll(video.File) + // Создаем потоковый клиент + stream, err := r.ClipClient.CreateClip(ctx) if err != nil { - return nil, fmt.Errorf("failed to read video data: %w", err) + return nil, fmt.Errorf("failed to create stream: %w", err) } - resp, err := r.ClipClient.CreateClip(ctx, &proto.CreateClipRequest{ - UserId: int32(userID), - Title: clipTitle, - VideoData: videoData, - FileName: video.Filename, - ContentType: video.ContentType, + // Отправляем метаданные + err = stream.Send(&proto.CreateClipRequest{ + Data: &proto.CreateClipRequest_Metadata{ + Metadata: &proto.Metadata{ + UserId: int32(userID), + Title: clipTitle, + FileName: video.Filename, + ContentType: video.ContentType, + }, + }, }) if err != nil { - return nil, fmt.Errorf("failed to create clip: %w", err) + return nil, fmt.Errorf("failed to send metadata: %w", err) + } + + // Отправляем видео чанками + chunkSize := 64 * 1024 // 64KB chunks + buffer := make([]byte, chunkSize) + + for { + n, err := video.File.Read(buffer) + if err == io.EOF { + break + } + if err != nil { + return nil, fmt.Errorf("failed to read video: %w", err) + } + + err = stream.Send(&proto.CreateClipRequest{ + Data: &proto.CreateClipRequest_Chunk{ + Chunk: buffer[:n], + }, + }) + if err != nil { + return nil, fmt.Errorf("failed to send chunk: %w", err) + } + } + + // Закрываем поток и получаем ответ + resp, err := stream.CloseAndRecv() + if err != nil { + return nil, fmt.Errorf("failed to receive response: %w", err) } return r.protoClipToDomain(resp.Clip), nil diff --git a/proto/clip.pb.go b/proto/clip.pb.go index 5a1159a..e307b0d 100644 --- a/proto/clip.pb.go +++ b/proto/clip.pb.go @@ -24,12 +24,12 @@ const ( ) type CreateClipRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` - Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` - VideoData []byte `protobuf:"bytes,3,opt,name=video_data,json=videoData,proto3" json:"video_data,omitempty"` - FileName string `protobuf:"bytes,4,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` - ContentType string `protobuf:"bytes,5,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Data: + // + // *CreateClipRequest_Metadata + // *CreateClipRequest_Chunk + Data isCreateClipRequest_Data `protobuf_oneof:"data"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -64,35 +64,109 @@ func (*CreateClipRequest) Descriptor() ([]byte, []int) { return file_clip_proto_rawDescGZIP(), []int{0} } -func (x *CreateClipRequest) GetUserId() int32 { +func (x *CreateClipRequest) GetData() isCreateClipRequest_Data { + if x != nil { + return x.Data + } + return nil +} + +func (x *CreateClipRequest) GetMetadata() *Metadata { + if x != nil { + if x, ok := x.Data.(*CreateClipRequest_Metadata); ok { + return x.Metadata + } + } + return nil +} + +func (x *CreateClipRequest) GetChunk() []byte { + if x != nil { + if x, ok := x.Data.(*CreateClipRequest_Chunk); ok { + return x.Chunk + } + } + return nil +} + +type isCreateClipRequest_Data interface { + isCreateClipRequest_Data() +} + +type CreateClipRequest_Metadata struct { + Metadata *Metadata `protobuf:"bytes,1,opt,name=metadata,proto3,oneof"` +} + +type CreateClipRequest_Chunk struct { + Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` +} + +func (*CreateClipRequest_Metadata) isCreateClipRequest_Data() {} + +func (*CreateClipRequest_Chunk) isCreateClipRequest_Data() {} + +type Metadata struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId int32 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + FileName string `protobuf:"bytes,3,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` + ContentType string `protobuf:"bytes,4,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Metadata) Reset() { + *x = Metadata{} + mi := &file_clip_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Metadata) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Metadata) ProtoMessage() {} + +func (x *Metadata) ProtoReflect() protoreflect.Message { + mi := &file_clip_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Metadata.ProtoReflect.Descriptor instead. +func (*Metadata) Descriptor() ([]byte, []int) { + return file_clip_proto_rawDescGZIP(), []int{1} +} + +func (x *Metadata) GetUserId() int32 { if x != nil { return x.UserId } return 0 } -func (x *CreateClipRequest) GetTitle() string { +func (x *Metadata) GetTitle() string { if x != nil { return x.Title } return "" } -func (x *CreateClipRequest) GetVideoData() []byte { - if x != nil { - return x.VideoData - } - return nil -} - -func (x *CreateClipRequest) GetFileName() string { +func (x *Metadata) GetFileName() string { if x != nil { return x.FileName } return "" } -func (x *CreateClipRequest) GetContentType() string { +func (x *Metadata) GetContentType() string { if x != nil { return x.ContentType } @@ -108,7 +182,7 @@ type CreateClipResponse struct { func (x *CreateClipResponse) Reset() { *x = CreateClipResponse{} - mi := &file_clip_proto_msgTypes[1] + mi := &file_clip_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -120,7 +194,7 @@ func (x *CreateClipResponse) String() string { func (*CreateClipResponse) ProtoMessage() {} func (x *CreateClipResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[1] + mi := &file_clip_proto_msgTypes[2] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -133,7 +207,7 @@ func (x *CreateClipResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateClipResponse.ProtoReflect.Descriptor instead. func (*CreateClipResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{1} + return file_clip_proto_rawDescGZIP(), []int{2} } func (x *CreateClipResponse) GetClip() *Clip { @@ -152,7 +226,7 @@ type GetClipRequest struct { func (x *GetClipRequest) Reset() { *x = GetClipRequest{} - mi := &file_clip_proto_msgTypes[2] + mi := &file_clip_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -164,7 +238,7 @@ func (x *GetClipRequest) String() string { func (*GetClipRequest) ProtoMessage() {} func (x *GetClipRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[2] + mi := &file_clip_proto_msgTypes[3] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -177,7 +251,7 @@ func (x *GetClipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipRequest.ProtoReflect.Descriptor instead. func (*GetClipRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{2} + return file_clip_proto_rawDescGZIP(), []int{3} } func (x *GetClipRequest) GetClipId() int32 { @@ -196,7 +270,7 @@ type GetClipResponse struct { func (x *GetClipResponse) Reset() { *x = GetClipResponse{} - mi := &file_clip_proto_msgTypes[3] + mi := &file_clip_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -208,7 +282,7 @@ func (x *GetClipResponse) String() string { func (*GetClipResponse) ProtoMessage() {} func (x *GetClipResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[3] + mi := &file_clip_proto_msgTypes[4] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -221,7 +295,7 @@ func (x *GetClipResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipResponse.ProtoReflect.Descriptor instead. func (*GetClipResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{3} + return file_clip_proto_rawDescGZIP(), []int{4} } func (x *GetClipResponse) GetClip() *Clip { @@ -242,7 +316,7 @@ type GetUserClipsRequest struct { func (x *GetUserClipsRequest) Reset() { *x = GetUserClipsRequest{} - mi := &file_clip_proto_msgTypes[4] + mi := &file_clip_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -254,7 +328,7 @@ func (x *GetUserClipsRequest) String() string { func (*GetUserClipsRequest) ProtoMessage() {} func (x *GetUserClipsRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[4] + mi := &file_clip_proto_msgTypes[5] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -267,7 +341,7 @@ func (x *GetUserClipsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUserClipsRequest.ProtoReflect.Descriptor instead. func (*GetUserClipsRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{4} + return file_clip_proto_rawDescGZIP(), []int{5} } func (x *GetUserClipsRequest) GetUserId() int32 { @@ -301,7 +375,7 @@ type GetUserClipsResponse struct { func (x *GetUserClipsResponse) Reset() { *x = GetUserClipsResponse{} - mi := &file_clip_proto_msgTypes[5] + mi := &file_clip_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -313,7 +387,7 @@ func (x *GetUserClipsResponse) String() string { func (*GetUserClipsResponse) ProtoMessage() {} func (x *GetUserClipsResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[5] + mi := &file_clip_proto_msgTypes[6] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -326,7 +400,7 @@ func (x *GetUserClipsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetUserClipsResponse.ProtoReflect.Descriptor instead. func (*GetUserClipsResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{5} + return file_clip_proto_rawDescGZIP(), []int{6} } func (x *GetUserClipsResponse) GetClips() []*Clip { @@ -353,7 +427,7 @@ type GetClipsRequest struct { func (x *GetClipsRequest) Reset() { *x = GetClipsRequest{} - mi := &file_clip_proto_msgTypes[6] + mi := &file_clip_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -365,7 +439,7 @@ func (x *GetClipsRequest) String() string { func (*GetClipsRequest) ProtoMessage() {} func (x *GetClipsRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[6] + mi := &file_clip_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -378,7 +452,7 @@ func (x *GetClipsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipsRequest.ProtoReflect.Descriptor instead. func (*GetClipsRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{6} + return file_clip_proto_rawDescGZIP(), []int{7} } func (x *GetClipsRequest) GetLimit() int32 { @@ -405,7 +479,7 @@ type GetClipsResponse struct { func (x *GetClipsResponse) Reset() { *x = GetClipsResponse{} - mi := &file_clip_proto_msgTypes[7] + mi := &file_clip_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -417,7 +491,7 @@ func (x *GetClipsResponse) String() string { func (*GetClipsResponse) ProtoMessage() {} func (x *GetClipsResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[7] + mi := &file_clip_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -430,7 +504,7 @@ func (x *GetClipsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipsResponse.ProtoReflect.Descriptor instead. func (*GetClipsResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{7} + return file_clip_proto_rawDescGZIP(), []int{8} } func (x *GetClipsResponse) GetClips() []*Clip { @@ -457,7 +531,7 @@ type DeleteClipRequest struct { func (x *DeleteClipRequest) Reset() { *x = DeleteClipRequest{} - mi := &file_clip_proto_msgTypes[8] + mi := &file_clip_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -469,7 +543,7 @@ func (x *DeleteClipRequest) String() string { func (*DeleteClipRequest) ProtoMessage() {} func (x *DeleteClipRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[8] + mi := &file_clip_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -482,7 +556,7 @@ func (x *DeleteClipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteClipRequest.ProtoReflect.Descriptor instead. func (*DeleteClipRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{8} + return file_clip_proto_rawDescGZIP(), []int{9} } func (x *DeleteClipRequest) GetClipId() int32 { @@ -509,7 +583,7 @@ type LikeClipRequest struct { func (x *LikeClipRequest) Reset() { *x = LikeClipRequest{} - mi := &file_clip_proto_msgTypes[9] + mi := &file_clip_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -521,7 +595,7 @@ func (x *LikeClipRequest) String() string { func (*LikeClipRequest) ProtoMessage() {} func (x *LikeClipRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[9] + mi := &file_clip_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -534,7 +608,7 @@ func (x *LikeClipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use LikeClipRequest.ProtoReflect.Descriptor instead. func (*LikeClipRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{9} + return file_clip_proto_rawDescGZIP(), []int{10} } func (x *LikeClipRequest) GetClipId() int32 { @@ -560,7 +634,7 @@ type LikeClipResponse struct { func (x *LikeClipResponse) Reset() { *x = LikeClipResponse{} - mi := &file_clip_proto_msgTypes[10] + mi := &file_clip_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -572,7 +646,7 @@ func (x *LikeClipResponse) String() string { func (*LikeClipResponse) ProtoMessage() {} func (x *LikeClipResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[10] + mi := &file_clip_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -585,7 +659,7 @@ func (x *LikeClipResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use LikeClipResponse.ProtoReflect.Descriptor instead. func (*LikeClipResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{10} + return file_clip_proto_rawDescGZIP(), []int{11} } func (x *LikeClipResponse) GetLike() *ClipLike { @@ -605,7 +679,7 @@ type UnlikeClipRequest struct { func (x *UnlikeClipRequest) Reset() { *x = UnlikeClipRequest{} - mi := &file_clip_proto_msgTypes[11] + mi := &file_clip_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -617,7 +691,7 @@ func (x *UnlikeClipRequest) String() string { func (*UnlikeClipRequest) ProtoMessage() {} func (x *UnlikeClipRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[11] + mi := &file_clip_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -630,7 +704,7 @@ func (x *UnlikeClipRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use UnlikeClipRequest.ProtoReflect.Descriptor instead. func (*UnlikeClipRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{11} + return file_clip_proto_rawDescGZIP(), []int{12} } func (x *UnlikeClipRequest) GetClipId() int32 { @@ -658,7 +732,7 @@ type GetClipLikesRequest struct { func (x *GetClipLikesRequest) Reset() { *x = GetClipLikesRequest{} - mi := &file_clip_proto_msgTypes[12] + mi := &file_clip_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -670,7 +744,7 @@ func (x *GetClipLikesRequest) String() string { func (*GetClipLikesRequest) ProtoMessage() {} func (x *GetClipLikesRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[12] + mi := &file_clip_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -683,7 +757,7 @@ func (x *GetClipLikesRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipLikesRequest.ProtoReflect.Descriptor instead. func (*GetClipLikesRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{12} + return file_clip_proto_rawDescGZIP(), []int{13} } func (x *GetClipLikesRequest) GetClipId() int32 { @@ -717,7 +791,7 @@ type GetClipLikesResponse struct { func (x *GetClipLikesResponse) Reset() { *x = GetClipLikesResponse{} - mi := &file_clip_proto_msgTypes[13] + mi := &file_clip_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -729,7 +803,7 @@ func (x *GetClipLikesResponse) String() string { func (*GetClipLikesResponse) ProtoMessage() {} func (x *GetClipLikesResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[13] + mi := &file_clip_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -742,7 +816,7 @@ func (x *GetClipLikesResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipLikesResponse.ProtoReflect.Descriptor instead. func (*GetClipLikesResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{13} + return file_clip_proto_rawDescGZIP(), []int{14} } func (x *GetClipLikesResponse) GetLikes() []*ClipLike { @@ -769,7 +843,7 @@ type CheckIfLikedRequest struct { func (x *CheckIfLikedRequest) Reset() { *x = CheckIfLikedRequest{} - mi := &file_clip_proto_msgTypes[14] + mi := &file_clip_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -781,7 +855,7 @@ func (x *CheckIfLikedRequest) String() string { func (*CheckIfLikedRequest) ProtoMessage() {} func (x *CheckIfLikedRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[14] + mi := &file_clip_proto_msgTypes[15] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -794,7 +868,7 @@ func (x *CheckIfLikedRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckIfLikedRequest.ProtoReflect.Descriptor instead. func (*CheckIfLikedRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{14} + return file_clip_proto_rawDescGZIP(), []int{15} } func (x *CheckIfLikedRequest) GetClipId() int32 { @@ -820,7 +894,7 @@ type CheckIfLikedResponse struct { func (x *CheckIfLikedResponse) Reset() { *x = CheckIfLikedResponse{} - mi := &file_clip_proto_msgTypes[15] + mi := &file_clip_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -832,7 +906,7 @@ func (x *CheckIfLikedResponse) String() string { func (*CheckIfLikedResponse) ProtoMessage() {} func (x *CheckIfLikedResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[15] + mi := &file_clip_proto_msgTypes[16] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -845,7 +919,7 @@ func (x *CheckIfLikedResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CheckIfLikedResponse.ProtoReflect.Descriptor instead. func (*CheckIfLikedResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{15} + return file_clip_proto_rawDescGZIP(), []int{16} } func (x *CheckIfLikedResponse) GetIsLiked() bool { @@ -866,7 +940,7 @@ type CreateCommentRequest struct { func (x *CreateCommentRequest) Reset() { *x = CreateCommentRequest{} - mi := &file_clip_proto_msgTypes[16] + mi := &file_clip_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -878,7 +952,7 @@ func (x *CreateCommentRequest) String() string { func (*CreateCommentRequest) ProtoMessage() {} func (x *CreateCommentRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[16] + mi := &file_clip_proto_msgTypes[17] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -891,7 +965,7 @@ func (x *CreateCommentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateCommentRequest.ProtoReflect.Descriptor instead. func (*CreateCommentRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{16} + return file_clip_proto_rawDescGZIP(), []int{17} } func (x *CreateCommentRequest) GetClipId() int32 { @@ -924,7 +998,7 @@ type CreateCommentResponse struct { func (x *CreateCommentResponse) Reset() { *x = CreateCommentResponse{} - mi := &file_clip_proto_msgTypes[17] + mi := &file_clip_proto_msgTypes[18] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -936,7 +1010,7 @@ func (x *CreateCommentResponse) String() string { func (*CreateCommentResponse) ProtoMessage() {} func (x *CreateCommentResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[17] + mi := &file_clip_proto_msgTypes[18] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -949,7 +1023,7 @@ func (x *CreateCommentResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use CreateCommentResponse.ProtoReflect.Descriptor instead. func (*CreateCommentResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{17} + return file_clip_proto_rawDescGZIP(), []int{18} } func (x *CreateCommentResponse) GetComment() *ClipComment { @@ -970,7 +1044,7 @@ type GetClipCommentsRequest struct { func (x *GetClipCommentsRequest) Reset() { *x = GetClipCommentsRequest{} - mi := &file_clip_proto_msgTypes[18] + mi := &file_clip_proto_msgTypes[19] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -982,7 +1056,7 @@ func (x *GetClipCommentsRequest) String() string { func (*GetClipCommentsRequest) ProtoMessage() {} func (x *GetClipCommentsRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[18] + mi := &file_clip_proto_msgTypes[19] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -995,7 +1069,7 @@ func (x *GetClipCommentsRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipCommentsRequest.ProtoReflect.Descriptor instead. func (*GetClipCommentsRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{18} + return file_clip_proto_rawDescGZIP(), []int{19} } func (x *GetClipCommentsRequest) GetClipId() int32 { @@ -1029,7 +1103,7 @@ type GetClipCommentsResponse struct { func (x *GetClipCommentsResponse) Reset() { *x = GetClipCommentsResponse{} - mi := &file_clip_proto_msgTypes[19] + mi := &file_clip_proto_msgTypes[20] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1041,7 +1115,7 @@ func (x *GetClipCommentsResponse) String() string { func (*GetClipCommentsResponse) ProtoMessage() {} func (x *GetClipCommentsResponse) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[19] + mi := &file_clip_proto_msgTypes[20] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1054,7 +1128,7 @@ func (x *GetClipCommentsResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use GetClipCommentsResponse.ProtoReflect.Descriptor instead. func (*GetClipCommentsResponse) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{19} + return file_clip_proto_rawDescGZIP(), []int{20} } func (x *GetClipCommentsResponse) GetComments() []*ClipComment { @@ -1081,7 +1155,7 @@ type DeleteCommentRequest struct { func (x *DeleteCommentRequest) Reset() { *x = DeleteCommentRequest{} - mi := &file_clip_proto_msgTypes[20] + mi := &file_clip_proto_msgTypes[21] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1093,7 +1167,7 @@ func (x *DeleteCommentRequest) String() string { func (*DeleteCommentRequest) ProtoMessage() {} func (x *DeleteCommentRequest) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[20] + mi := &file_clip_proto_msgTypes[21] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1106,7 +1180,7 @@ func (x *DeleteCommentRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DeleteCommentRequest.ProtoReflect.Descriptor instead. func (*DeleteCommentRequest) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{20} + return file_clip_proto_rawDescGZIP(), []int{21} } func (x *DeleteCommentRequest) GetCommentId() int32 { @@ -1140,7 +1214,7 @@ type Clip struct { func (x *Clip) Reset() { *x = Clip{} - mi := &file_clip_proto_msgTypes[21] + mi := &file_clip_proto_msgTypes[22] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1152,7 +1226,7 @@ func (x *Clip) String() string { func (*Clip) ProtoMessage() {} func (x *Clip) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[21] + mi := &file_clip_proto_msgTypes[22] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1165,7 +1239,7 @@ func (x *Clip) ProtoReflect() protoreflect.Message { // Deprecated: Use Clip.ProtoReflect.Descriptor instead. func (*Clip) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{21} + return file_clip_proto_rawDescGZIP(), []int{22} } func (x *Clip) GetId() int32 { @@ -1243,7 +1317,7 @@ type ClipLike struct { func (x *ClipLike) Reset() { *x = ClipLike{} - mi := &file_clip_proto_msgTypes[22] + mi := &file_clip_proto_msgTypes[23] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1255,7 +1329,7 @@ func (x *ClipLike) String() string { func (*ClipLike) ProtoMessage() {} func (x *ClipLike) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[22] + mi := &file_clip_proto_msgTypes[23] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1268,7 +1342,7 @@ func (x *ClipLike) ProtoReflect() protoreflect.Message { // Deprecated: Use ClipLike.ProtoReflect.Descriptor instead. func (*ClipLike) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{22} + return file_clip_proto_rawDescGZIP(), []int{23} } func (x *ClipLike) GetId() int32 { @@ -1313,7 +1387,7 @@ type ClipComment struct { func (x *ClipComment) Reset() { *x = ClipComment{} - mi := &file_clip_proto_msgTypes[23] + mi := &file_clip_proto_msgTypes[24] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -1325,7 +1399,7 @@ func (x *ClipComment) String() string { func (*ClipComment) ProtoMessage() {} func (x *ClipComment) ProtoReflect() protoreflect.Message { - mi := &file_clip_proto_msgTypes[23] + mi := &file_clip_proto_msgTypes[24] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1338,7 +1412,7 @@ func (x *ClipComment) ProtoReflect() protoreflect.Message { // Deprecated: Use ClipComment.ProtoReflect.Descriptor instead. func (*ClipComment) Descriptor() ([]byte, []int) { - return file_clip_proto_rawDescGZIP(), []int{23} + return file_clip_proto_rawDescGZIP(), []int{24} } func (x *ClipComment) GetId() int32 { @@ -1388,14 +1462,16 @@ var File_clip_proto protoreflect.FileDescriptor const file_clip_proto_rawDesc = "" + "\n" + "\n" + - "clip.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xa1\x01\n" + - "\x11CreateClipRequest\x12\x17\n" + + "clip.proto\x12\x05proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1bgoogle/protobuf/empty.proto\"b\n" + + "\x11CreateClipRequest\x12-\n" + + "\bmetadata\x18\x01 \x01(\v2\x0f.proto.MetadataH\x00R\bmetadata\x12\x16\n" + + "\x05chunk\x18\x02 \x01(\fH\x00R\x05chunkB\x06\n" + + "\x04data\"y\n" + + "\bMetadata\x12\x17\n" + "\auser_id\x18\x01 \x01(\x05R\x06userId\x12\x14\n" + - "\x05title\x18\x02 \x01(\tR\x05title\x12\x1d\n" + - "\n" + - "video_data\x18\x03 \x01(\fR\tvideoData\x12\x1b\n" + - "\tfile_name\x18\x04 \x01(\tR\bfileName\x12!\n" + - "\fcontent_type\x18\x05 \x01(\tR\vcontentType\"5\n" + + "\x05title\x18\x02 \x01(\tR\x05title\x12\x1b\n" + + "\tfile_name\x18\x03 \x01(\tR\bfileName\x12!\n" + + "\fcontent_type\x18\x04 \x01(\tR\vcontentType\"5\n" + "\x12CreateClipResponse\x12\x1f\n" + "\x04clip\x18\x01 \x01(\v2\v.proto.ClipR\x04clip\")\n" + "\x0eGetClipRequest\x12\x17\n" + @@ -1486,10 +1562,10 @@ const file_clip_proto_rawDesc = "" + "\n" + "created_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\tcreatedAt\x129\n" + "\n" + - "updated_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt2\xc3\x06\n" + - "\vClipService\x12A\n" + + "updated_at\x18\x06 \x01(\v2\x1a.google.protobuf.TimestampR\tupdatedAt2\xc7\x06\n" + + "\vClipService\x12E\n" + "\n" + - "CreateClip\x12\x18.proto.CreateClipRequest\x1a\x19.proto.CreateClipResponse\x128\n" + + "CreateClip\x12\x18.proto.CreateClipRequest\x1a\x19.proto.CreateClipResponse\"\x00(\x01\x128\n" + "\aGetClip\x12\x15.proto.GetClipRequest\x1a\x16.proto.GetClipResponse\x12G\n" + "\fGetUserClips\x12\x1a.proto.GetUserClipsRequest\x1a\x1b.proto.GetUserClipsResponse\x12;\n" + "\bGetClips\x12\x16.proto.GetClipsRequest\x1a\x17.proto.GetClipsResponse\x12>\n" + @@ -1516,78 +1592,80 @@ func file_clip_proto_rawDescGZIP() []byte { return file_clip_proto_rawDescData } -var file_clip_proto_msgTypes = make([]protoimpl.MessageInfo, 24) +var file_clip_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_clip_proto_goTypes = []any{ (*CreateClipRequest)(nil), // 0: proto.CreateClipRequest - (*CreateClipResponse)(nil), // 1: proto.CreateClipResponse - (*GetClipRequest)(nil), // 2: proto.GetClipRequest - (*GetClipResponse)(nil), // 3: proto.GetClipResponse - (*GetUserClipsRequest)(nil), // 4: proto.GetUserClipsRequest - (*GetUserClipsResponse)(nil), // 5: proto.GetUserClipsResponse - (*GetClipsRequest)(nil), // 6: proto.GetClipsRequest - (*GetClipsResponse)(nil), // 7: proto.GetClipsResponse - (*DeleteClipRequest)(nil), // 8: proto.DeleteClipRequest - (*LikeClipRequest)(nil), // 9: proto.LikeClipRequest - (*LikeClipResponse)(nil), // 10: proto.LikeClipResponse - (*UnlikeClipRequest)(nil), // 11: proto.UnlikeClipRequest - (*GetClipLikesRequest)(nil), // 12: proto.GetClipLikesRequest - (*GetClipLikesResponse)(nil), // 13: proto.GetClipLikesResponse - (*CheckIfLikedRequest)(nil), // 14: proto.CheckIfLikedRequest - (*CheckIfLikedResponse)(nil), // 15: proto.CheckIfLikedResponse - (*CreateCommentRequest)(nil), // 16: proto.CreateCommentRequest - (*CreateCommentResponse)(nil), // 17: proto.CreateCommentResponse - (*GetClipCommentsRequest)(nil), // 18: proto.GetClipCommentsRequest - (*GetClipCommentsResponse)(nil), // 19: proto.GetClipCommentsResponse - (*DeleteCommentRequest)(nil), // 20: proto.DeleteCommentRequest - (*Clip)(nil), // 21: proto.Clip - (*ClipLike)(nil), // 22: proto.ClipLike - (*ClipComment)(nil), // 23: proto.ClipComment - (*timestamppb.Timestamp)(nil), // 24: google.protobuf.Timestamp - (*emptypb.Empty)(nil), // 25: google.protobuf.Empty + (*Metadata)(nil), // 1: proto.Metadata + (*CreateClipResponse)(nil), // 2: proto.CreateClipResponse + (*GetClipRequest)(nil), // 3: proto.GetClipRequest + (*GetClipResponse)(nil), // 4: proto.GetClipResponse + (*GetUserClipsRequest)(nil), // 5: proto.GetUserClipsRequest + (*GetUserClipsResponse)(nil), // 6: proto.GetUserClipsResponse + (*GetClipsRequest)(nil), // 7: proto.GetClipsRequest + (*GetClipsResponse)(nil), // 8: proto.GetClipsResponse + (*DeleteClipRequest)(nil), // 9: proto.DeleteClipRequest + (*LikeClipRequest)(nil), // 10: proto.LikeClipRequest + (*LikeClipResponse)(nil), // 11: proto.LikeClipResponse + (*UnlikeClipRequest)(nil), // 12: proto.UnlikeClipRequest + (*GetClipLikesRequest)(nil), // 13: proto.GetClipLikesRequest + (*GetClipLikesResponse)(nil), // 14: proto.GetClipLikesResponse + (*CheckIfLikedRequest)(nil), // 15: proto.CheckIfLikedRequest + (*CheckIfLikedResponse)(nil), // 16: proto.CheckIfLikedResponse + (*CreateCommentRequest)(nil), // 17: proto.CreateCommentRequest + (*CreateCommentResponse)(nil), // 18: proto.CreateCommentResponse + (*GetClipCommentsRequest)(nil), // 19: proto.GetClipCommentsRequest + (*GetClipCommentsResponse)(nil), // 20: proto.GetClipCommentsResponse + (*DeleteCommentRequest)(nil), // 21: proto.DeleteCommentRequest + (*Clip)(nil), // 22: proto.Clip + (*ClipLike)(nil), // 23: proto.ClipLike + (*ClipComment)(nil), // 24: proto.ClipComment + (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp + (*emptypb.Empty)(nil), // 26: google.protobuf.Empty } var file_clip_proto_depIdxs = []int32{ - 21, // 0: proto.CreateClipResponse.clip:type_name -> proto.Clip - 21, // 1: proto.GetClipResponse.clip:type_name -> proto.Clip - 21, // 2: proto.GetUserClipsResponse.clips:type_name -> proto.Clip - 21, // 3: proto.GetClipsResponse.clips:type_name -> proto.Clip - 22, // 4: proto.LikeClipResponse.like:type_name -> proto.ClipLike - 22, // 5: proto.GetClipLikesResponse.likes:type_name -> proto.ClipLike - 23, // 6: proto.CreateCommentResponse.comment:type_name -> proto.ClipComment - 23, // 7: proto.GetClipCommentsResponse.comments:type_name -> proto.ClipComment - 24, // 8: proto.Clip.created_at:type_name -> google.protobuf.Timestamp - 24, // 9: proto.Clip.updated_at:type_name -> google.protobuf.Timestamp - 24, // 10: proto.ClipLike.created_at:type_name -> google.protobuf.Timestamp - 24, // 11: proto.ClipComment.created_at:type_name -> google.protobuf.Timestamp - 24, // 12: proto.ClipComment.updated_at:type_name -> google.protobuf.Timestamp - 0, // 13: proto.ClipService.CreateClip:input_type -> proto.CreateClipRequest - 2, // 14: proto.ClipService.GetClip:input_type -> proto.GetClipRequest - 4, // 15: proto.ClipService.GetUserClips:input_type -> proto.GetUserClipsRequest - 6, // 16: proto.ClipService.GetClips:input_type -> proto.GetClipsRequest - 8, // 17: proto.ClipService.DeleteClip:input_type -> proto.DeleteClipRequest - 9, // 18: proto.ClipService.LikeClip:input_type -> proto.LikeClipRequest - 11, // 19: proto.ClipService.UnlikeClip:input_type -> proto.UnlikeClipRequest - 12, // 20: proto.ClipService.GetClipLikes:input_type -> proto.GetClipLikesRequest - 14, // 21: proto.ClipService.CheckIfLiked:input_type -> proto.CheckIfLikedRequest - 16, // 22: proto.ClipService.CreateComment:input_type -> proto.CreateCommentRequest - 18, // 23: proto.ClipService.GetClipComments:input_type -> proto.GetClipCommentsRequest - 20, // 24: proto.ClipService.DeleteComment:input_type -> proto.DeleteCommentRequest - 1, // 25: proto.ClipService.CreateClip:output_type -> proto.CreateClipResponse - 3, // 26: proto.ClipService.GetClip:output_type -> proto.GetClipResponse - 5, // 27: proto.ClipService.GetUserClips:output_type -> proto.GetUserClipsResponse - 7, // 28: proto.ClipService.GetClips:output_type -> proto.GetClipsResponse - 25, // 29: proto.ClipService.DeleteClip:output_type -> google.protobuf.Empty - 10, // 30: proto.ClipService.LikeClip:output_type -> proto.LikeClipResponse - 25, // 31: proto.ClipService.UnlikeClip:output_type -> google.protobuf.Empty - 13, // 32: proto.ClipService.GetClipLikes:output_type -> proto.GetClipLikesResponse - 15, // 33: proto.ClipService.CheckIfLiked:output_type -> proto.CheckIfLikedResponse - 17, // 34: proto.ClipService.CreateComment:output_type -> proto.CreateCommentResponse - 19, // 35: proto.ClipService.GetClipComments:output_type -> proto.GetClipCommentsResponse - 25, // 36: proto.ClipService.DeleteComment:output_type -> google.protobuf.Empty - 25, // [25:37] is the sub-list for method output_type - 13, // [13:25] is the sub-list for method input_type - 13, // [13:13] is the sub-list for extension type_name - 13, // [13:13] is the sub-list for extension extendee - 0, // [0:13] is the sub-list for field type_name + 1, // 0: proto.CreateClipRequest.metadata:type_name -> proto.Metadata + 22, // 1: proto.CreateClipResponse.clip:type_name -> proto.Clip + 22, // 2: proto.GetClipResponse.clip:type_name -> proto.Clip + 22, // 3: proto.GetUserClipsResponse.clips:type_name -> proto.Clip + 22, // 4: proto.GetClipsResponse.clips:type_name -> proto.Clip + 23, // 5: proto.LikeClipResponse.like:type_name -> proto.ClipLike + 23, // 6: proto.GetClipLikesResponse.likes:type_name -> proto.ClipLike + 24, // 7: proto.CreateCommentResponse.comment:type_name -> proto.ClipComment + 24, // 8: proto.GetClipCommentsResponse.comments:type_name -> proto.ClipComment + 25, // 9: proto.Clip.created_at:type_name -> google.protobuf.Timestamp + 25, // 10: proto.Clip.updated_at:type_name -> google.protobuf.Timestamp + 25, // 11: proto.ClipLike.created_at:type_name -> google.protobuf.Timestamp + 25, // 12: proto.ClipComment.created_at:type_name -> google.protobuf.Timestamp + 25, // 13: proto.ClipComment.updated_at:type_name -> google.protobuf.Timestamp + 0, // 14: proto.ClipService.CreateClip:input_type -> proto.CreateClipRequest + 3, // 15: proto.ClipService.GetClip:input_type -> proto.GetClipRequest + 5, // 16: proto.ClipService.GetUserClips:input_type -> proto.GetUserClipsRequest + 7, // 17: proto.ClipService.GetClips:input_type -> proto.GetClipsRequest + 9, // 18: proto.ClipService.DeleteClip:input_type -> proto.DeleteClipRequest + 10, // 19: proto.ClipService.LikeClip:input_type -> proto.LikeClipRequest + 12, // 20: proto.ClipService.UnlikeClip:input_type -> proto.UnlikeClipRequest + 13, // 21: proto.ClipService.GetClipLikes:input_type -> proto.GetClipLikesRequest + 15, // 22: proto.ClipService.CheckIfLiked:input_type -> proto.CheckIfLikedRequest + 17, // 23: proto.ClipService.CreateComment:input_type -> proto.CreateCommentRequest + 19, // 24: proto.ClipService.GetClipComments:input_type -> proto.GetClipCommentsRequest + 21, // 25: proto.ClipService.DeleteComment:input_type -> proto.DeleteCommentRequest + 2, // 26: proto.ClipService.CreateClip:output_type -> proto.CreateClipResponse + 4, // 27: proto.ClipService.GetClip:output_type -> proto.GetClipResponse + 6, // 28: proto.ClipService.GetUserClips:output_type -> proto.GetUserClipsResponse + 8, // 29: proto.ClipService.GetClips:output_type -> proto.GetClipsResponse + 26, // 30: proto.ClipService.DeleteClip:output_type -> google.protobuf.Empty + 11, // 31: proto.ClipService.LikeClip:output_type -> proto.LikeClipResponse + 26, // 32: proto.ClipService.UnlikeClip:output_type -> google.protobuf.Empty + 14, // 33: proto.ClipService.GetClipLikes:output_type -> proto.GetClipLikesResponse + 16, // 34: proto.ClipService.CheckIfLiked:output_type -> proto.CheckIfLikedResponse + 18, // 35: proto.ClipService.CreateComment:output_type -> proto.CreateCommentResponse + 20, // 36: proto.ClipService.GetClipComments:output_type -> proto.GetClipCommentsResponse + 26, // 37: proto.ClipService.DeleteComment:output_type -> google.protobuf.Empty + 26, // [26:38] is the sub-list for method output_type + 14, // [14:26] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_clip_proto_init() } @@ -1595,13 +1673,17 @@ func file_clip_proto_init() { if File_clip_proto != nil { return } + file_clip_proto_msgTypes[0].OneofWrappers = []any{ + (*CreateClipRequest_Metadata)(nil), + (*CreateClipRequest_Chunk)(nil), + } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_clip_proto_rawDesc), len(file_clip_proto_rawDesc)), NumEnums: 0, - NumMessages: 24, + NumMessages: 25, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/clip.proto b/proto/clip.proto index 99325c9..fb48bfb 100644 --- a/proto/clip.proto +++ b/proto/clip.proto @@ -9,7 +9,7 @@ import "google/protobuf/empty.proto"; service ClipService { // Клипы - rpc CreateClip(CreateClipRequest) returns (CreateClipResponse); + rpc CreateClip(stream CreateClipRequest) returns (CreateClipResponse) {} rpc GetClip(GetClipRequest) returns (GetClipResponse); rpc GetUserClips(GetUserClipsRequest) returns (GetUserClipsResponse); rpc GetClips(GetClipsRequest) returns (GetClipsResponse); @@ -28,11 +28,17 @@ service ClipService { } message CreateClipRequest { + oneof data { + Metadata metadata = 1; + bytes chunk = 2; + } +} + +message Metadata { int32 user_id = 1; string title = 2; - bytes video_data = 3; - string file_name = 4; - string content_type = 5; + string file_name = 3; + string content_type = 4; } message CreateClipResponse { diff --git a/proto/clip_grpc.pb.go b/proto/clip_grpc.pb.go index e803cd3..b754c58 100644 --- a/proto/clip_grpc.pb.go +++ b/proto/clip_grpc.pb.go @@ -39,7 +39,7 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type ClipServiceClient interface { // Клипы - CreateClip(ctx context.Context, in *CreateClipRequest, opts ...grpc.CallOption) (*CreateClipResponse, error) + CreateClip(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[CreateClipRequest, CreateClipResponse], error) GetClip(ctx context.Context, in *GetClipRequest, opts ...grpc.CallOption) (*GetClipResponse, error) GetUserClips(ctx context.Context, in *GetUserClipsRequest, opts ...grpc.CallOption) (*GetUserClipsResponse, error) GetClips(ctx context.Context, in *GetClipsRequest, opts ...grpc.CallOption) (*GetClipsResponse, error) @@ -63,16 +63,19 @@ func NewClipServiceClient(cc grpc.ClientConnInterface) ClipServiceClient { return &clipServiceClient{cc} } -func (c *clipServiceClient) CreateClip(ctx context.Context, in *CreateClipRequest, opts ...grpc.CallOption) (*CreateClipResponse, error) { +func (c *clipServiceClient) CreateClip(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[CreateClipRequest, CreateClipResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(CreateClipResponse) - err := c.cc.Invoke(ctx, ClipService_CreateClip_FullMethodName, in, out, cOpts...) + stream, err := c.cc.NewStream(ctx, &ClipService_ServiceDesc.Streams[0], ClipService_CreateClip_FullMethodName, cOpts...) if err != nil { return nil, err } - return out, nil + x := &grpc.GenericClientStream[CreateClipRequest, CreateClipResponse]{ClientStream: stream} + return x, nil } +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ClipService_CreateClipClient = grpc.ClientStreamingClient[CreateClipRequest, CreateClipResponse] + func (c *clipServiceClient) GetClip(ctx context.Context, in *GetClipRequest, opts ...grpc.CallOption) (*GetClipResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(GetClipResponse) @@ -188,7 +191,7 @@ func (c *clipServiceClient) DeleteComment(ctx context.Context, in *DeleteComment // for forward compatibility. type ClipServiceServer interface { // Клипы - CreateClip(context.Context, *CreateClipRequest) (*CreateClipResponse, error) + CreateClip(grpc.ClientStreamingServer[CreateClipRequest, CreateClipResponse]) error GetClip(context.Context, *GetClipRequest) (*GetClipResponse, error) GetUserClips(context.Context, *GetUserClipsRequest) (*GetUserClipsResponse, error) GetClips(context.Context, *GetClipsRequest) (*GetClipsResponse, error) @@ -212,8 +215,8 @@ type ClipServiceServer interface { // pointer dereference when methods are called. type UnimplementedClipServiceServer struct{} -func (UnimplementedClipServiceServer) CreateClip(context.Context, *CreateClipRequest) (*CreateClipResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateClip not implemented") +func (UnimplementedClipServiceServer) CreateClip(grpc.ClientStreamingServer[CreateClipRequest, CreateClipResponse]) error { + return status.Errorf(codes.Unimplemented, "method CreateClip not implemented") } func (UnimplementedClipServiceServer) GetClip(context.Context, *GetClipRequest) (*GetClipResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetClip not implemented") @@ -269,24 +272,13 @@ func RegisterClipServiceServer(s grpc.ServiceRegistrar, srv ClipServiceServer) { s.RegisterService(&ClipService_ServiceDesc, srv) } -func _ClipService_CreateClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(CreateClipRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClipServiceServer).CreateClip(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ClipService_CreateClip_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClipServiceServer).CreateClip(ctx, req.(*CreateClipRequest)) - } - return interceptor(ctx, in, info, handler) +func _ClipService_CreateClip_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(ClipServiceServer).CreateClip(&grpc.GenericServerStream[CreateClipRequest, CreateClipResponse]{ServerStream: stream}) } +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type ClipService_CreateClipServer = grpc.ClientStreamingServer[CreateClipRequest, CreateClipResponse] + func _ClipService_GetClip_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetClipRequest) if err := dec(in); err != nil { @@ -492,10 +484,6 @@ var ClipService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "proto.ClipService", HandlerType: (*ClipServiceServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "CreateClip", - Handler: _ClipService_CreateClip_Handler, - }, { MethodName: "GetClip", Handler: _ClipService_GetClip_Handler, @@ -541,6 +529,12 @@ var ClipService_ServiceDesc = grpc.ServiceDesc{ Handler: _ClipService_DeleteComment_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "CreateClip", + Handler: _ClipService_CreateClip_Handler, + ClientStreams: true, + }, + }, Metadata: "clip.proto", }