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-21 14:32:20 +00:00
|
|
|
SlotDuration: 8,
|
2018-07-27 00:29:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-08-13 21:04:03 +00:00
|
|
|
CollationSizeLimit int64 // CollationSizeLimit is the maximum size the serialized blobs in a collation can take.
|
2018-09-21 14:32:20 +00:00
|
|
|
SlotDuration int // SlotDuration in seconds.
|
2018-06-12 23:12:59 +00:00
|
|
|
}
|