How libopenstorage/grpc-framework works
Main Components
a. Core Framework Components:
• gRPC Server Layer
• REST Gateway Layer
• Authentication/Authorization System
• Rate Limiter
• Interceptors Layer
b. Supporting Components:
• Protocol Buffer Compiler Integration
• Documentation Generator
• Client SDK Components
• Security Components
Component Relationships
┌─────────────────────────────────────────────────────────────┐
• Client Applications │
• ┬─────────────────────────┬──────────────────┘
• ▼ ▼
┌────────────────────┐ ┌──────────────────┐
• gRPC Client │ │ REST Client │
• ┬───────┘ └────────┬─────────┘
• ▼ ▼
┌─────────────────────────────────────────────────────────────┐
• Framework Core │
• ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
• Security │ │ │ │ Rate Limiter │ │
• Layer │◄─┤ Interceptor ├─►│ Service │ │
• (Auth/TLS) │ │ Chain │ │ │ │
• ┘ └──────┬───────┘ └──────────────────┘ │
• ▲ │ ▲ │
• ▼ │ │
• ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
• Ownership │ │ gRPC Server │ │ REST Gateway │ │
• Control │◄─┤ Core ├───►│ (Auto-gen) │ │
• ┘ └──────────────┘ └──────────────┘ │
• ┘
• ▼
┌─────────────────────────────────────────────────────────────┐
• User Implementation │
• (Service definitions and business logic) │
• ┘
Important Elements to Highlight
a. Security Features:
• Authentication (pkg/auth)
• Authorization (pkg/auth/role)
• TLS Support
• Ownership Management (pkg/auth/ownership)
b. Core Features:
• Protocol Buffer Integration
• Automatic REST Gateway Generation
• Rate Limiting
• Correlation ID Management (pkg/correlation)
• Interceptor Chain
c. Client Integration:
• gRPC Client Support
• Credential Injection (pkg/grpc/client/creds_injector)
• Default Context Management
Implementation Details
• Relationship between the proto files and generated code
• Where interceptors can be injected
• Automatic REST gateway generation process
• Security middleware chain