Add missing doc in delta

This commit is contained in:
Eric Lippmann 2021-06-23 09:33:23 +02:00
parent 1fda4ea6ee
commit fc5e2882ff

View file

@ -12,6 +12,7 @@ import (
"time"
)
// Delta calculates the delta of actual and desired entities, and stores which entities need to be created, updated, and deleted.
type Delta struct {
Create EntitiesById
Update EntitiesById
@ -21,6 +22,7 @@ type Delta struct {
logger *zap.SugaredLogger
}
// NewDelta creates a new Delta and starts calculating it.
func NewDelta(ctx context.Context, actual, desired <-chan contracts.Entity, subject *common.SyncSubject, logger *zap.SugaredLogger) *Delta {
delta := &Delta{
Subject: subject,
@ -33,6 +35,7 @@ func NewDelta(ctx context.Context, actual, desired <-chan contracts.Entity, subj
return delta
}
// Wait waits for the delta calculation to complete and returns an error, if any.
func (delta *Delta) Wait() error {
return <-delta.done
}