diff --git a/cmd/client/clientTest.go b/cmd/client/clientTest.go new file mode 100644 index 0000000..6fd98db --- /dev/null +++ b/cmd/client/clientTest.go @@ -0,0 +1,94 @@ +package main + +import ( + "context" + "fmt" + pbcommon "github.com/kic/feed/pkg/proto/common" + pbfeed "github.com/kic/feed/pkg/proto/feed" + "google.golang.org/grpc/metadata" + "io" + "log" + + "google.golang.org/grpc" + + pbusers "github.com/kic/feed/pkg/proto/users" +) + +func postsShouldBeInOrder(authctx context.Context, uid int64, client pbfeed.FeedClient) []*pbcommon.File { + expectedOrder := map[int]string{ + 0:"Makefile4", + 1:"Makefile5", + 2:"Makefile1", + 3:"Makefile2", + 4:"Makefile6", + 5:"Makefile3", + } + + feedRes, err := client.GenerateFeedForUser(authctx, &pbfeed.GenerateFeedForUserRequest{UserID: uid}) + + if err != nil { + log.Fatalf("fail to get user ID: %v", err) + } + + var files []*pbcommon.File + + for { + recv, err := feedRes.Recv() + if err == io.EOF { + break + } + if err != nil { + log.Fatalf("Got an error gneerating feed that should not occur: %v", err) + } + fmt.Printf("feed res: %v\n", recv.FileInfo) + files = append(files, recv.FileInfo) + } + + for idx, file := range files { + + if expectedOrder[idx] != file.FileName { + log.Fatalf("File out of order! %v\nExpected %v", file, expectedOrder[idx] ) + } + } + + return files +} + +func postsShouldHaveMentalHealthInjections() { + +} + +func main() { + conn, err := grpc.Dial("test.api.keeping-it-casual.com:50051", grpc.WithInsecure()) + if err != nil { + log.Fatalf("fail to dial: %v", err) + } + defer conn.Close() + client := pbfeed.NewFeedClient(conn) + userClient := pbusers.NewUsersClient(conn) + + tokRes, err := userClient.GetJWTToken(context.Background(), &pbusers.GetJWTTokenRequest{ + Username: "testuser", + Password: "testpass", + }) + + if err != nil { + log.Fatalf("fail to get token: %v", err) + } + + md := metadata.Pairs("Authorization", fmt.Sprintf("Bearer %v", tokRes.Token)) + ctx := metadata.NewOutgoingContext(context.Background(), md) + + res, err := userClient.GetUserByUsername(ctx, &pbusers.GetUserByUsernameRequest{Username: "testuser"}) + if err != nil { + log.Fatalf("fail to get user ID: %v", err) + } + + uid := res.User.UserID + + postsShouldBeInOrder(ctx, uid, client) + + postsShouldHaveMentalHealthInjections() + + log.Print("Success") +} diff --git a/cmd/client/setup.go b/cmd/client/setup.go new file mode 100644 index 0000000..2de50ca --- /dev/null +++ b/cmd/client/setup.go @@ -0,0 +1,193 @@ +// This provides a script to upload files for the target test users friends so that a feed can be generated + +package main + +import ( + "context" + "fmt" + "io/ioutil" + "log" + + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" + + pbcommon "github.com/kic/feed/pkg/proto/common" + pbmedia "github.com/kic/feed/pkg/proto/media" + pbusers "github.com/kic/feed/pkg/proto/users" +) + +//func + +func main() { + conn, err := grpc.Dial("test.api.keeping-it-casual.com:50051", grpc.WithInsecure()) + if err != nil { + log.Fatalf("fail to dial: %v", err) + } + defer conn.Close() + //client := pbfeed.NewFeedClient(conn) + userClient := pbusers.NewUsersClient(conn) + + tokRes, err := userClient.GetJWTToken(context.Background(), &pbusers.GetJWTTokenRequest{ + Username: "testuser", + Password: "testpass", + }) + + if err != nil { + log.Fatalf("fail to get token: %v", err) + } + + md := metadata.Pairs("Authorization", fmt.Sprintf("Bearer %v", tokRes.Token)) + ctx := metadata.NewOutgoingContext(context.Background(), md) + + buffer, err := ioutil.ReadFile("Makefile") + + if err != nil { + log.Fatal("cannot read file: ", err) + } + + mediaClient := pbmedia.NewMediaStorageClient(conn) + + req := &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile1", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "30", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2021, + Month: 3, + Day: 2, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } + + req = &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile2", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "30", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2021, + Month: 2, + Day: 1, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } + + req = &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile3", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "30", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2020, + Month: 2, + Day: 1, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } + + req = &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile4", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "31", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2021, + Month: 5, + Day: 1, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } + + req = &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile5", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "31", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2021, + Month: 4, + Day: 1, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } + + req = &pbmedia.UploadFileRequest{ + FileInfo: &pbcommon.File{ + FileName: "Makefile6", + FileLocation: "test", + Metadata: map[string]string{ + "userID": "31", + "ext": "txt", + "caption": "test", + }, + DateStored: &pbcommon.Date{ + Year: 2020, + Month: 2, + Day: 1, + }, + }, + File: buffer, + } + + _, err = mediaClient.UploadFile(ctx, req) + + if err != nil { + log.Fatal("cannot upload image: ", err) + } +} diff --git a/cmd/server/server.go b/cmd/server/server.go index 6895125..d1e377d 100644 --- a/cmd/server/server.go +++ b/cmd/server/server.go @@ -20,10 +20,10 @@ func main() { var connectionURL string if IsProduction { logger = logging.CreateLogger(zapcore.InfoLevel) - connectionURL = "keeping-it-casual.com:50051" + connectionURL = "api.keeping-it-casual.com:50051" } else { logger = logging.CreateLogger(zapcore.DebugLevel) - connectionURL = "test.keeping-it-casual.com:50051" + connectionURL = "test.api.keeping-it-casual.com:50051" } ListenAddress := ":" + os.Getenv("PORT") @@ -48,10 +48,10 @@ func main() { feedGen := server.NewFeedGenerator( logger, - server.NewFriendClientWrapper(conn), - server.NewUserClientWrapper(conn), - server.NewMediaClientWrapper(conn), - server.NewHealthClientWrapper(conn), + server.NewFriendClientWrapper(conn, logger), + server.NewUserClientWrapper(conn, logger), + server.NewMediaClientWrapper(conn, logger), + server.NewHealthClientWrapper(conn, logger), ) serv := server.NewFeedService(feedGen, logger) diff --git a/internal/server/clientWrappers.go b/internal/server/clientWrappers.go index 36ac535..4dd8482 100644 --- a/internal/server/clientWrappers.go +++ b/internal/server/clientWrappers.go @@ -2,6 +2,7 @@ package server import ( "context" + "go.uber.org/zap" "strconv" "google.golang.org/grpc" @@ -16,11 +17,13 @@ import ( type FriendClientWrapper struct { friendsClient pbfriends.FriendsClient + logger *zap.SugaredLogger } -func NewFriendClientWrapper(conn *grpc.ClientConn) *FriendClientWrapper { +func NewFriendClientWrapper(conn *grpc.ClientConn, logger *zap.SugaredLogger) *FriendClientWrapper { return &FriendClientWrapper{ friendsClient: pbfriends.NewFriendsClient(conn), + logger: logger, } } @@ -29,6 +32,7 @@ func (f *FriendClientWrapper) GetFriendsForUser( userID int64, authCredentials string, ) ([]uint64, error) { + f.logger.Debugf("Getting friends for %v", userID) md := metadata.Pairs("Authorization", authCredentials) ctx = metadata.NewOutgoingContext(ctx, md) req := &pbfriends.GetFriendsForUserRequest{ @@ -39,9 +43,12 @@ func (f *FriendClientWrapper) GetFriendsForUser( resp, err := f.friendsClient.GetFriendsForUser(ctx, req) if err != nil { + f.logger.Debugf("Failed to get friends for %v, returning %v", userID, err) return nil, err } + f.logger.Debugf("Got friends for %v, they are %v", userID, resp.Friends) + return resp.Friends, nil } @@ -61,19 +68,24 @@ func (f *FriendClientWrapper) GetConnectionBetweenUsers( resp, err := f.friendsClient.GetConnectionBetweenUsers(ctx, req) if err != nil { + f.logger.Debugf("Failed to get friend connection for %v and %v, returning %v", uid1, uid2, err) return 0.0, err } + f.logger.Debugf("Got connection for %v and %v, it is %v", uid1, uid2, resp.ConnectionStrength) + return resp.ConnectionStrength, nil } type MediaClientWrapper struct { mediaClient pbmedia.MediaStorageClient + logger *zap.SugaredLogger } -func NewMediaClientWrapper(conn *grpc.ClientConn) *MediaClientWrapper { +func NewMediaClientWrapper(conn *grpc.ClientConn, logger *zap.SugaredLogger) *MediaClientWrapper { return &MediaClientWrapper{ mediaClient: pbmedia.NewMediaStorageClient(conn), + logger: logger, } } @@ -97,19 +109,24 @@ func (m *MediaClientWrapper) GetFilesForUser( resp, err := m.mediaClient.GetFilesWithMetadata(ctx, req) if err != nil { + m.logger.Debugf("Failed to get files for %v, returning %v", userID, err) return nil, err } + m.logger.Debugf("Got files for %v, returning %v", userID, resp.FileInfos) + return resp.FileInfos, nil } type UserClientWrapper struct { usersClient pbusers.UsersClient + logger *zap.SugaredLogger } -func NewUserClientWrapper(conn *grpc.ClientConn) *UserClientWrapper { +func NewUserClientWrapper(conn *grpc.ClientConn, logger *zap.SugaredLogger) *UserClientWrapper { return &UserClientWrapper{ usersClient: pbusers.NewUsersClient(conn), + logger: logger, } } @@ -126,19 +143,24 @@ func (w *UserClientWrapper) GetUserNameForID( resp, err := w.usersClient.GetUserNameByID(ctx, req) if err != nil { + w.logger.Debugf("Failed to get username for %v, returning %v", userID, err) return "", err } + w.logger.Debugf("Got username for %v, returning %v", userID, resp.Username) + return resp.Username, nil } type HealthClientWrapper struct { healthClient pbhealth.HealthTrackingClient + logger *zap.SugaredLogger } -func NewHealthClientWrapper(conn *grpc.ClientConn) *HealthClientWrapper { +func NewHealthClientWrapper(conn *grpc.ClientConn, logger *zap.SugaredLogger) *HealthClientWrapper { return &HealthClientWrapper{ healthClient: pbhealth.NewHealthTrackingClient(conn), + logger: logger, } } @@ -156,8 +178,11 @@ func (h *HealthClientWrapper) GetMentalHealthScoreForUser( resp, err := h.healthClient.GetMentalHealthScoreForUser(ctx, req) if err != nil { + h.logger.Debugf("Failed to get health score for %v, returning %v", userID, err) return 0, err } + h.logger.Debugf("FGot health score for %v, returning %v", userID, resp.Score) + return resp.Score, nil } diff --git a/internal/server/feedGenerator.go b/internal/server/feedGenerator.go index f154c2c..61ac287 100644 --- a/internal/server/feedGenerator.go +++ b/internal/server/feedGenerator.go @@ -184,14 +184,14 @@ func (f *FeedGenerator) injectMentalHealthPosts( return posts, err } // inject posts here - numInject := min(len(healthPosts), len(posts) % 5) + numInject := min(len(healthPosts), len(posts)%5) healthPostIndex := 0 returnSize := numInject + len(posts) toReturn := make([]*pbcommon.File, returnSize) for i := 0; i < returnSize; i++ { // every 5th post we make a mental health post - if i % 5 == 0 { + if i%5 == 0 { toReturn[i] = healthPosts[healthPostIndex] healthPostIndex++ } else { diff --git a/pkg/proto/media/media.pb.go b/pkg/proto/media/media.pb.go index aacabca..855b203 100644 --- a/pkg/proto/media/media.pb.go +++ b/pkg/proto/media/media.pb.go @@ -136,12 +136,8 @@ type UploadFileRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - //Either upload File together or in bytes - // - // Types that are assignable to Data: - // *UploadFileRequest_FileInfo - // *UploadFileRequest_Chunk - Data isUploadFileRequest_Data `protobuf_oneof:"data"` + FileInfo *common.File `protobuf:"bytes,1,opt,name=fileInfo,proto3" json:"fileInfo,omitempty"` + File []byte `protobuf:"bytes,2,opt,name=file,proto3" json:"file,omitempty"` } func (x *UploadFileRequest) Reset() { @@ -176,43 +172,20 @@ func (*UploadFileRequest) Descriptor() ([]byte, []int) { return file_proto_media_proto_rawDescGZIP(), []int{0} } -func (m *UploadFileRequest) GetData() isUploadFileRequest_Data { - if m != nil { - return m.Data - } - return nil -} - func (x *UploadFileRequest) GetFileInfo() *common.File { - if x, ok := x.GetData().(*UploadFileRequest_FileInfo); ok { + if x != nil { return x.FileInfo } return nil } -func (x *UploadFileRequest) GetChunk() []byte { - if x, ok := x.GetData().(*UploadFileRequest_Chunk); ok { - return x.Chunk +func (x *UploadFileRequest) GetFile() []byte { + if x != nil { + return x.File } return nil } -type isUploadFileRequest_Data interface { - isUploadFileRequest_Data() -} - -type UploadFileRequest_FileInfo struct { - FileInfo *common.File `protobuf:"bytes,1,opt,name=fileInfo,proto3,oneof"` -} - -type UploadFileRequest_Chunk struct { - Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"` -} - -func (*UploadFileRequest_FileInfo) isUploadFileRequest_Data() {} - -func (*UploadFileRequest_Chunk) isUploadFileRequest_Data() {} - // //Response to user requesting file upload. type UploadFileResponse struct { @@ -818,123 +791,122 @@ var file_proto_media_proto_rawDesc = []byte{ 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x1a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0x63, 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2e, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, + 0x74, 0x6f, 0x22, 0x55, 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x69, 0x63, 0x2e, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x08, 0x66, - 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x42, - 0x06, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x4a, 0x0a, 0x12, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, - 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x79, 0x74, 0x65, 0x73, 0x52, 0x65, - 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x79, 0x74, 0x65, 0x73, 0x52, - 0x65, 0x61, 0x64, 0x22, 0x43, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x46, 0x6f, 0x72, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x66, 0x69, - 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, - 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x08, - 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x2e, 0x0a, 0x14, 0x43, 0x68, 0x65, 0x63, - 0x6b, 0x46, 0x6f, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x43, 0x0a, 0x13, 0x44, 0x6f, 0x77, 0x6e, - 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x2c, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x2c, 0x0a, - 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x83, 0x02, 0x0a, 0x19, - 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x0f, 0x64, 0x65, 0x73, - 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x47, - 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x64, - 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, - 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, - 0x73, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x1a, 0x42, 0x0a, - 0x14, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x4c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x79, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x2e, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, - 0x46, 0x69, 0x6c, 0x65, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, - 0xf1, 0x01, 0x0a, 0x1e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, - 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x53, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, - 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, - 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, - 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6b, 0x69, - 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, - 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x08, 0x66, 0x69, 0x6c, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x22, 0x4a, 0x0a, 0x12, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x62, 0x79, 0x74, 0x65, 0x73, + 0x52, 0x65, 0x61, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x52, 0x65, 0x61, 0x64, 0x22, 0x43, 0x0a, 0x13, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x46, 0x6f, + 0x72, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x08, + 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, + 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x2e, 0x0a, 0x14, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x46, 0x6f, 0x72, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x06, 0x65, 0x78, 0x69, 0x73, 0x74, 0x73, 0x22, 0x43, 0x0a, 0x13, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x2c, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x22, + 0x2c, 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x83, 0x02, + 0x0a, 0x19, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x79, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x63, 0x0a, 0x0f, 0x64, + 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x39, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, + 0x2e, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x69, 0x72, + 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x0f, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, + 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, + 0x65, 0x73, 0x73, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x1a, + 0x42, 0x0a, 0x14, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, - 0x02, 0x38, 0x01, 0x22, 0x3b, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, - 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x22, 0xee, 0x03, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x68, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, - 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, 0x2e, 0x6b, - 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, - 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, 0x64, 0x65, - 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x65, 0x0a, - 0x0e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, - 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, 0x74, - 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, - 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, - 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, - 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, - 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x53, 0x74, 0x72, - 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, - 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, - 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, - 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x52, 0x0a, - 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x1a, 0x42, 0x0a, 0x14, 0x44, 0x65, - 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, - 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x41, - 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, - 0x01, 0x22, 0x4b, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x73, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x6e, - 0x75, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x2a, 0x27, - 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x0d, 0x0a, 0x09, - 0x4f, 0x56, 0x45, 0x52, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x41, - 0x50, 0x50, 0x45, 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x5a, 0x0a, 0x12, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x0a, 0x0a, - 0x06, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, 0x41, 0x53, - 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x4c, - 0x59, 0x5f, 0x4f, 0x50, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, - 0x43, 0x41, 0x53, 0x55, 0x41, 0x4c, 0x4c, 0x59, 0x5f, 0x4f, 0x50, 0x50, 0x4f, 0x53, 0x49, 0x54, - 0x45, 0x10, 0x03, 0x32, 0xd4, 0x04, 0x0a, 0x0c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x12, 0x4b, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, - 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, - 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x6c, - 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, - 0x01, 0x12, 0x57, 0x0a, 0x12, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, + 0x02, 0x38, 0x01, 0x22, 0x4c, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x42, + 0x79, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x2e, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, + 0x6e, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x73, 0x22, 0xf1, 0x01, 0x0a, 0x1e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, + 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x12, 0x53, 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x37, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, + 0x69, 0x61, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, + 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, + 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x72, + 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, + 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x0a, 0x73, 0x74, + 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x1a, 0x3b, 0x0a, 0x0d, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x3b, 0x0a, 0x1f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x46, + 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x44, 0x61, 0x74, 0x61, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65, + 0x73, 0x73, 0x22, 0xee, 0x03, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x68, 0x0a, 0x0f, 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3e, + 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, + 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0f, + 0x64, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x65, 0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x3d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, + 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x57, + 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x2e, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, + 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0e, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, + 0x6e, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x6b, 0x69, 0x63, + 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x53, + 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x52, 0x0a, 0x73, 0x74, 0x72, 0x69, 0x63, + 0x74, 0x6e, 0x65, 0x73, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, + 0x6c, 0x61, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x6b, 0x69, 0x63, 0x2e, + 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, + 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x1a, 0x42, 0x0a, 0x14, + 0x44, 0x65, 0x73, 0x69, 0x72, 0x65, 0x64, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, + 0x1a, 0x41, 0x0a, 0x13, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, + 0x02, 0x38, 0x01, 0x22, 0x4b, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, + 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x0f, 0x6e, 0x75, 0x6d, 0x46, 0x69, 0x6c, + 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x0f, 0x6e, 0x75, 0x6d, 0x46, 0x69, 0x6c, 0x65, 0x73, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, + 0x2a, 0x27, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x6c, 0x61, 0x67, 0x12, 0x0d, + 0x0a, 0x09, 0x4f, 0x56, 0x45, 0x52, 0x57, 0x52, 0x49, 0x54, 0x45, 0x10, 0x00, 0x12, 0x0a, 0x0a, + 0x06, 0x41, 0x50, 0x50, 0x45, 0x4e, 0x44, 0x10, 0x01, 0x2a, 0x5a, 0x0a, 0x12, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x6e, 0x65, 0x73, 0x73, 0x12, + 0x0a, 0x0a, 0x06, 0x53, 0x54, 0x52, 0x49, 0x43, 0x54, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43, + 0x41, 0x53, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x54, 0x52, 0x49, 0x43, + 0x54, 0x4c, 0x59, 0x5f, 0x4f, 0x50, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, + 0x0a, 0x11, 0x43, 0x41, 0x53, 0x55, 0x41, 0x4c, 0x4c, 0x59, 0x5f, 0x4f, 0x50, 0x50, 0x4f, 0x53, + 0x49, 0x54, 0x45, 0x10, 0x03, 0x32, 0xd2, 0x04, 0x0a, 0x0c, 0x4d, 0x65, 0x64, 0x69, 0x61, 0x53, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x12, 0x49, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, + 0x46, 0x69, 0x6c, 0x65, 0x12, 0x1c, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, + 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x55, + 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x57, 0x0a, 0x12, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x42, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, 0x64, 0x69, 0x61, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x69, 0x63, 0x2e, 0x6d, 0x65, @@ -1188,10 +1160,6 @@ func file_proto_media_proto_init() { } } } - file_proto_media_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*UploadFileRequest_FileInfo)(nil), - (*UploadFileRequest_Chunk)(nil), - } type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ diff --git a/pkg/proto/media/media_grpc.pb.go b/pkg/proto/media/media_grpc.pb.go index f181e2d..e2409d6 100644 --- a/pkg/proto/media/media_grpc.pb.go +++ b/pkg/proto/media/media_grpc.pb.go @@ -21,7 +21,7 @@ type MediaStorageClient interface { // Send a file as a stream of messages, starting with a message containing a File message, then // followed by an arbitrary number of messages containing bytes representing the file. The response // will then confirm the number of bytes received or provide an error. - UploadFile(ctx context.Context, opts ...grpc.CallOption) (MediaStorage_UploadFileClient, error) + UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error) // // Using the same format as above, the service allows the client to retrieve a stored file. DownloadFileByName(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (MediaStorage_DownloadFileByNameClient, error) @@ -45,42 +45,17 @@ func NewMediaStorageClient(cc grpc.ClientConnInterface) MediaStorageClient { return &mediaStorageClient{cc} } -func (c *mediaStorageClient) UploadFile(ctx context.Context, opts ...grpc.CallOption) (MediaStorage_UploadFileClient, error) { - stream, err := c.cc.NewStream(ctx, &_MediaStorage_serviceDesc.Streams[0], "/kic.media.MediaStorage/UploadFile", opts...) +func (c *mediaStorageClient) UploadFile(ctx context.Context, in *UploadFileRequest, opts ...grpc.CallOption) (*UploadFileResponse, error) { + out := new(UploadFileResponse) + err := c.cc.Invoke(ctx, "/kic.media.MediaStorage/UploadFile", in, out, opts...) if err != nil { return nil, err } - x := &mediaStorageUploadFileClient{stream} - return x, nil -} - -type MediaStorage_UploadFileClient interface { - Send(*UploadFileRequest) error - CloseAndRecv() (*UploadFileResponse, error) - grpc.ClientStream -} - -type mediaStorageUploadFileClient struct { - grpc.ClientStream -} - -func (x *mediaStorageUploadFileClient) Send(m *UploadFileRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *mediaStorageUploadFileClient) CloseAndRecv() (*UploadFileResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(UploadFileResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil + return out, nil } func (c *mediaStorageClient) DownloadFileByName(ctx context.Context, in *DownloadFileRequest, opts ...grpc.CallOption) (MediaStorage_DownloadFileByNameClient, error) { - stream, err := c.cc.NewStream(ctx, &_MediaStorage_serviceDesc.Streams[1], "/kic.media.MediaStorage/DownloadFileByName", opts...) + stream, err := c.cc.NewStream(ctx, &_MediaStorage_serviceDesc.Streams[0], "/kic.media.MediaStorage/DownloadFileByName", opts...) if err != nil { return nil, err } @@ -155,7 +130,7 @@ type MediaStorageServer interface { // Send a file as a stream of messages, starting with a message containing a File message, then // followed by an arbitrary number of messages containing bytes representing the file. The response // will then confirm the number of bytes received or provide an error. - UploadFile(MediaStorage_UploadFileServer) error + UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) // // Using the same format as above, the service allows the client to retrieve a stored file. DownloadFileByName(*DownloadFileRequest, MediaStorage_DownloadFileByNameServer) error @@ -176,8 +151,8 @@ type MediaStorageServer interface { type UnimplementedMediaStorageServer struct { } -func (UnimplementedMediaStorageServer) UploadFile(MediaStorage_UploadFileServer) error { - return status.Errorf(codes.Unimplemented, "method UploadFile not implemented") +func (UnimplementedMediaStorageServer) UploadFile(context.Context, *UploadFileRequest) (*UploadFileResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UploadFile not implemented") } func (UnimplementedMediaStorageServer) DownloadFileByName(*DownloadFileRequest, MediaStorage_DownloadFileByNameServer) error { return status.Errorf(codes.Unimplemented, "method DownloadFileByName not implemented") @@ -207,30 +182,22 @@ func RegisterMediaStorageServer(s grpc.ServiceRegistrar, srv MediaStorageServer) s.RegisterService(&_MediaStorage_serviceDesc, srv) } -func _MediaStorage_UploadFile_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(MediaStorageServer).UploadFile(&mediaStorageUploadFileServer{stream}) -} - -type MediaStorage_UploadFileServer interface { - SendAndClose(*UploadFileResponse) error - Recv() (*UploadFileRequest, error) - grpc.ServerStream -} - -type mediaStorageUploadFileServer struct { - grpc.ServerStream -} - -func (x *mediaStorageUploadFileServer) SendAndClose(m *UploadFileResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *mediaStorageUploadFileServer) Recv() (*UploadFileRequest, error) { - m := new(UploadFileRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { +func _MediaStorage_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UploadFileRequest) + if err := dec(in); err != nil { return nil, err } - return m, nil + if interceptor == nil { + return srv.(MediaStorageServer).UploadFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kic.media.MediaStorage/UploadFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MediaStorageServer).UploadFile(ctx, req.(*UploadFileRequest)) + } + return interceptor(ctx, in, info, handler) } func _MediaStorage_DownloadFileByName_Handler(srv interface{}, stream grpc.ServerStream) error { @@ -330,6 +297,10 @@ var _MediaStorage_serviceDesc = grpc.ServiceDesc{ ServiceName: "kic.media.MediaStorage", HandlerType: (*MediaStorageServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "UploadFile", + Handler: _MediaStorage_UploadFile_Handler, + }, { MethodName: "CheckForFileByName", Handler: _MediaStorage_CheckForFileByName_Handler, @@ -348,11 +319,6 @@ var _MediaStorage_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{ - { - StreamName: "UploadFile", - Handler: _MediaStorage_UploadFile_Handler, - ClientStreams: true, - }, { StreamName: "DownloadFileByName", Handler: _MediaStorage_DownloadFileByName_Handler,