# core-svc

gRPC based service for CM(Cluster Management), written with [onion architecture](https://pingcap.feishu.cn/docs/doccniBH2cTUuXw4lZd8TKLvXad).
now, the main managed entities can be classified by cluster, network, profile, provider:

- cluster: cluster, cluster endpoint, xaccount deployment, cluster traffic filter, cluster snapshot
- network: region network, network peer
- profile: profile for cluster tier,
- provider: provider, region, iam-role

# directory structure

- cmd/: all runnable binary endpoint.
- core_ctx/: all business code in here, written with onion architecture.
- deploy/: pulumi based deploy scripts.
- doc/:
- entity/: db model, defined by ORM with gorm.
- idl/: all IDL(Independent Define Language), use protobuf + buf
- migrate/: db migration code.
- scripts/: some scripts to build, code-generate, etc.

# highlights
- high UT coverage: have 87% statement coverage
- interface oriented:
  - all db operations are abstracted by domain/repo
  - all external dependencies are abstracted by domain/facade
  - all entity's action are abstracted by domain/service
- high cohesion: all logic code is around entity + domain-service, and user stories or use cases are placed in core_ctx/cmd or core_ctx/query.

# history

This repo is migrated from [here](https://github.com/tidbcloud/dbaas/tree/master/core).
