working toward storing state in db

This commit is contained in:
2020-03-27 16:02:36 -07:00
parent 4f654a9423
commit 23c1b08798
14 changed files with 553 additions and 193 deletions

View File

@@ -1,20 +1,24 @@
package instance
import "encoding/json"
import "fmt"
import "io/ioutil"
import "net/http"
import "strings"
import "sync"
import "time"
import "errors"
import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strings"
"sync"
"time"
"git.eeqj.de/sneak/feta/jsonapis"
"git.eeqj.de/sneak/feta/storage"
"git.eeqj.de/sneak/feta/toot"
"github.com/google/uuid"
"github.com/looplab/fsm"
"github.com/rs/zerolog/log"
)
//import "github.com/gin-gonic/gin"
import "github.com/looplab/fsm"
import "github.com/rs/zerolog/log"
import "git.eeqj.de/sneak/feta/storage"
import "git.eeqj.de/sneak/feta/toot"
import "git.eeqj.de/sneak/feta/jsonapis"
const nodeInfoSchemaVersionTwoName = "http://nodeinfo.diaspora.software/ns/schema/2.0"
const instanceNodeinfoTimeout = time.Second * 50
@@ -36,6 +40,7 @@ const (
// Instance stores all the information we know about an instance
type Instance struct {
Identifier uuid.UUID
structLock sync.Mutex
tootDestination chan *toot.Toot
ErrorCount uint
@@ -44,6 +49,7 @@ type Instance struct {
Hostname string
Identified bool
fetching bool
disabled bool
implementation instanceImplementation
storageBackend *storage.TootStorageBackend
NextFetch time.Time