func (s *Storage) Close(ctx context.Context) error {
	if s == nil {
		return nil
	}
	return s.db.Close()
}
Close is a function which uses a specific persistance layer,
bolt, and call its Close() function on the set Storage object
package main
import (
	"context"
	"encoding/json"
	"errors"
	"log"
	"time"
	"github.com/Comcast/sheens/core"
	"github.com/Comcast/sheens/crew"
	"github.com/Comcast/sheens/match"
	. "github.com/Comcast/sheens/util/testutil"
	bolt "go.etcd.io/bbolt"
)
type MachineState struct {
	Mid string `json:"id,omitempty"`
	SpecSource *crew.SpecSource `json:"spec,omitempty" yaml:"spec,omitempty"`
	NodeName   string           `json:"node"`
	Bs         match.Bindings   `json:"bs"`
	Deleted bool `json:"-" yaml:"-"`
}
func AsMachinesStates(changes map[string]*core.State) []*MachineState {
	acc := make([]*MachineState, 0, len(changes))
	for mid, s := range changes {
		ms := &MachineState{
			Mid:      mid,
			NodeName: s.NodeName,
			Bs:       s.Bs,
		}
		acc = append(acc, ms)
	}
	return acc
}
func AsMachines(mss []*MachineState) map[string]*crew.Machine {
	acc := make(map[string]*crew.Machine, len(mss))
	for _, ms := range mss {
		m := &crew.Machine{
			Id: ms.Mid,
			State: &core.State{
				NodeName: ms.NodeName,
				Bs:       ms.Bs,
			},
			SpecSource: ms.SpecSource,
		}
		acc[ms.Mid] = m
	}
	return acc
}
type Storage struct {
	Debug    bool
	filename string
	db       *bolt.DB
}
func NewStorage(filename string) (*Storage, error) {
	return &Storage{
		filename: filename,
	}, nil
}
func (s *Storage) Open(ctx context.Context) error {
	opts := &bolt.Options{
		Timeout: time.Second,
	}
	db, err := bolt.Open(s.filename, 0644, opts)
	if err != nil {
		return err
	}
	s.db = db
	return nil
}