Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Terrarium - Providers]: Implementation of gRPC backend microservice integrated with DynamoDB for Data Persistence #68

Merged
merged 39 commits into from
Apr 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
cfa0cf4
Implementation of the provider registry protocol v1 (#65)
anjanikshree12 Feb 19, 2024
752837f
changes for testing, adding a metadata for windows amd64 plat
Feb 19, 2024
366ccd4
Merge branch 'main' into CIEDEV-3005
Feb 19, 2024
ad37c41
removed provider stuff from docker compose that was added for testing
Feb 19, 2024
51d215a
updated terraform.json
Feb 19, 2024
954e4fc
worked on review comments
Feb 25, 2024
c0246fb
go fmt
Feb 25, 2024
daecd91
removed unused code
Feb 26, 2024
cebd02e
added support for v3.6.0 linux amd
Feb 29, 2024
b386c43
worked on review comment suggestions
Mar 2, 2024
11f19d5
Web ui & rest microservice for providers
Mar 18, 2024
2065d2c
updated pushed changes
Mar 18, 2024
62f74da
merge conflicts
Mar 19, 2024
fdf7971
go fmt
Mar 19, 2024
60e4877
updatedone of the params of provider list item
Mar 19, 2024
27085ef
worked on review comments
Mar 19, 2024
833afdf
version-manager-service
Apr 2, 2024
e971ef4
Merge branch 'main' into ciedev-3252
Apr 2, 2024
69a0e95
go fmt
Apr 2, 2024
672c199
update in gen proto script
Apr 2, 2024
b5dffae
correction "updating previously existing sourceUrl to sourceRepoUrl a…
Apr 2, 2024
2458a5d
pushing test changes here, not the final one, this branch will be del…
Apr 2, 2024
bbb1b52
update in version_manager
Apr 2, 2024
47401fc
adding unit tests
Apr 2, 2024
3cf5eaf
removed providers.json
Apr 2, 2024
025e611
created startGRPCService for providers
Apr 2, 2024
d603d8f
modified schema & updated services according to it, removed abort pro…
Apr 3, 2024
dba3dfc
go fmt
Apr 3, 2024
2ad8294
updated unit tests based on updated schema, and fixed repeated list o…
Apr 3, 2024
17d7022
optimised the query to DB for list providers & get provider to improv…
Apr 5, 2024
42ca802
go fmt
Apr 5, 2024
a58549a
fix
Apr 5, 2024
a99e603
Update cmd/allInOne.go
anjanikshree12 Apr 5, 2024
c28d255
Update cmd/allInOne.go
anjanikshree12 Apr 5, 2024
5784e3c
Update cmd/gateway_provider.go
anjanikshree12 Apr 5, 2024
5106004
introduced a new package for service and common gateway for both modu…
Apr 6, 2024
a605ab0
go fmt
Apr 6, 2024
3b565c7
updated grpc service naming convention from camel case to snake case
Apr 8, 2024
823a763
added missing opentelemetry span
Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimised the query to DB for list providers & get provider to improv…
…e time complexity.
Anjani Kumar Srivastava committed Apr 5, 2024
commit 17d7022bf8f8fb5380090aa735b59c125c907d3e
16 changes: 13 additions & 3 deletions internal/provider/services/version_manager/version_manager.go
Original file line number Diff line number Diff line change
@@ -398,8 +398,18 @@ func (s *VersionManagerService) ListProviders(ctx context.Context, request *serv
// Initialize a map to store providers uniquely
uniqueProviders := make(map[string]*services.ListProviderItem)
anjanikshree12 marked this conversation as resolved.
Show resolved Hide resolved

projection := expression.NamesList(expression.Name("name"), expression.Name("description"), expression.Name("maturity"), expression.Name("source_repo_url"))

expr, err := expression.NewBuilder().WithProjection(projection).Build()
if err != nil {
log.Printf("Expression Builder failed creation: %v", err)
return nil, err
}

scanInputs := &dynamodb.ScanInput{
TableName: aws.String(VersionsTableName),
ProjectionExpression: expr.Projection(),
ExpressionAttributeNames: expr.Names(),
}

response, err := s.Db.Scan(ctx, scanInputs)
@@ -423,13 +433,11 @@ func (s *VersionManagerService) ListProviders(ctx context.Context, request *serv
}
}

// Convert the map of unique providers to a list
providersList := make([]*services.ListProviderItem, 0, len(uniqueProviders))
for _, provider := range uniqueProviders {
providersList = append(providersList, provider)
}

// Create the response
grpcResponse := services.ListProvidersResponse{
Providers: providersList,
}
@@ -440,13 +448,15 @@ func (s *VersionManagerService) ListProviders(ctx context.Context, request *serv
func (s *VersionManagerService) GetProvider(ctx context.Context, request *services.ProviderName) (*services.GetProviderResponse, error) {

filter := expression.Name("name").Equal(expression.Value(request.GetProvider()))
anjanikshree12 marked this conversation as resolved.
Show resolved Hide resolved
expr, err := expression.NewBuilder().WithFilter(filter).Build()
projection := expression.NamesList(expression.Name("name"), expression.Name("description"), expression.Name("maturity"), expression.Name("source_repo_url"))
expr, err := expression.NewBuilder().WithFilter(filter).WithProjection(projection).Build()
if err != nil {
log.Printf("Expression Builder failed creation: %v", err)
return nil, err
}

scanInputs := &dynamodb.ScanInput{
ProjectionExpression: expr.Projection(),
ExpressionAttributeNames: expr.Names(),
ExpressionAttributeValues: expr.Values(),
FilterExpression: expr.Filter(),