2018-06-12 23:12:59 +00:00
|
|
|
// Package params defines important configuration options to be used when instantiating
|
|
|
|
// objects within the sharding package. For example, it defines objects such as a
|
2018-06-13 17:37:23 +00:00
|
|
|
// Config that will be useful when creating new shard instances.
|
2018-06-12 23:12:59 +00:00
|
|
|
package params
|
|
|
|
|
|
|
|
import (
|
2018-07-23 16:29:00 +00:00
|
|
|
"math"
|
2018-07-27 00:29:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// DefaultConfig returns pointer to a Config value with same defaults.
|
|
|
|
func DefaultConfig() *Config {
|
|
|
|
return &Config{
|
2018-08-13 21:04:03 +00:00
|
|
|
CollationSizeLimit: DefaultCollationSizeLimit(),
|
2018-09-27 02:34:35 +00:00
|
|
|
SlotDuration: 8.0,
|
2018-10-02 00:54:45 +00:00
|
|
|
CycleLength: 64,
|
2018-07-27 00:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-10-02 18:34:26 +00:00
|
|
|
// DemoConfig for running the system under shorter defaults.
|
|
|
|
func DemoConfig() *Config {
|
|
|
|
return &Config{
|
2018-10-23 16:07:43 +00:00
|
|
|
SlotDuration: 2.0,
|
2018-10-02 18:34:26 +00:00
|
|
|
CycleLength: 5,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-29 01:18:56 +00:00
|
|
|
// DefaultCollationSizeLimit is the integer value representing the maximum
|
|
|
|
// number of bytes allowed in a given collation.
|
2018-07-27 00:29:28 +00:00
|
|
|
func DefaultCollationSizeLimit() int64 {
|
|
|
|
return int64(math.Pow(float64(2), float64(20)))
|
2018-06-12 23:12:59 +00:00
|
|
|
}
|
|
|
|
|
2018-06-13 17:37:23 +00:00
|
|
|
// Config contains configs for node to participate in the sharded universe.
|
|
|
|
type Config struct {
|
2018-10-14 15:29:57 +00:00
|
|
|
CollationSizeLimit int64 // CollationSizeLimit is the maximum size the serialized blobs in a collation can take.
|
|
|
|
SlotDuration uint64 // SlotDuration in seconds.
|
2018-09-27 02:34:35 +00:00
|
|
|
CycleLength uint64
|
2018-06-12 23:12:59 +00:00
|
|
|
}
|