Example #1
0
func New(kin *tissue.Kin) Server {
	return &server{
		addr:   kin.Avatar().X.Addr().String(),
		kin:    kin,
		joined: time.Now(),
	}
}
Example #2
0
// NewTube…
func NewTube(kin *tissue.Kin, topic string) *Tube {
	t := &Tube{view: NewView()}
	t.av = tissue.FolkAvatar{
		X:  circuit.PermRef(XTube{t}),
		ID: lang.ComputeReceiverID(t),
	}
	t.folk = kin.Attach(topic, t.av)
	go func() {
		for {
			// Consume identities of new downstream nodes
			t.superscribe(t.folk.Replenish())
		}
	}()
	return t
}
Example #3
0
// NewLocus creates a new locus device.
func NewLocus(kin *tissue.Kin, rip <-chan tissue.KinAvatar) XLocus {
	locus := &Locus{
		tube: tube.NewTube(kin, "locus"),
	}
	term, xterm := anchor.NewTerm(kin.Avatar().ID.String(), locus)
	term.Attach(anchor.Server, srv.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.Avatar(),
		Term: xterm,
	}
	go locus.loopRIP(rip)
	go locus.loopAnnounceAndExpire()
	return XLocus{locus}
}