chore: update renterd

This commit is contained in:
Derrick Hammer 2023-05-29 13:06:32 -04:00
parent 26042b62ac
commit 09cd274d29
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
3 changed files with 19 additions and 19 deletions

4
go.mod
View File

@ -16,9 +16,9 @@ require (
github.com/swaggo/swag v1.16.1
github.com/tus/tusd v1.11.0
gitlab.com/NebulousLabs/encoding v0.0.0-20200604091946-456c3dc907fe
go.sia.tech/core v0.1.12-0.20230503202148-581dd00ac1d2
go.sia.tech/core v0.1.12-0.20230525021639-f38630eccb9c
go.sia.tech/jape v0.9.0
go.sia.tech/renterd v0.3.0-beta.0.20230520152334-e004ada9c4e9
go.sia.tech/renterd v0.3.0-beta.0.20230526064553-cce3ae57804b
go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca
go.sia.tech/web/renterd v0.17.0
go.uber.org/zap v1.24.0

4
go.sum
View File

@ -1200,6 +1200,8 @@ go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJP
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.sia.tech/core v0.1.12-0.20230503202148-581dd00ac1d2 h1:a1UTWnPoH6Nf8Y4MrIf74jqCeMoPVmEJPoICOHqCA4o=
go.sia.tech/core v0.1.12-0.20230503202148-581dd00ac1d2/go.mod h1:D17UWSn99SEfQnEaR9G9n6Kz9+BwqMoUgZ6Cl424LsQ=
go.sia.tech/core v0.1.12-0.20230525021639-f38630eccb9c h1:rMqNjT+imVQlTJaOdndiAmPWAv05ITq1trxno9xGx5M=
go.sia.tech/core v0.1.12-0.20230525021639-f38630eccb9c/go.mod h1:D17UWSn99SEfQnEaR9G9n6Kz9+BwqMoUgZ6Cl424LsQ=
go.sia.tech/jape v0.9.0 h1:kWgMFqALYhLMJYOwWBgJda5ko/fi4iZzRxHRP7pp8NY=
go.sia.tech/jape v0.9.0/go.mod h1:4QqmBB+t3W7cNplXPj++ZqpoUb2PeiS66RLpXmEGap4=
go.sia.tech/mux v1.2.0 h1:ofa1Us9mdymBbGMY2XH/lSpY8itFsKIo/Aq8zwe+GHU=
@ -1208,6 +1210,8 @@ go.sia.tech/renterd v0.3.0-beta.0.20230516200305-8097423dbe64 h1:qA+aREwc+i8Q56F
go.sia.tech/renterd v0.3.0-beta.0.20230516200305-8097423dbe64/go.mod h1:jFxggAqLQ9fs85iLpC7s2Xnit3rTx7AajW37LgR1vQs=
go.sia.tech/renterd v0.3.0-beta.0.20230520152334-e004ada9c4e9 h1:jfxmpr/8UG9IDoU/vA4Jqq2cqWT9SsDJv06uZ48W/qs=
go.sia.tech/renterd v0.3.0-beta.0.20230520152334-e004ada9c4e9/go.mod h1:ln0uIpeEvgd0lhDx1yB2+u6WXUMermu1QO6lI96xJKI=
go.sia.tech/renterd v0.3.0-beta.0.20230526064553-cce3ae57804b h1:QNzx8mGKuMb9ftIQSsLO8HF/8QlI5/tsay+dL4/Tw3U=
go.sia.tech/renterd v0.3.0-beta.0.20230526064553-cce3ae57804b/go.mod h1:KT/DwXfKeqa9gynCxssYRFsj4/PCAd0Lre1oDJZcf7I=
go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca h1:aZMg2AKevn7jKx+wlusWQfwSM5pNU9aGtRZme29q3O4=
go.sia.tech/siad v1.5.10-0.20230228235644-3059c0b930ca/go.mod h1:h/1afFwpxzff6/gG5i1XdAgPK7dEY6FaibhK7N5F86Y=
go.sia.tech/web/renterd v0.14.0 h1:74WDPNYXk71d8uT86rkQAa7AlDp8+VDRsQ2oyhwPplg=

View File

@ -32,6 +32,7 @@ import (
type WorkerConfig struct {
ID string
AllowPrivateIPs bool
BusFlushInterval time.Duration
ContractLockTimeout time.Duration
SessionLockTimeout time.Duration
@ -50,7 +51,8 @@ type BusConfig struct {
Miner *Miner
PersistInterval time.Duration
DBDialector gorm.Dialector
DBLoggerConfig stores.LoggerConfig
DBDialector gorm.Dialector
}
type AutopilotConfig struct {
@ -96,6 +98,10 @@ func (cm chainManager) AcceptBlock(ctx context.Context, b types.Block) error {
return cm.cs.AcceptBlock(sb)
}
func (cm chainManager) LastBlockTime() time.Time {
return time.Unix(int64(cm.cs.CurrentBlock().Timestamp), 0)
}
func (cm chainManager) Synced(ctx context.Context) bool {
return cm.cs.Synced()
}
@ -227,19 +233,6 @@ func NewBus(cfg BusConfig, dir string, seed types.PrivateKey, l *zap.Logger) (ht
return nil, nil, err
}
walletDir := filepath.Join(dir, "wallet")
if err := os.MkdirAll(walletDir, 0700); err != nil {
return nil, nil, err
}
walletAddr := wallet.StandardAddress(seed.PublicKey())
ws, ccid, err := stores.NewJSONWalletStore(walletDir, walletAddr)
if err != nil {
return nil, nil, err
} else if err := cs.ConsensusSetSubscribe(ws, ccid, nil); err != nil {
return nil, nil, err
}
w := wallet.NewSingleAddressWallet(seed, ws)
// If no DB dialector was provided, use SQLite.
dbConn := cfg.DBDialector
if dbConn == nil {
@ -250,14 +243,17 @@ func NewBus(cfg BusConfig, dir string, seed types.PrivateKey, l *zap.Logger) (ht
dbConn = stores.NewSQLiteConnection(filepath.Join(dbDir, "db.sqlite"))
}
sqlLogger := stores.NewSQLLogger(l.Named("db"), nil)
sqlStore, ccid, err := stores.NewSQLStore(dbConn, true, cfg.PersistInterval, sqlLogger)
sqlLogger := stores.NewSQLLogger(l.Named("db"), cfg.DBLoggerConfig)
walletAddr := wallet.StandardAddress(seed.PublicKey())
sqlStore, ccid, err := stores.NewSQLStore(dbConn, true, cfg.PersistInterval, walletAddr, sqlLogger)
if err != nil {
return nil, nil, err
} else if err := cs.ConsensusSetSubscribe(sqlStore, ccid, nil); err != nil {
return nil, nil, err
}
w := wallet.NewSingleAddressWallet(seed, sqlStore)
if m := cfg.Miner; m != nil {
if err := cs.ConsensusSetSubscribe(m, ccid, nil); err != nil {
return nil, nil, err
@ -284,7 +280,7 @@ func NewBus(cfg BusConfig, dir string, seed types.PrivateKey, l *zap.Logger) (ht
func NewWorker(cfg WorkerConfig, b worker.Bus, seed types.PrivateKey, l *zap.Logger) (http.Handler, ShutdownFn, error) {
workerKey := blake2b.Sum256(append([]byte("worker"), seed...))
w, err := worker.New(workerKey, cfg.ID, b, cfg.ContractLockTimeout, cfg.SessionLockTimeout, cfg.SessionReconnectTimeout, cfg.SessionTTL, cfg.BusFlushInterval, cfg.DownloadSectorTimeout, cfg.UploadSectorTimeout, cfg.DownloadMaxOverdrive, cfg.UploadMaxOverdrive, l)
w, err := worker.New(workerKey, cfg.ID, b, cfg.ContractLockTimeout, cfg.SessionLockTimeout, cfg.SessionReconnectTimeout, cfg.SessionTTL, cfg.BusFlushInterval, cfg.DownloadSectorTimeout, cfg.UploadSectorTimeout, cfg.DownloadMaxOverdrive, cfg.UploadMaxOverdrive, cfg.AllowPrivateIPs, l)
if err != nil {
return nil, nil, err
}