// 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 }
// 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 }