Skip to content

sunsingerus/mservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC service + client boilerplate / scaffolding

Project status badges

CircleCI issues tags Go Report Card

What is this

This is a gRPC client+service boilerplate / scaffolding. It exposes bi-directional stream service which consumes text file and upper-cases it.

Most interesting parts are:

  • Complex protobuf nested messages with optional fields. accompanied by wrapper Set* functions. Wrapper functions are helpful, because generator generate Get* functions, but omit Set* functions, which is not convenient for messages with multiple optional fields. Located in pkg/api/mservice.

  • DataChunkFile - ordered stream of data chunks with start/stop marks. Used to transfer custom-sized data (possibly accompanied by metadata) over gRPC stream. Inspired by os.File, implements io.Writer, io.WriterTo, io.ReaderFrom, io.Closer interfaces and thus is compatible/applicable in such functions as io.Copy(dst, src). Located in pkg/api/mservice/type_data_chunk_file.go.

  • Client server-less tests, based on mockgen-generated server-side mocks. Located in pkg/controller/client/client_test.go.

  • Service tests

    • Client-less tests, used to test both DataChunk chunker/tansfer/aggregator and sever-side functionality
    • Network-less round-trip tests, used to test whole round-trip communication, with full-blown Server, launched during test case and Client dialing to Server. Based on custom in-memory dialer, network not used.

    Located in pkg/controller/service/control_plane/server_test.go. Service tests allow to both test service and transport layer functionality.

  • Multiple housekeeping scripts for convenient project client/service launch, code formatting, code generating, testing, docker image building, etc. Located in dev folder.

  • Kubernetes deployment manifests. Located in deploy folder.


Additional reading

Releases

No releases published

Packages

No packages published