converger: Update the API for errors and naming
We updated the API and behaviour to make two changes: 1) We remove the log.* stuff, and replace the Fatal calls with straight calls to panic(). These are meant to be like an assert, and shouldn't happen unless there is a user error or a bug. 2) We made the !uuid.IsValid() checks return an error instead of causing a panic. These returns errors instead, and makes the process safer for users who are okay calling a function that won't have an effect.
This commit is contained in:
2
etcd.go
2
etcd.go
@@ -678,6 +678,7 @@ func (obj *EmbdEtcd) CtxError(ctx context.Context, err error) (context.Context,
|
||||
// CbLoop is the loop where callback execution is serialized
|
||||
func (obj *EmbdEtcd) CbLoop() {
|
||||
cuuid := obj.converger.Register()
|
||||
cuuid.SetName("Etcd: CbLoop")
|
||||
defer cuuid.Unregister()
|
||||
if e := obj.Connect(false); e != nil {
|
||||
return // fatal
|
||||
@@ -731,6 +732,7 @@ func (obj *EmbdEtcd) CbLoop() {
|
||||
// Loop is the main loop where everything is serialized
|
||||
func (obj *EmbdEtcd) Loop() {
|
||||
cuuid := obj.converger.Register()
|
||||
cuuid.SetName("Etcd: Loop")
|
||||
defer cuuid.Unregister()
|
||||
if e := obj.Connect(false); e != nil {
|
||||
return // fatal
|
||||
|
||||
Reference in New Issue
Block a user