func New(daemon Daemon, options ...Option) *Schedules {
	opts := newOptions()
	for _, option := range options {
		option(opts)
	}
	return &Schedules{
		daemon: daemon,
		tasks:  make(map[string]*Task),
		clock:  opts.clock,
		logger: opts.logger,
	}
}
New creates a series of tasks to be worked on
package schedules
import (
	"context"
	"encoding/json"
	"fmt"
	"strings"
	"sync"
	"time"
	"github.com/go-kit/kit/log"
	"github.com/go-kit/kit/log/level"
	"github.com/pkg/errors"
	"github.com/spoke-d/thermionic/internal/clock"
	"github.com/spoke-d/thermionic/internal/cluster"
	"github.com/spoke-d/thermionic/internal/config"
	"github.com/spoke-d/thermionic/internal/db"
	"github.com/spoke-d/thermionic/internal/db/database"
	"github.com/spoke-d/thermionic/internal/node"
	"github.com/spoke-d/task"
	"github.com/spoke-d/thermionic/internal/tomb"
)
type Gateway interface {
	IsDatabaseNode() bool
	LeaderAddress() (string, error)
}
type Cluster interface {
	database.DBAccessor
	db.ClusterOpener
	db.ClusterTransactioner
	db.ClusterExclusiveLocker
	NodeID(int64)
	SchemaVersion() int
	Close() error
}
type Node interface {
	database.DBAccessor
	db.NodeOpener
	db.NodeTransactioner
	Dir() string
	Close() error
}
type Daemon interface {
	Gateway() Gateway
	Cluster() Cluster
	Node() Node
	NodeConfigSchema() config.Schema
}
const Interval = 20
type Schedules struct {
	daemon Daemon
	tasks  map[string]*Task
	mutex  sync.Mutex
	clock  clock.Clock
	logger log.Logger
}