Skip to content
Snippets Groups Projects
Select Git revision
  • manage_sherd_folders
  • master default protected
  • host_financial_metrics
  • err-not-found
  • debug_maxcollateral_zero
  • add_providerlist_in_host_api
  • wallet_start_if_transporter_unavail
  • test-forks
  • debug-prints
  • disable_old_tls
  • wallet-improve-defrag
  • 231-reject-zero-storageprice-setting
  • client-ctx
  • fork2-spfb-geo-review
  • attach-bad-file-size-logs
  • renewal-debug-logs
  • create_sectorfile_as_sparse
  • cakiwi-changes-1
  • 216-externalize-build-tags
  • new-ci-integration
  • v1.9.3
  • v1.9.2
  • v1.9.1
  • v1.9.0
  • v1.8.4
  • v1.8.3
  • v1.8.0
  • v1.7.2
  • v1.7.1
  • v1.7.0
  • v1.6.6
  • v1.6.5
  • v1.6.4
  • v1.6.3.1
  • v1.6.3
  • v1.6.2
  • 1.6.1
  • v1.6.0
  • v1.5.3
  • v1.5.2
40 results

renter.go

Code owners
Assign users and groups as approvers for specific file changes. Learn more.
renter.go 3.87 KiB
package dependencies

import (
	"sync"

	"gitlab.com/scpcorp/ScPrime/modules"
)

// DependencyTimeoutProjectDownloadByRoot immediately times out projects that
// try to download a sector by its root.
type DependencyTimeoutProjectDownloadByRoot struct {
	modules.ProductionDependencies
}

// Disrupt forces an immediate timeout for DownloadByRoot projects.
func (d *DependencyTimeoutProjectDownloadByRoot) Disrupt(s string) bool {
	return s == "timeoutProjectDownloadByRoot"
}

// DependencyDisableCloseUploadEntry prevents SiaFileEntries in the upload code
// from being closed.
type DependencyDisableCloseUploadEntry struct {
	modules.ProductionDependencies
}

// Disrupt prevents SiafileEntries in the upload code from being closed.
func (d *DependencyDisableCloseUploadEntry) Disrupt(s string) bool {
	return s == "disableCloseUploadEntry"
}

// DependencyDisableRepairAndHealthLoops prevents the background loops for
// repairs and updating directory metadata from running. This includes
// threadedUploadAndRepair, threadedStuckLoop, and threadedUpdateRenterHealth
type DependencyDisableRepairAndHealthLoops struct {
	modules.ProductionDependencies
}

// Disrupt will prevent the repair and health loops from running
func (d *DependencyDisableRepairAndHealthLoops) Disrupt(s string) bool {
	return s == "DisableRepairAndHealthLoops"
}

// DependencyAddUnrepairableChunks will have the repair loop always add chunks
// to the upload heap even if they are unrepairable
type DependencyAddUnrepairableChunks struct {
	modules.ProductionDependencies
}

// Disrupt will prevent the repair and health loops from running
func (d *DependencyAddUnrepairableChunks) Disrupt(s string) bool {
	return s == "DisableRepairAndHealthLoops" || s == "AddUnrepairableChunks"
}

// DependencyFailUploadStreamFromReader prevents SiaFileEntries in the upload code
// from being closed.
type DependencyFailUploadStreamFromReader struct {
	modules.ProductionDependencies
}

// Disrupt prevents SiafileEntries in the upload code from being closed.
func (d *DependencyFailUploadStreamFromReader) Disrupt(s string) bool {
	return s == "failUploadStreamFromReader"
}

// DependencyDisableUploadGougingCheck ignores the upload gouging check
type DependencyDisableUploadGougingCheck struct {
	modules.ProductionDependencies
}

// Disrupt will prevent the uploads to fail due to upload gouging
func (d *DependencyDisableUploadGougingCheck) Disrupt(s string) bool {
	return s == "DisableUploadGouging"
}

// DependencyToggleWatchdogBroadcast can toggle the watchdog's ability to
// broadcast transactions.
type DependencyToggleWatchdogBroadcast struct {
	mu                 sync.Mutex
	broadcastsDisabled bool
	modules.ProductionDependencies
}

// DisableWatchdogBroadcast will prevent the watchdog from broadcating
// transactions.
func (d *DependencyToggleWatchdogBroadcast) DisableWatchdogBroadcast(disable bool) {
	d.mu.Lock()
	d.broadcastsDisabled = disable
	d.mu.Unlock()
}

// Disrupt will prevent watchdog from rebroadcasting transactions when
// broadcasting is disabled.
func (d *DependencyToggleWatchdogBroadcast) Disrupt(s string) bool {
	d.mu.Lock()
	disabled := d.broadcastsDisabled
	d.mu.Unlock()

	return disabled && (s == "DisableWatchdogBroadcast")
}

// DependencyHighMinHostScore returns high minimum-allowed host score for GFR to
// help simulate churn related to low scoring hosts.
type DependencyHighMinHostScore struct {
	mu                  sync.Mutex
	forcingHighMinScore bool
	modules.ProductionDependencies
}

// Disrupt causes a high min-score for GFR to be returned.
func (d *DependencyHighMinHostScore) Disrupt(s string) bool {
	d.mu.Lock()
	forcingHighMinScore := d.forcingHighMinScore
	d.mu.Unlock()
	return forcingHighMinScore && s == "HighMinHostScore"
}

// ForceHighMinHostScore causes the dependency disrupt to activate.
func (d *DependencyHighMinHostScore) ForceHighMinHostScore(force bool) {
	d.mu.Lock()
	d.forcingHighMinScore = force
	d.mu.Unlock()
}