save checkpoint every 2 seconds

This commit is contained in:
chrislu committed 2025-10-13 23:03:16 -07:00
1 parent 233ade4187
commit 2ff548a41d
4 files changed
+97 -47

No files matched your search

+7
View File
@@ -12,6 +12,7 @@ import (
// SMQOffsetIntegration provides integration between offset management and SMQ broker
type SMQOffsetIntegration struct {
mu sync.RWMutex
registry *PartitionOffsetRegistry
offsetAssigner *OffsetAssigner
offsetSubscriber *OffsetSubscriber
offsetSeeker *OffsetSeeker
@@ -23,12 +24,18 @@ func NewSMQOffsetIntegration(storage OffsetStorage) *SMQOffsetIntegration {
assigner := &OffsetAssigner{registry: registry}
return &SMQOffsetIntegration{
registry: registry,
offsetAssigner: assigner,
offsetSubscriber: NewOffsetSubscriber(registry),
offsetSeeker: NewOffsetSeeker(registry),
}
}
// Close stops all background checkpoint goroutines and performs final checkpoints
func (integration *SMQOffsetIntegration) Close() error {
return integration.registry.Close()
}
// PublishRecord publishes a record and assigns it an offset
func (integration *SMQOffsetIntegration) PublishRecord(
namespace, topicName string,