Implement graceful shutdown of agent.DataAccess (#1008)

* Implements graceful shutdown of agent.DataAccess and underlying Datastore/Logstore/MessageQueue

* adds tests for closing agent.DataAccess and Datastore
This commit is contained in:
Gerardo Viedma
2018-05-21 11:28:21 +01:00
committed by GitHub
parent 105d9b8f1d
commit ea1f94253f
19 changed files with 180 additions and 12 deletions

View File

@@ -30,4 +30,8 @@ type LogStore interface {
// GetCalls returns a list of calls that satisfy the given CallFilter. If no
// calls exist, an empty list and a nil error are returned.
GetCalls(ctx context.Context, filter *CallFilter) ([]*Call, error)
// Close will close any underlying connections as needed.
// Close is not safe to be called from multiple threads.
io.Closer
}

View File

@@ -1,6 +1,9 @@
package models
import "context"
import (
"context"
"io"
)
// Message Queue is used to impose a total ordering on jobs that it will
// execute in order. calls are added to the queue via the Push() interface. The
@@ -49,4 +52,8 @@ type MessageQueue interface {
// the job does not have an outstanding reservation, error. If a job did not
// exist, succeed.
Delete(context.Context, *Call) error
// Close will close any underlying connections as needed.
// Close is not safe to be called from multiple threads.
io.Closer
}