예제 #1
0
파일: heart.go 프로젝트: runcnc/iris
// Creates a new heartbeat mechanism.
func newHeart(o *Overlay) *heartbeat {
	// Initialize a new heartbeat mechanism
	h := &heartbeat{
		owner: o,
	}
	// Insert the internal beater and return
	h.heart = heart.New(config.PastryBeatPeriod, config.PastryKillCount, h)

	return h
}
예제 #2
0
// Creates a new scribe overlay.
func New(overId string, key *rsa.PrivateKey, app Callback) *Overlay {
	// Create and initialize the overlay
	o := &Overlay{
		app:    app,
		topics: make(map[string]*topic.Topic),
		names:  make(map[string]string),
	}
	o.pastry = pastry.New(overId, key, o)
	o.heart = heart.New(config.ScribeBeatPeriod, config.ScribeKillCount, o)
	return o
}