Purpose
The EDP Aggregator serves as a middleware layer between:- EDPs: Organizations with event-level user data (publishers, advertisers, platforms)
- Kingdom: Central orchestration system managing measurements
- Duchies: Computational nodes that process encrypted event data
Event Group Sync
Synchronize event group metadata with Kingdom
Data Availability
Track which event data is available for measurements
Requisition Processing
Coordinate fulfilling data requisitions from Duchies
Encrypted Storage
Manage encrypted event data storage
Architecture
The EDP Aggregator is deployed as multiple cooperating services:Core Services
Internal API Server
Image:edp-aggregator/internal-apiService Name:
edp-aggregator-internal-api-serverPort: 8443 (gRPC), 8080 (health)
Purpose
Provides internal gRPC services for managing EDP Aggregator state in Spanner:- Impression Metadata: Track encrypted event impressions
- Requisition Metadata: Manage data requisition fulfillment
- Event Group Data: Store event group configuration and status
- Data Availability: Track which data is available for measurements
Implementation
Located insrc/main/kotlin/org/wfanet/measurement/edpaggregator/:
Core Services
Core Services
Services for internal data management:
ImpressionMetadataService: Manage impression dataRequisitionMetadataService: Track requisition fulfillment- Database schema management and migrations
Spanner Integration
Implemented indeploy/gcloud/spanner/:
Configuration
Schema Management
The Internal API Server deployment includes an init container: Init Container:update-edp-aggregator-schema
Automatically runs database schema migrations before the server starts.
System API Server
Image:edp-aggregator/system-apiService Name:
edp-aggregator-system-api-serverPort: 8443 (gRPC), 8080 (health)
Type: External Service
Purpose
Exposes the System API for Kingdom and Duchies to interact with the EDP Aggregator:- Query data availability for measurements
- Request encrypted event data
- Coordinate requisition fulfillment
- Manage event group metadata
Implementation
File:deploy/common/server/SystemApiServer.kt
Configuration
Network Policy
The System API Server:- Accepts connections from Kingdom and Duchies
- Connects to Internal API Server for data operations
Background Functions
The EDP Aggregator includes several background functions, typically deployed as Google Cloud Functions or similar serverless components:Event Group Sync
File:deploy/gcloud/eventgroups/EventGroupSyncFunction.kt
Purpose
Synchronizes event group metadata between the EDP’s data sources and the Kingdom:Scheduling
Typically runs on a schedule (e.g., Cloud Scheduler):- Hourly or daily depending on event group change frequency
- Triggered by events when new data arrives
Data Availability Sync
File:deploy/gcloud/dataavailability/DataAvailabilitySyncFunction.kt
Implementation: dataavailability/DataAvailabilitySync.kt
Purpose
Tracks which encrypted event data is available for measurements:- Scans encrypted event data storage
- Updates data availability records in Spanner
- Notifies Kingdom of newly available data
- Tracks data readiness for requisition fulfillment
Metrics
File:dataavailability/DataAvailabilitySyncMetrics.kt
Tracks:
- Number of data availability records created
- Errors during sync
- Sync duration and performance
Data Availability Cleanup
File:deploy/gcloud/dataavailability/DataAvailabilityCleanupFunction.kt
Implementation: dataavailability/DataAvailabilityCleanup.kt
Purpose
Removes old data availability records:- Identifies data that’s no longer needed
- Removes stale availability records
- Frees up database storage
- Maintains data retention policies
Metrics
File:dataavailability/DataAvailabilityCleanupMetrics.kt
Requisition Fetcher
File:deploy/gcloud/requisitionfetcher/RequisitionFetcherFunction.kt
Purpose
Fetches requisitions from Kingdom and prepares encrypted data for Duchy fulfillment:Data Storage
Encrypted Event Storage
File:EncryptedStorage.kt
Manages storage of encrypted event data:
Storage Configuration
Storage Configuration
File:
StorageConfig.ktDefines storage backend configuration:- Cloud Storage bucket/path
- Encryption settings
- Access credentials
- Data retention policies
Event Data Format
Events are stored encrypted:- Source: Raw events from EDP systems
- Encryption: Events encrypted with EDP’s key
- Storage: Stored in cloud storage (GCS, S3)
- Metadata: Tracked in Spanner for queryability
Re-encryption for Duchies
When fulfilling requisitions:- Read encrypted events from storage
- Decrypt with EDP’s private key
- Aggregate into encrypted sketches
- Encrypt with Duchy’s public key
- Upload to Duchy
Privacy: EDPs never see plaintext event data from other EDPs. The EDP Aggregator only handles data from its own organization.
Deployment Configuration
Defined insrc/main/k8s/edp_aggregator.cue:
Services
Deployments
Both servers deployed as Kubernetes Deployments:- Health checks on port 8080
- TLS certificates mounted from secrets
- Trusted certificates from ConfigMap
- Spanner configuration
Network Policies
Internal API Server:- Accepts connections from: System API Server
- Egress to: Cloud Spanner
- Accepts connections from: External (Kingdom, Duchies)
- Egress to: Internal API Server
Security and Privacy
Encryption at Rest
- Event data encrypted before storage
- Encryption keys managed by EDP
- Cloud storage encryption (additional layer)
Encryption in Transit
- All gRPC communication uses TLS
- Mutual TLS for service authentication
- Certificate-based authorization
Access Control
- Only authorized Duchies can request requisition data
- Kingdom validates requisition assignments
- EDP Aggregator verifies authorization before fulfilling
Data Minimization
- Only aggregate encrypted sketches sent to Duchies
- Raw event data never leaves EDP control
- Old data cleaned up according to retention policy
Integration with Halo System
Kingdom Integration
The EDP Aggregator interacts with Kingdom: Event Group Management:- Register event groups via Kingdom Public API
- Update event group metadata
- Report data availability
- Fetch assigned requisitions via Kingdom System API
- Confirm requisition fulfillment
- Handle requisition cancellation
Duchy Integration
Fulfills data requisitions from Duchies: Requisition Flow:- Kingdom creates requisition and assigns to EDP
- EDP Aggregator fetches requisition from Kingdom
- EDP Aggregator prepares encrypted sketch
- EDP Aggregator uploads to Duchy Requisition Fulfillment Server
- Duchy confirms receipt with Kingdom
Monitoring and Operations
Metrics
Event Groups
Number of registered and active event groups
Data Availability
Coverage of available encrypted event data
Requisition Fulfillment
Success rate and latency of requisition processing
Storage Usage
Encrypted event data storage consumption
Health Checks
Both servers expose:- gRPC health check service
- HTTP health endpoint on port 8080
- Kubernetes readiness and liveness probes
Logging
Configurable verbose logging:Operational Considerations
Scalability
- Internal API Server: Scale based on database load
- System API Server: Scale based on Kingdom/Duchy request volume
- Background functions: Serverless auto-scaling
High Availability
- Multiple replicas of API servers
- Spanner provides built-in HA
- Cloud Functions automatically retried
Disaster Recovery
- Spanner automatic backup and point-in-time recovery
- Encrypted event data in durable cloud storage
- Configuration in version control
Next Steps
Privacy Budget Manager
Learn about privacy budget enforcement
Duchy Services
Understand how Duchies receive EDP data
Kingdom Services
Explore Kingdom’s role in coordinating EDPs