Skip to content

Commit

Permalink
remove registry
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Mar 6, 2024
1 parent 700905d commit 869754f
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 746 deletions.
8 changes: 0 additions & 8 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ const (
settingIngressPrice = "ingressPrice"
settingIngressLimit = "ingressLimit"
settingEgressLimit = "egressLimit"
settingMaxRegistryEntries = "maxRegistryEntries"
settingAccountExpiry = "accountExpiry"
settingPriceTableValidity = "priceTableValidity"
)
Expand Down Expand Up @@ -319,13 +318,6 @@ func SetEgressLimit(limit uint64) Setting {
}
}

// SetMaxRegistryEntries sets the MaxRegistryEntries field of the request
func SetMaxRegistryEntries(value uint64) Setting {
return func(v map[string]any) {
v[settingMaxRegistryEntries] = value
}
}

// SetAccountExpiry sets the AccountExpiry field of the request
func SetAccountExpiry(value time.Duration) Setting {
return func(v map[string]any) {
Expand Down
11 changes: 3 additions & 8 deletions cmd/hostd/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"go.sia.tech/hostd/host/accounts"
"go.sia.tech/hostd/host/contracts"
"go.sia.tech/hostd/host/metrics"
"go.sia.tech/hostd/host/registry"
"go.sia.tech/hostd/host/settings"
"go.sia.tech/hostd/host/storage"
"go.sia.tech/hostd/internal/chain"
Expand Down Expand Up @@ -42,7 +41,6 @@ type node struct {
settings *settings.ConfigManager
accounts *accounts.AccountManager
contracts *contracts.ContractManager
registry *registry.Manager
storage *storage.VolumeManager

sessions *rhp.SessionReporter
Expand All @@ -55,7 +53,6 @@ func (n *node) Close() error {
n.rhp3.Close()
n.rhp2.Close()
n.data.Close()
n.registry.Close()
n.storage.Close()
n.contracts.Close()
n.w.Close()
Expand All @@ -76,8 +73,8 @@ func startRHP2(l net.Listener, hostKey types.PrivateKey, rhp3Addr string, cs rhp
return rhp2, nil
}

func startRHP3(l net.Listener, hostKey types.PrivateKey, cs rhp3.ChainManager, tp rhp3.TransactionPool, w rhp3.Wallet, am rhp3.AccountManager, cm rhp3.ContractManager, rm rhp3.RegistryManager, sr rhp3.SettingsReporter, sm rhp3.StorageManager, monitor rhp.DataMonitor, sessions *rhp.SessionReporter, log *zap.Logger) (*rhp3.SessionHandler, error) {
rhp3, err := rhp3.NewSessionHandler(l, hostKey, cs, tp, w, am, cm, rm, sm, sr, monitor, sessions, log)
func startRHP3(l net.Listener, hostKey types.PrivateKey, cs rhp3.ChainManager, tp rhp3.TransactionPool, w rhp3.Wallet, am rhp3.AccountManager, cm rhp3.ContractManager, sr rhp3.SettingsReporter, sm rhp3.StorageManager, monitor rhp.DataMonitor, sessions *rhp.SessionReporter, log *zap.Logger) (*rhp3.SessionHandler, error) {
rhp3, err := rhp3.NewSessionHandler(l, hostKey, cs, tp, w, am, cm, sm, sr, monitor, sessions, log)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -186,7 +183,6 @@ func newNode(walletKey types.PrivateKey, logger *zap.Logger) (*node, types.Priva
if err != nil {
return nil, types.PrivateKey{}, fmt.Errorf("failed to create contract manager: %w", err)
}
registryManager := registry.NewManager(hostKey, db, logger.Named("registry"))

sessions := rhp.NewSessionReporter()

Expand All @@ -196,7 +192,7 @@ func newNode(walletKey types.PrivateKey, logger *zap.Logger) (*node, types.Priva
return nil, types.PrivateKey{}, fmt.Errorf("failed to start rhp2: %w", err)
}

rhp3, err := startRHP3(rhp3Listener, hostKey, cm, tp, w, accountManager, contractManager, registryManager, sr, sm, dm, sessions, logger.Named("rhp3"))
rhp3, err := startRHP3(rhp3Listener, hostKey, cm, tp, w, accountManager, contractManager, sr, sm, dm, sessions, logger.Named("rhp3"))
if err != nil {
return nil, types.PrivateKey{}, fmt.Errorf("failed to start rhp3: %w", err)
}
Expand All @@ -215,7 +211,6 @@ func newNode(walletKey types.PrivateKey, logger *zap.Logger) (*node, types.Priva
accounts: accountManager,
contracts: contractManager,
storage: sm,
registry: registryManager,

sessions: sessions,
data: dm,
Expand Down
10 changes: 1 addition & 9 deletions host/accounts/budget.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ type (
StorageRevenue types.Currency `json:"storage"`
EgressRevenue types.Currency `json:"egress"`
IngressRevenue types.Currency `json:"ingress"`
RegistryRead types.Currency `json:"registryRead"`
RegistryWrite types.Currency `json:"registryWrite"`
}

// A Budget transactionally manages an account's balance. It is not safe for
Expand All @@ -34,9 +32,7 @@ func (u Usage) Total() types.Currency {
return u.RPCRevenue.
Add(u.StorageRevenue).
Add(u.EgressRevenue).
Add(u.IngressRevenue).
Add(u.RegistryRead).
Add(u.RegistryWrite)
Add(u.IngressRevenue)
}

// Add returns the sum of two Usages.
Expand All @@ -46,8 +42,6 @@ func (a Usage) Add(b Usage) Usage {
StorageRevenue: a.StorageRevenue.Add(b.StorageRevenue),
EgressRevenue: a.EgressRevenue.Add(b.EgressRevenue),
IngressRevenue: a.IngressRevenue.Add(b.IngressRevenue),
RegistryRead: a.RegistryRead.Add(b.RegistryRead),
RegistryWrite: a.RegistryWrite.Add(b.RegistryWrite),
}
}

Expand All @@ -58,8 +52,6 @@ func (a Usage) Sub(b Usage) Usage {
StorageRevenue: a.StorageRevenue.Sub(b.StorageRevenue),
EgressRevenue: a.EgressRevenue.Sub(b.EgressRevenue),
IngressRevenue: a.IngressRevenue.Sub(b.IngressRevenue),
RegistryRead: a.RegistryRead.Sub(b.RegistryRead),
RegistryWrite: a.RegistryWrite.Sub(b.RegistryWrite),
}
}

Expand Down
4 changes: 0 additions & 4 deletions host/contracts/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ type (
StorageRevenue types.Currency `json:"storage"`
EgressRevenue types.Currency `json:"egress"`
IngressRevenue types.Currency `json:"ingress"`
RegistryRead types.Currency `json:"registryRead"`
RegistryWrite types.Currency `json:"registryWrite"`
AccountFunding types.Currency `json:"accountFunding"`
RiskedCollateral types.Currency `json:"riskedCollateral"`
}
Expand Down Expand Up @@ -173,8 +171,6 @@ func (u Usage) Add(b Usage) (c Usage) {
IngressRevenue: u.IngressRevenue.Add(b.IngressRevenue),
AccountFunding: u.AccountFunding.Add(b.AccountFunding),
RiskedCollateral: u.RiskedCollateral.Add(b.RiskedCollateral),
RegistryRead: u.RegistryRead.Add(b.RegistryRead),
RegistryWrite: u.RegistryWrite.Add(b.RegistryWrite),
}
}

Expand Down
20 changes: 4 additions & 16 deletions host/metrics/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ const (
type (
// Revenue is a collection of metrics related to revenue.
Revenue struct {
RPC types.Currency `json:"rpc"`
Storage types.Currency `json:"storage"`
Ingress types.Currency `json:"ingress"`
Egress types.Currency `json:"egress"`
RegistryRead types.Currency `json:"registryRead"`
RegistryWrite types.Currency `json:"registryWrite"`
RPC types.Currency `json:"rpc"`
Storage types.Currency `json:"storage"`
Ingress types.Currency `json:"ingress"`
Egress types.Currency `json:"egress"`
}

// DataMetrics is a collection of metrics related to data usage.
Expand Down Expand Up @@ -71,15 +69,6 @@ type (
CollateralMultiplier float64 `json:"collateralMultiplier"`
}

// Registry is a collection of metrics related to the host's registry.
Registry struct {
Entries uint64 `json:"entries"`
MaxEntries uint64 `json:"maxEntries"`

Reads uint64 `json:"reads"`
Writes uint64 `json:"writes"`
}

// Storage is a collection of metrics related to storage.
Storage struct {
TotalSectors uint64 `json:"totalSectors"`
Expand Down Expand Up @@ -108,7 +97,6 @@ type (
Pricing Pricing `json:"pricing"`
Contracts Contracts `json:"contracts"`
Storage Storage `json:"storage"`
Registry Registry `json:"registry"`
Data DataMetrics `json:"data"`
Balance types.Currency `json:"balance"`
Timestamp time.Time `json:"timestamp"`
Expand Down
67 changes: 0 additions & 67 deletions host/registry/recorder.go

This file was deleted.

131 changes: 0 additions & 131 deletions host/registry/registry.go

This file was deleted.

Loading

0 comments on commit 869754f

Please sign in to comment.