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:
James Shubin
2016-08-30 03:44:02 -04:00
parent 6bf32c978a
commit f5fb135793
2 changed files with 34 additions and 17 deletions

View File

@@ -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