Beispiel #1
0
// bulkWriteSync pushes the changed records to our downstream peers.
func (t *Tube) bulkWriteSync(changed []*Record) {
	// Records exchanged within and across tubes are immutable, so no lock is necessary
	var wg sync.WaitGroup
	for _, downAvatar := range t.folk.Opened() {
		ydown := YTube{tissue.FolkAvatar(downAvatar)}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.BulkWrite(changed)
		}()
	}
	wg.Wait()
}
Beispiel #2
0
// scrub pushes a notification to scrub a record to our downstream peers.
func (t *Tube) scrubSync(key string, notAfterRev Rev, notAfterUpdated time.Time) {
	var wg sync.WaitGroup
	for _, downAvatar := range t.folk.Opened() {
		ydown := YTube{
			tissue.FolkAvatar(downAvatar),
		}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Scrub(key, notAfterRev, notAfterUpdated)
		}()
	}
	wg.Wait()
}
Beispiel #3
0
// writeSync pushes an update to our downstream peering tubes.
func (t *Tube) writeSync(key string, rev Rev, value interface{}) {
	var wg sync.WaitGroup
	for _, downAvatar := range t.folk.Opened() {
		ydown := YTube{
			tissue.FolkAvatar(downAvatar),
		}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Write(key, rev, value)
		}()
	}
	wg.Wait()
}