From 373ee8ad3bd0d387c113ad3fe098fb235adf7dde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Can=20Berk=20G=C3=BCder?= Date: Mon, 16 Jan 2017 14:34:51 -0800 Subject: [PATCH] Add Search endpoint [#133191487] Signed-off-by: Christopher Brown --- .../revok/revokfakes/fake_server.go | 65 ++++- src/cred-alert/revok/server.go | 8 +- src/cred-alert/revokpb/revok.pb.go | 249 ++++++++++++++++-- src/cred-alert/revokpb/revok.proto | 26 ++ 4 files changed, 311 insertions(+), 37 deletions(-) diff --git a/src/cred-alert/revok/revokfakes/fake_server.go b/src/cred-alert/revok/revokfakes/fake_server.go index 55814115..4a1dc8d0 100644 --- a/src/cred-alert/revok/revokfakes/fake_server.go +++ b/src/cred-alert/revok/revokfakes/fake_server.go @@ -30,16 +30,25 @@ type FakeServer struct { result1 *revokpb.OrganizationCredentialCountResponse result2 error } - GetRepositoryCredentialCountsStub func(ctx context.Context, in *revokpb.RepositoryCredentialCountRequest) (*revokpb.RepositoryCredentialCountResponse, error) + GetRepositoryCredentialCountsStub func(context.Context, *revokpb.RepositoryCredentialCountRequest) (*revokpb.RepositoryCredentialCountResponse, error) getRepositoryCredentialCountsMutex sync.RWMutex getRepositoryCredentialCountsArgsForCall []struct { - ctx context.Context - in *revokpb.RepositoryCredentialCountRequest + arg1 context.Context + arg2 *revokpb.RepositoryCredentialCountRequest } getRepositoryCredentialCountsReturns struct { result1 *revokpb.RepositoryCredentialCountResponse result2 error } + SearchStub func(*revokpb.SearchQuery, revokpb.Revok_SearchServer) error + searchMutex sync.RWMutex + searchArgsForCall []struct { + arg1 *revokpb.SearchQuery + arg2 revokpb.Revok_SearchServer + } + searchReturns struct { + result1 error + } invocations map[string][][]interface{} invocationsMutex sync.RWMutex } @@ -114,16 +123,16 @@ func (fake *FakeServer) GetOrganizationCredentialCountsReturns(result1 *revokpb. }{result1, result2} } -func (fake *FakeServer) GetRepositoryCredentialCounts(ctx context.Context, in *revokpb.RepositoryCredentialCountRequest) (*revokpb.RepositoryCredentialCountResponse, error) { +func (fake *FakeServer) GetRepositoryCredentialCounts(arg1 context.Context, arg2 *revokpb.RepositoryCredentialCountRequest) (*revokpb.RepositoryCredentialCountResponse, error) { fake.getRepositoryCredentialCountsMutex.Lock() fake.getRepositoryCredentialCountsArgsForCall = append(fake.getRepositoryCredentialCountsArgsForCall, struct { - ctx context.Context - in *revokpb.RepositoryCredentialCountRequest - }{ctx, in}) - fake.recordInvocation("GetRepositoryCredentialCounts", []interface{}{ctx, in}) + arg1 context.Context + arg2 *revokpb.RepositoryCredentialCountRequest + }{arg1, arg2}) + fake.recordInvocation("GetRepositoryCredentialCounts", []interface{}{arg1, arg2}) fake.getRepositoryCredentialCountsMutex.Unlock() if fake.GetRepositoryCredentialCountsStub != nil { - return fake.GetRepositoryCredentialCountsStub(ctx, in) + return fake.GetRepositoryCredentialCountsStub(arg1, arg2) } else { return fake.getRepositoryCredentialCountsReturns.result1, fake.getRepositoryCredentialCountsReturns.result2 } @@ -138,7 +147,7 @@ func (fake *FakeServer) GetRepositoryCredentialCountsCallCount() int { func (fake *FakeServer) GetRepositoryCredentialCountsArgsForCall(i int) (context.Context, *revokpb.RepositoryCredentialCountRequest) { fake.getRepositoryCredentialCountsMutex.RLock() defer fake.getRepositoryCredentialCountsMutex.RUnlock() - return fake.getRepositoryCredentialCountsArgsForCall[i].ctx, fake.getRepositoryCredentialCountsArgsForCall[i].in + return fake.getRepositoryCredentialCountsArgsForCall[i].arg1, fake.getRepositoryCredentialCountsArgsForCall[i].arg2 } func (fake *FakeServer) GetRepositoryCredentialCountsReturns(result1 *revokpb.RepositoryCredentialCountResponse, result2 error) { @@ -149,6 +158,40 @@ func (fake *FakeServer) GetRepositoryCredentialCountsReturns(result1 *revokpb.Re }{result1, result2} } +func (fake *FakeServer) Search(arg1 *revokpb.SearchQuery, arg2 revokpb.Revok_SearchServer) error { + fake.searchMutex.Lock() + fake.searchArgsForCall = append(fake.searchArgsForCall, struct { + arg1 *revokpb.SearchQuery + arg2 revokpb.Revok_SearchServer + }{arg1, arg2}) + fake.recordInvocation("Search", []interface{}{arg1, arg2}) + fake.searchMutex.Unlock() + if fake.SearchStub != nil { + return fake.SearchStub(arg1, arg2) + } else { + return fake.searchReturns.result1 + } +} + +func (fake *FakeServer) SearchCallCount() int { + fake.searchMutex.RLock() + defer fake.searchMutex.RUnlock() + return len(fake.searchArgsForCall) +} + +func (fake *FakeServer) SearchArgsForCall(i int) (*revokpb.SearchQuery, revokpb.Revok_SearchServer) { + fake.searchMutex.RLock() + defer fake.searchMutex.RUnlock() + return fake.searchArgsForCall[i].arg1, fake.searchArgsForCall[i].arg2 +} + +func (fake *FakeServer) SearchReturns(result1 error) { + fake.SearchStub = nil + fake.searchReturns = struct { + result1 error + }{result1} +} + func (fake *FakeServer) Invocations() map[string][][]interface{} { fake.invocationsMutex.RLock() defer fake.invocationsMutex.RUnlock() @@ -158,6 +201,8 @@ func (fake *FakeServer) Invocations() map[string][][]interface{} { defer fake.getOrganizationCredentialCountsMutex.RUnlock() fake.getRepositoryCredentialCountsMutex.RLock() defer fake.getRepositoryCredentialCountsMutex.RUnlock() + fake.searchMutex.RLock() + defer fake.searchMutex.RUnlock() return fake.invocations } diff --git a/src/cred-alert/revok/server.go b/src/cred-alert/revok/server.go index 9fbea052..d66d6ea3 100644 --- a/src/cred-alert/revok/server.go +++ b/src/cred-alert/revok/server.go @@ -17,9 +17,7 @@ import ( //go:generate counterfeiter . Server type Server interface { - GetCredentialCounts(context.Context, *revokpb.CredentialCountRequest) (*revokpb.CredentialCountResponse, error) - GetOrganizationCredentialCounts(context.Context, *revokpb.OrganizationCredentialCountRequest) (*revokpb.OrganizationCredentialCountResponse, error) - GetRepositoryCredentialCounts(ctx context.Context, in *revokpb.RepositoryCredentialCountRequest) (*revokpb.RepositoryCredentialCountResponse, error) + revokpb.RevokServer } type server struct { @@ -140,3 +138,7 @@ func (s *server) GetRepositoryCredentialCounts( return response, nil } + +func (s *server) Search(*revokpb.SearchQuery, revokpb.Revok_SearchServer) error { + panic("not implemented") +} diff --git a/src/cred-alert/revokpb/revok.pb.go b/src/cred-alert/revokpb/revok.pb.go index fcc29114..23fb7378 100644 --- a/src/cred-alert/revokpb/revok.pb.go +++ b/src/cred-alert/revokpb/revok.pb.go @@ -18,6 +18,10 @@ It has these top-level messages: RepositoryCredentialCountRequest BranchCredentialCount RepositoryCredentialCountResponse + SearchQuery + SearchResult + SourceLocation + Repository */ package revokpb @@ -225,6 +229,126 @@ func (m *RepositoryCredentialCountResponse) GetCredentialCounts() []*BranchCrede return nil } +type SearchQuery struct { + Regex string `protobuf:"bytes,1,opt,name=regex" json:"regex,omitempty"` +} + +func (m *SearchQuery) Reset() { *m = SearchQuery{} } +func (m *SearchQuery) String() string { return proto.CompactTextString(m) } +func (*SearchQuery) ProtoMessage() {} +func (*SearchQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *SearchQuery) GetRegex() string { + if m != nil { + return m.Regex + } + return "" +} + +type SearchResult struct { + Location *SourceLocation `protobuf:"bytes,1,opt,name=location" json:"location,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content" json:"content,omitempty"` +} + +func (m *SearchResult) Reset() { *m = SearchResult{} } +func (m *SearchResult) String() string { return proto.CompactTextString(m) } +func (*SearchResult) ProtoMessage() {} +func (*SearchResult) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +func (m *SearchResult) GetLocation() *SourceLocation { + if m != nil { + return m.Location + } + return nil +} + +func (m *SearchResult) GetContent() string { + if m != nil { + return m.Content + } + return "" +} + +type SourceLocation struct { + Repository *Repository `protobuf:"bytes,1,opt,name=repository" json:"repository,omitempty"` + Revision string `protobuf:"bytes,2,opt,name=revision" json:"revision,omitempty"` + Path string `protobuf:"bytes,3,opt,name=path" json:"path,omitempty"` + LineNumber uint32 `protobuf:"varint,4,opt,name=line_number,json=lineNumber" json:"line_number,omitempty"` + Location uint32 `protobuf:"varint,5,opt,name=location" json:"location,omitempty"` + Length uint32 `protobuf:"varint,6,opt,name=length" json:"length,omitempty"` +} + +func (m *SourceLocation) Reset() { *m = SourceLocation{} } +func (m *SourceLocation) String() string { return proto.CompactTextString(m) } +func (*SourceLocation) ProtoMessage() {} +func (*SourceLocation) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *SourceLocation) GetRepository() *Repository { + if m != nil { + return m.Repository + } + return nil +} + +func (m *SourceLocation) GetRevision() string { + if m != nil { + return m.Revision + } + return "" +} + +func (m *SourceLocation) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *SourceLocation) GetLineNumber() uint32 { + if m != nil { + return m.LineNumber + } + return 0 +} + +func (m *SourceLocation) GetLocation() uint32 { + if m != nil { + return m.Location + } + return 0 +} + +func (m *SourceLocation) GetLength() uint32 { + if m != nil { + return m.Length + } + return 0 +} + +type Repository struct { + Owner string `protobuf:"bytes,1,opt,name=owner" json:"owner,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` +} + +func (m *Repository) Reset() { *m = Repository{} } +func (m *Repository) String() string { return proto.CompactTextString(m) } +func (*Repository) ProtoMessage() {} +func (*Repository) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *Repository) GetOwner() string { + if m != nil { + return m.Owner + } + return "" +} + +func (m *Repository) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func init() { proto.RegisterType((*CredentialCountRequest)(nil), "revokpb.CredentialCountRequest") proto.RegisterType((*OrganizationCredentialCount)(nil), "revokpb.OrganizationCredentialCount") @@ -235,6 +359,10 @@ func init() { proto.RegisterType((*RepositoryCredentialCountRequest)(nil), "revokpb.RepositoryCredentialCountRequest") proto.RegisterType((*BranchCredentialCount)(nil), "revokpb.BranchCredentialCount") proto.RegisterType((*RepositoryCredentialCountResponse)(nil), "revokpb.RepositoryCredentialCountResponse") + proto.RegisterType((*SearchQuery)(nil), "revokpb.SearchQuery") + proto.RegisterType((*SearchResult)(nil), "revokpb.SearchResult") + proto.RegisterType((*SourceLocation)(nil), "revokpb.SourceLocation") + proto.RegisterType((*Repository)(nil), "revokpb.Repository") } // Reference imports to suppress errors if they are not otherwise used. @@ -251,6 +379,7 @@ type RevokClient interface { GetCredentialCounts(ctx context.Context, in *CredentialCountRequest, opts ...grpc.CallOption) (*CredentialCountResponse, error) GetOrganizationCredentialCounts(ctx context.Context, in *OrganizationCredentialCountRequest, opts ...grpc.CallOption) (*OrganizationCredentialCountResponse, error) GetRepositoryCredentialCounts(ctx context.Context, in *RepositoryCredentialCountRequest, opts ...grpc.CallOption) (*RepositoryCredentialCountResponse, error) + Search(ctx context.Context, in *SearchQuery, opts ...grpc.CallOption) (Revok_SearchClient, error) } type revokClient struct { @@ -288,12 +417,45 @@ func (c *revokClient) GetRepositoryCredentialCounts(ctx context.Context, in *Rep return out, nil } +func (c *revokClient) Search(ctx context.Context, in *SearchQuery, opts ...grpc.CallOption) (Revok_SearchClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Revok_serviceDesc.Streams[0], c.cc, "/revokpb.Revok/Search", opts...) + if err != nil { + return nil, err + } + x := &revokSearchClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Revok_SearchClient interface { + Recv() (*SearchResult, error) + grpc.ClientStream +} + +type revokSearchClient struct { + grpc.ClientStream +} + +func (x *revokSearchClient) Recv() (*SearchResult, error) { + m := new(SearchResult) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // Server API for Revok service type RevokServer interface { GetCredentialCounts(context.Context, *CredentialCountRequest) (*CredentialCountResponse, error) GetOrganizationCredentialCounts(context.Context, *OrganizationCredentialCountRequest) (*OrganizationCredentialCountResponse, error) GetRepositoryCredentialCounts(context.Context, *RepositoryCredentialCountRequest) (*RepositoryCredentialCountResponse, error) + Search(*SearchQuery, Revok_SearchServer) error } func RegisterRevokServer(s *grpc.Server, srv RevokServer) { @@ -354,6 +516,27 @@ func _Revok_GetRepositoryCredentialCounts_Handler(srv interface{}, ctx context.C return interceptor(ctx, in, info, handler) } +func _Revok_Search_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(SearchQuery) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(RevokServer).Search(m, &revokSearchServer{stream}) +} + +type Revok_SearchServer interface { + Send(*SearchResult) error + grpc.ServerStream +} + +type revokSearchServer struct { + grpc.ServerStream +} + +func (x *revokSearchServer) Send(m *SearchResult) error { + return x.ServerStream.SendMsg(m) +} + var _Revok_serviceDesc = grpc.ServiceDesc{ ServiceName: "revokpb.Revok", HandlerType: (*RevokServer)(nil), @@ -371,34 +554,52 @@ var _Revok_serviceDesc = grpc.ServiceDesc{ Handler: _Revok_GetRepositoryCredentialCounts_Handler, }, }, - Streams: []grpc.StreamDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Search", + Handler: _Revok_Search_Handler, + ServerStreams: true, + }, + }, Metadata: "revok.proto", } func init() { proto.RegisterFile("revok.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 348 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x94, 0xbb, 0x4f, 0xc3, 0x30, - 0x10, 0xc6, 0x49, 0x4b, 0x41, 0xbd, 0x2e, 0xc8, 0xbc, 0x02, 0x08, 0x1a, 0x0c, 0x43, 0x79, 0xa8, - 0x43, 0xd9, 0xd8, 0xa0, 0x43, 0x05, 0x42, 0x80, 0x3c, 0xc2, 0x94, 0x96, 0x13, 0x44, 0x05, 0x3b, - 0xd8, 0x2e, 0xaf, 0x81, 0xff, 0x94, 0xff, 0x05, 0x35, 0x49, 0x03, 0x6d, 0x6c, 0x2b, 0x5b, 0x2e, - 0xfe, 0x2e, 0xdf, 0x77, 0xbf, 0x9c, 0x0c, 0x0d, 0x89, 0x6f, 0x62, 0xd8, 0x8e, 0xa5, 0xd0, 0x82, - 0x2c, 0x26, 0x45, 0xdc, 0xa7, 0x3e, 0xac, 0x75, 0x25, 0x3e, 0x20, 0xd7, 0x51, 0xf8, 0xdc, 0x15, - 0x23, 0xae, 0x19, 0xbe, 0x8e, 0x50, 0x69, 0x7a, 0x01, 0x5b, 0x37, 0xf2, 0x31, 0xe4, 0xd1, 0x57, - 0xa8, 0x23, 0xc1, 0x67, 0x54, 0x64, 0x05, 0x6a, 0xe2, 0x9d, 0xa3, 0xf4, 0xbd, 0xc0, 0x6b, 0xd5, - 0x59, 0x5a, 0x8c, 0xdf, 0x0e, 0xc6, 0xc7, 0x7e, 0x25, 0xf0, 0x5a, 0x55, 0x96, 0x16, 0x74, 0x08, - 0xeb, 0x05, 0x13, 0x15, 0x0b, 0xae, 0x90, 0xdc, 0xc2, 0xd2, 0x60, 0xfa, 0x48, 0xf9, 0x5e, 0x50, - 0x6d, 0x35, 0x3a, 0xfb, 0xed, 0x2c, 0x63, 0xdb, 0x11, 0x83, 0x15, 0xba, 0xe9, 0x29, 0x50, 0x57, - 0x43, 0x3a, 0x9d, 0x39, 0x3e, 0xbd, 0x87, 0x0d, 0x86, 0xb1, 0x50, 0x91, 0x16, 0xf2, 0xb3, 0xdc, - 0xc4, 0x04, 0xe6, 0x79, 0xf8, 0x82, 0xc9, 0xc0, 0x75, 0x96, 0x3c, 0xff, 0x51, 0xa8, 0xfe, 0xa7, - 0x30, 0x82, 0x3d, 0x67, 0xb0, 0x8c, 0xc8, 0xb5, 0x95, 0x08, 0xcd, 0x89, 0x58, 0x43, 0x1a, 0x78, - 0x5c, 0x41, 0x60, 0x97, 0xbb, 0x68, 0x98, 0x46, 0xa3, 0x67, 0xb0, 0x7a, 0x2e, 0x43, 0x3e, 0x78, - 0x9a, 0xa5, 0x33, 0x11, 0x7b, 0x26, 0x0e, 0x53, 0xdb, 0x20, 0x60, 0xd7, 0x11, 0x28, 0xa3, 0x70, - 0x69, 0xa5, 0xb0, 0x93, 0x53, 0x30, 0x06, 0x29, 0x12, 0xe8, 0xfc, 0x54, 0xa0, 0xc6, 0xc6, 0x3d, - 0xe4, 0x0e, 0x96, 0x7b, 0xa8, 0x67, 0x3a, 0x14, 0x69, 0xe6, 0x9f, 0x34, 0xf3, 0xd9, 0x0c, 0xec, - 0x82, 0x34, 0x2f, 0x9d, 0x23, 0xdf, 0xd0, 0xec, 0xa1, 0x76, 0xfc, 0x61, 0x45, 0x8e, 0x4a, 0xad, - 0x74, 0xe6, 0x79, 0x5c, 0x4e, 0x9c, 0xfb, 0x7f, 0xc0, 0x76, 0x0f, 0xb5, 0x95, 0xac, 0x22, 0x07, - 0x25, 0xd6, 0x27, 0xf3, 0x3e, 0x2c, 0x23, 0x9d, 0x38, 0xf7, 0x17, 0x92, 0x3b, 0xe5, 0xe4, 0x37, - 0x00, 0x00, 0xff, 0xff, 0xc8, 0xb2, 0x42, 0x21, 0x62, 0x04, 0x00, 0x00, + // 535 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x55, 0x5d, 0x6f, 0xd3, 0x30, + 0x14, 0x5d, 0xe8, 0xda, 0xad, 0xb7, 0x80, 0x90, 0xf7, 0x15, 0x8a, 0xa0, 0xc1, 0xe3, 0xa1, 0x7c, + 0xa8, 0x42, 0xad, 0x84, 0x04, 0x6f, 0xb0, 0x87, 0x0a, 0x34, 0x0d, 0xf0, 0xde, 0x40, 0x08, 0xa5, + 0xe1, 0xaa, 0x8d, 0x96, 0xd9, 0xc1, 0x76, 0xc6, 0xc6, 0x03, 0xbf, 0x83, 0xdf, 0xc4, 0xaf, 0x42, + 0x71, 0x52, 0x67, 0xed, 0x92, 0x28, 0x6f, 0xb9, 0xbe, 0xc7, 0xbd, 0xe7, 0x9c, 0x7b, 0xd2, 0x40, + 0x4f, 0xe2, 0x85, 0x38, 0x1b, 0xc5, 0x52, 0x68, 0x41, 0xb6, 0x4c, 0x11, 0xcf, 0xa8, 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c, 0xa6, 0xa8, 0x6b, 0x5e, + 0x35, 0x45, 0x9e, 0x37, 0xfa, 0x6f, 0xc9, 0x67, 0xbe, 0x68, 0x06, 0xb6, 0xf3, 0x2f, 0xe1, 0xe1, + 0x14, 0x75, 0x65, 0xc4, 0x15, 0x79, 0xda, 0xe0, 0x3d, 0xce, 0x67, 0x3f, 0x6b, 0x02, 0xb5, 0x93, + 0x5f, 0x43, 0x27, 0xcb, 0x30, 0xd9, 0x2d, 0xb2, 0x5a, 0x24, 0xbf, 0xbf, 0xb7, 0x76, 0x9a, 0x45, + 0x9d, 0x6e, 0xbc, 0x74, 0x66, 0x1d, 0xf3, 0x5d, 0x98, 0xfc, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x45, + 0x93, 0xc0, 0x9f, 0x26, 0x06, 0x00, 0x00, } diff --git a/src/cred-alert/revokpb/revok.proto b/src/cred-alert/revokpb/revok.proto index e6215bc7..8c4161d1 100644 --- a/src/cred-alert/revokpb/revok.proto +++ b/src/cred-alert/revokpb/revok.proto @@ -6,6 +6,8 @@ service Revok { rpc GetCredentialCounts(CredentialCountRequest) returns (CredentialCountResponse) {} rpc GetOrganizationCredentialCounts(OrganizationCredentialCountRequest) returns (OrganizationCredentialCountResponse) {} rpc GetRepositoryCredentialCounts(RepositoryCredentialCountRequest) returns (RepositoryCredentialCountResponse) {} + + rpc Search(SearchQuery) returns (stream SearchResult) {} } message CredentialCountRequest {} @@ -46,3 +48,27 @@ message BranchCredentialCount { message RepositoryCredentialCountResponse { repeated BranchCredentialCount credentialCounts = 1; } + +message SearchQuery { + string regex = 1; +} + +message SearchResult { + SourceLocation location = 1; + string content = 2; +} + +message SourceLocation { + Repository repository = 1; + string revision = 2; + string path = 3; + + uint32 line_number = 4; + uint32 location = 5; + uint32 length = 6; +} + +message Repository { + string owner = 1; + string name = 2; +}