profile

package
v0.5.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AutoProfileName is the name of the automatic profile.
	AutoProfileName = "auto"
	// CfgUseProfile is the key to set the profile to use.
	CfgUseProfile = "useProfile"
)

Variables

View Source
var (
	ErrNotEnoughMemory = errors.New("not enough system memory")
)
View Source
var Profile1GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		UnconfirmedTx: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 2000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
}
View Source
var Profile2GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 200,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 200,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 2500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		UnconfirmedTx: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 2500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
}
View Source
var Profile4GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		UnconfirmedTx: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
}
View Source
var Profile8GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		UnconfirmedTx: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
}

Functions

This section is empty.

Types

type CacheOpts

type CacheOpts struct {
	CacheTimeMs          uint64            `mapstructure:"cacheTimeMs"`
	LeakDetectionOptions LeakDetectionOpts `mapstructure:"leakDetection"`
}

type Caches

type Caches struct {
	Addresses                 CacheOpts `mapstructure:"addresses"`
	Bundles                   CacheOpts `mapstructure:"bundles"`
	BundleTransactions        CacheOpts `mapstructure:"bundleTransactions"`
	Approvers                 CacheOpts `mapstructure:"approvers"`
	Tags                      CacheOpts `mapstructure:"tags"`
	Milestones                CacheOpts `mapstructure:"milestones"`
	Transactions              CacheOpts `mapstructure:"transactions"`
	IncomingTransactionFilter CacheOpts `mapstructure:"incomingTransactionFilter"`
	UnconfirmedTx             CacheOpts `mapstructure:"unconfirmedTx"`
	SpentAddresses            CacheOpts `mapstructure:"spentAddresses"`
}

type LeakDetectionOpts

type LeakDetectionOpts struct {
	Enabled                bool   `mapstructure:"enabled"`
	MaxConsumersPerObject  int    `mapstructure:"maxConsumersPerObject"`
	MaxConsumerHoldTimeSec uint64 `mapstructure:"maxConsumerHoldTimeSec"`
}

type Profile

type Profile struct {
	Name   string `mapstructure:"name"`
	Caches Caches `mapstructure:"caches"`
}

func LoadProfile

func LoadProfile() *Profile

LoadProfile automatically loads the appropriate profile (given the system memory) if the config value is set to 'auto' or the one specified in the config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL