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

@@ -4,16 +4,17 @@ import (
"log"
"github.com/docker/docker/api/types/swarm"
"github.com/play-with-docker/play-with-docker/pwd/types"
)
type checkSwarmStatusTask struct {
}
func (c checkSwarmStatusTask) Run(i *Instance) error {
if i.docker == nil {
func (c checkSwarmStatusTask) Run(i *types.Instance) error {
if i.Docker == nil {
return nil
}
if info, err := i.docker.GetDaemonInfo(); err == nil {
if info, err := i.Docker.GetDaemonInfo(); err == nil {
if info.Swarm.LocalNodeState != swarm.LocalNodeStateInactive && info.Swarm.LocalNodeState != swarm.LocalNodeStateLocked {
i.IsManager = &info.Swarm.ControlAvailable
} else {