iver-wharf / wharf-api

Wharf backend written in Go
MIT License
1 stars 0 forks source link

Added gRPC logging stream server #147

Closed applejag closed 2 years ago

applejag commented 2 years ago

Summary

Motivation

The SQL code is what mostly stands out in this PR IMO. What I wanted to do was:

In Sqlite this was simple, as you basically do INSERT OR IGNORE INTO instead of just INSERT INTO, while Postgres does not have such a feature, but I found a solution that instead made use of a JOIN statement inside the INSERT.

Please look at the test files for the best overview of what the SQL actually looks like.

The Sqlite function isn't really working as we do not have foreign key constraints enabled. However, this is planned in #145.

Protobuf versioning

I've added the major version to both the path in api/wharfapi/v5/builds.proto as well as the Protobuf package name wharf.api.v5.

My reasoning here is that it should be the same as the wharf-api version, for simplicity sake. But to be able to keep backwards compatiblity, when jumping to v6 the wharf-api needs to keep supporting v5. In other words, when bumping to v6, we will have the files:

For v7, we will have the files:

Up for discussion: Should the gRPC protobuf API have a separate versioning? It could, but I think that'd be adding excess confusion.

It does however make it so if we have a breaking change in the HTTP REST API then we also have to bump the gRPC API. Perhaps that's a good thing, but I'm not sure. Input on this is well appreciated.


Closes #130