// NewLocus creates a new locus device. func NewLocus(kin *kinfolk.Kin, kinJoin, kinLeave <-chan kinfolk.KinXID) XLocus { locus := &Locus{ tube: tube.New(kin, "locus"), Peer: &Peer{ // It is crucial to use permanent cross-references, and not // "plain" ones within values stored inside the tube table. If // cross-references are used, they are managed by the cross- // garbage collection system and therefore connections to ALL // underlying workers are maintained superfluously. Kin: kin.XID(), Term: anchor.NewTerm(kin.XID().ID.String()), }, } go loopJoin(kinJoin) go locus.loopLeave(kinLeave) go locus.loopExpire() //log.Println(locus.Peer.Key()) return XLocus{locus} }