-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename SlotSignal to SnapshotSignal and use errgroup for better error
handling Also move errors to a channel to make it clearer to wait for errors.
- Loading branch information
1 parent
4bc7879
commit d6796fc
Showing
6 changed files
with
35 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
package connpostgres | ||
|
||
type SlotCreationResult struct { | ||
type SnapshotCreationResult struct { | ||
SlotName string | ||
SnapshotName string | ||
Err error | ||
} | ||
|
||
// This struct contains two signals. | ||
// 1. SlotCreated - this can be waited on to ensure that the slot has been created. | ||
// 2. CloneComplete - which can be waited on to ensure that the clone has completed. | ||
type SlotSignal struct { | ||
SlotCreated chan SlotCreationResult | ||
type SnapshotSignal struct { | ||
SlotCreated chan SnapshotCreationResult | ||
CloneComplete chan struct{} | ||
Error chan error | ||
} | ||
|
||
// NewSlotSignal returns a new SlotSignal. | ||
func NewSlotSignal() SlotSignal { | ||
return SlotSignal{ | ||
SlotCreated: make(chan SlotCreationResult, 1), | ||
// NewSnapshotSignal returns a new SlotSignal. | ||
func NewSnapshotSignal() SnapshotSignal { | ||
return SnapshotSignal{ | ||
SlotCreated: make(chan SnapshotCreationResult, 1), | ||
CloneComplete: make(chan struct{}, 1), | ||
Error: make(chan error, 1), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters