Beispiel #1
0
func (t *Tube) superscribe(peerXID kinfolk.FolkXID) {
	// log.Printf("tube superscribing %s", yup.xid.String())
	// defer func() {
	// 	log.Printf("tube superscribed %s\n%s", yup.xid.String(), t.Dump())
	// }()

	t.Lock()
	defer t.Unlock()
	yup := YTube{kinfolk.FolkXID(t.downstream.Open(kinfolk.XID(peerXID)))}
	go t.BulkWrite(yup.Subscribe(t.permXID, t.bulkRead()))
}
Beispiel #2
0
func (t *Tube) scrubSync(key string, notAfterRev Rev, notAfterUpdated time.Time) {
	var wg sync.WaitGroup
	for _, downXID := range t.downstream.Opened() {
		ydown := YTube{kinfolk.FolkXID(downXID)}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Scrub(key, notAfterRev, notAfterUpdated)
		}()
	}
	wg.Wait()
}
Beispiel #3
0
func (t *Tube) writeSync(key string, rev Rev, value interface{}) {
	var wg sync.WaitGroup
	for _, downXID := range t.downstream.Opened() {
		ydown := YTube{kinfolk.FolkXID(downXID)}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Write(key, rev, value)
		}()
	}
	wg.Wait()
}
Beispiel #4
0
func (t *Tube) bulkWriteSync(changed []*Record) {
	// Records exchanged within and across tubes are immutable, so no lock is necessary
	var wg sync.WaitGroup
	for _, downXID := range t.downstream.Opened() {
		ydown := YTube{kinfolk.FolkXID(downXID)}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.BulkWrite(changed)
		}()
	}
	wg.Wait()
}