Skip to content

Latest commit

 

History

History
112 lines (75 loc) · 4.19 KB

services.md

File metadata and controls

112 lines (75 loc) · 4.19 KB

Services in the Service Chain

Common source code: common.go

The chain overview:

⇄ REST API / gRPC
↓
↓ ContrailService
↓ RefUpdateToUpdateService
↓ SanitizerService
↓ RBACService
↓ QuotaCheckerService
↓ NeutronService (optional)
↓ ContrailTypeLogicService
↓ etcd.NotifierService (optional)
↓ db.DBService
↓
↺ Database

Contrail service

  • Caller: REST/gRPC framework
  • Purpose: Operations on request's payload: common operations, schema-based validation, deserialize payload to resource structure.
  • Source code: service.go.tmpl service_common.go.tmpl

Contrail Service is registered as API request handler.

Ref update to update service

  • Caller: ContrailService
  • Purpose: Translate reference update to in-transaction resource update.
  • Source code: service_interface.go.tmpl

RefUpdate is a special endpoint which is used only for add and delete references. It is risky to make such changes outside of transaction. RefUpdateToUpdate translates add/delete reference to in-transaction resource update.

Sanitizer service

Sanitizer complement properties like: refs or display name by creating or updating resources.

RBAC service

  • Caller: Sanitizer service
  • Purpose: Check whether resource access is allowed based on RBAC configuration.
  • Source code: rbac_service.go.tmpl rbac.go

RBAC does role based access control on resource operations. If a user has not any role which will allow a particular operation, RBAC service won't allow the user to do that resource operation.

Contrail type logic service

  • Caller: RBAC service
  • Purpose: Implements business logic specific to each type (model).
  • Source code: service.go

Here lives business logic specific for each type.

Quota checker service

Quota is a maximum limit for creation new resources.

Quota checker service is composed of two parts: quota limit getter and counter. Limit getter implements quota limit retrieval and counter implements counting logic.

etcd notifier service

Notifier service uses etcd server for pushing change notification. Other Contrail microservices can observe etcd events and react on changing resources.

Notifier is optional and can be disabled in config yaml file by setting server.notify_etcd: false. etcd notifier is a temporary substitute for Sync service.

Database service

  • Caller: QuotaCheckerService or ContrailTypeLogicService
  • Purpose: High level abstraction for database driver.
  • Source code: db.go

Database service provides query builder by exposing high level abstraction methods. Works with PostgreSQL driver.

Database service can be accessed through Read and Write services located in ContrailService and ContrailTypeLogicService.

Other services

Services which play significant role in the project but are not part of the Service Chain.

Cache Service

Cache is heavily used in Intent Compiler (outside of Service Chain).

Current implementation of cache is responsible for:

  • Storing and removing objects from cache
  • Updating object and its references in cache