Storage has now it's own package.

Remove global `sessions` map and use configured storage.
Add a `types` package so both `pwd` and `storage` can access without
circular dependencies.
Now the session is prepared when requested and not on load.
This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-06-14 18:35:21 -03:00
parent 2eff799c58
commit e9911abf94
22 changed files with 814 additions and 499 deletions

View File

@@ -1,16 +1,18 @@
package pwd
import "github.com/play-with-docker/play-with-docker/pwd/types"
type mockTasks struct {
schedule func(s *Session)
unschedule func(s *Session)
schedule func(s *types.Session)
unschedule func(s *types.Session)
}
func (m *mockTasks) Schedule(s *Session) {
func (m *mockTasks) Schedule(s *types.Session) {
if m.schedule != nil {
m.schedule(s)
}
}
func (m *mockTasks) Unschedule(s *Session) {
func (m *mockTasks) Unschedule(s *types.Session) {
if m.unschedule != nil {
m.unschedule(s)
}