29 lines
663 B
Go
29 lines
663 B
Go
package cluster
|
|
|
|
import "time"
|
|
|
|
// ClusterBuilder is used to build a Cluster object, which can then be used
|
|
type ClusterBuilder struct {
|
|
cluster *Cluster
|
|
}
|
|
|
|
// New starts the builder pattern for the Cluster.
|
|
// Sets the default interval time to 30 seconds.
|
|
func New() *ClusterBuilder {
|
|
return &ClusterBuilder{
|
|
cluster: &Cluster{
|
|
interval: time.Duration(time.Second * 30),
|
|
},
|
|
}
|
|
}
|
|
|
|
// SetInterval sets the check interval of the Cluster being built.
|
|
func (c *ClusterBuilder) SetInterval(i time.Duration) *ClusterBuilder {
|
|
c.cluster.interval = i
|
|
return c
|
|
}
|
|
// Build retuns the built cluster
|
|
func (c *ClusterBuilder) Build() *Cluster {
|
|
return c.cluster
|
|
}
|