Пример #1
0
// NewTerm create the root node of a new anchor file system.
func NewTerm(name string, genus Genus) (*Terminal, circuit.PermX) {
	t := &Terminal{
		genus:  genus,
		anchor: newAnchor(nil, name).use(),
	}
	return t, circuit.PermRef(XTerminal{t})
}
Пример #2
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
}
Пример #3
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
}
Пример #4
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
}
Пример #5
0
// NewTerm create the root node of a new anchor file system.
func NewTerm(name string) circuit.PermX {
	t := XTerminal{
		(*Terminal)(newAnchor(nil, name).use()),
	}
	return circuit.PermRef(t)
}