Exemple #1
0
func NewKin() (k *Kin, xkin XKin, rip <-chan KinAvatar) {
	k = &Kin{
		neighborhood: NewNeighborhood(),
		rip:          make(chan KinAvatar, ExpansionHigh),
		topic:        make(map[string]FolkAvatar),
	}
	// Create a KinAvatar for this system.
	k.kinav = KinAvatar(Avatar{
		X:  circuit.PermRef(XKin{k}),
		ID: lang.ComputeReceiverID(k),
	})
	return k, XKin{k}, k.rip
}
Exemple #2
0
func New(kin *kinfolk.Kin, topic string) *Tube {
	t := &Tube{
		lookup:     make(map[string]int),
		downstream: kinfolk.NewRotor(),
	}
	t.permXID = kinfolk.FolkXID{
		X:  circuit.PermRef(XTube{t}),
		ID: lang.ComputeReceiverID(t),
	}
	t.folk = kin.Attach(topic, t.permXID)
	go t.loop()
	return t
}
Exemple #3
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
}
Exemple #4
0
func (x *_permref) String() string {
	return "xpermref://" + lang.ComputeReceiverID(x.value).String()
}