storagenode: wallet features
WHAT: updated dashboard type to return wallet features from storagenode api Change-Id: Ifdbdeae8b9ae239eaebe32d0a093557154f777ad
This commit is contained in:
parent
3e37d1e71c
commit
034eb2c214
@ -32,6 +32,7 @@ import (
|
||||
"storj.io/storj/storagenode/gracefulexit"
|
||||
"storj.io/storj/storagenode/monitor"
|
||||
"storj.io/storj/storagenode/nodestats"
|
||||
"storj.io/storj/storagenode/operator"
|
||||
"storj.io/storj/storagenode/orders"
|
||||
"storj.io/storj/storagenode/pieces"
|
||||
"storj.io/storj/storagenode/piecestore"
|
||||
@ -125,7 +126,7 @@ func (planet *Planet) newStorageNode(ctx context.Context, prefix string, index,
|
||||
Preflight: preflight.Config{
|
||||
LocalTimeCheck: false,
|
||||
},
|
||||
Operator: storagenode.OperatorConfig{
|
||||
Operator: operator.Config{
|
||||
Email: prefix + "@mail.test",
|
||||
Wallet: "0x" + strings.Repeat("00", 20),
|
||||
WalletFeatures: nil,
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"storj.io/storj/private/version/checker"
|
||||
"storj.io/storj/storagenode/bandwidth"
|
||||
"storj.io/storj/storagenode/contact"
|
||||
"storj.io/storj/storagenode/operator"
|
||||
"storj.io/storj/storagenode/payouts/estimatedpayouts"
|
||||
"storj.io/storj/storagenode/pieces"
|
||||
"storj.io/storj/storagenode/pricing"
|
||||
@ -57,6 +58,7 @@ type Service struct {
|
||||
allocatedDiskSpace memory.Size
|
||||
|
||||
walletAddress string
|
||||
walletFeatures operator.WalletFeatures
|
||||
startedAt time.Time
|
||||
versionInfo version.Info
|
||||
}
|
||||
@ -65,7 +67,7 @@ type Service struct {
|
||||
func NewService(log *zap.Logger, bandwidth bandwidth.DB, pieceStore *pieces.Store, version *checker.Service,
|
||||
allocatedDiskSpace memory.Size, walletAddress string, versionInfo version.Info, trust *trust.Pool,
|
||||
reputationDB reputation.DB, storageUsageDB storageusage.DB, pricingDB pricing.DB, satelliteDB satellites.DB,
|
||||
pingStats *contact.PingStats, contact *contact.Service, estimation *estimatedpayouts.Service, usageCache *pieces.BlobsUsageCache) (*Service, error) {
|
||||
pingStats *contact.PingStats, contact *contact.Service, estimation *estimatedpayouts.Service, usageCache *pieces.BlobsUsageCache, walletFeatures operator.WalletFeatures) (*Service, error) {
|
||||
if log == nil {
|
||||
return nil, errs.New("log can't be nil")
|
||||
}
|
||||
@ -116,6 +118,7 @@ func NewService(log *zap.Logger, bandwidth bandwidth.DB, pieceStore *pieces.Stor
|
||||
walletAddress: walletAddress,
|
||||
startedAt: time.Now(),
|
||||
versionInfo: versionInfo,
|
||||
walletFeatures: walletFeatures,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -132,6 +135,7 @@ type SatelliteInfo struct {
|
||||
type Dashboard struct {
|
||||
NodeID storj.NodeID `json:"nodeID"`
|
||||
Wallet string `json:"wallet"`
|
||||
WalletFeatures []string `json:"walletFeatures"`
|
||||
|
||||
Satellites []SatelliteInfo `json:"satellites"`
|
||||
|
||||
@ -154,6 +158,7 @@ func (s *Service) GetDashboardData(ctx context.Context) (_ *Dashboard, err error
|
||||
|
||||
data.NodeID = s.contact.Local().ID
|
||||
data.Wallet = s.walletAddress
|
||||
data.WalletFeatures = s.walletFeatures
|
||||
data.Version = s.versionInfo.Version
|
||||
data.StartedAt = s.startedAt
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2019 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
package storagenode
|
||||
package operator
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
@ -14,15 +14,15 @@ import (
|
||||
"storj.io/storj/private/nodeoperator"
|
||||
)
|
||||
|
||||
// OperatorConfig defines properties related to storage node operator metadata.
|
||||
type OperatorConfig struct {
|
||||
// Config defines properties related to storage node operator metadata.
|
||||
type Config struct {
|
||||
Email string `user:"true" help:"operator email address" default:""`
|
||||
Wallet string `user:"true" help:"operator wallet address" default:""`
|
||||
WalletFeatures WalletFeatures `user:"true" help:"operator wallet features" default:""`
|
||||
}
|
||||
|
||||
// Verify verifies whether operator config is valid.
|
||||
func (c OperatorConfig) Verify(log *zap.Logger) error {
|
||||
func (c Config) Verify(log *zap.Logger) error {
|
||||
if err := isOperatorEmailValid(log, c.Email); err != nil {
|
||||
return err
|
||||
}
|
@ -46,6 +46,7 @@ import (
|
||||
"storj.io/storj/storagenode/multinode"
|
||||
"storj.io/storj/storagenode/nodestats"
|
||||
"storj.io/storj/storagenode/notifications"
|
||||
"storj.io/storj/storagenode/operator"
|
||||
"storj.io/storj/storagenode/orders"
|
||||
"storj.io/storj/storagenode/payouts"
|
||||
"storj.io/storj/storagenode/payouts/estimatedpayouts"
|
||||
@ -104,7 +105,7 @@ type Config struct {
|
||||
|
||||
Preflight preflight.Config
|
||||
Contact contact.Config
|
||||
Operator OperatorConfig
|
||||
Operator operator.Config
|
||||
|
||||
// TODO: flatten storage config and only keep the new one
|
||||
Storage piecestore.OldConfig
|
||||
@ -653,6 +654,7 @@ func New(log *zap.Logger, full *identity.FullIdentity, db DB, revocationDB exten
|
||||
peer.Contact.Service,
|
||||
peer.Estimation.Service,
|
||||
peer.Storage2.BlobsCache,
|
||||
config.Operator.WalletFeatures,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, errs.Combine(err, peer.Close())
|
||||
|
Loading…
Reference in New Issue
Block a user