Ejemplo n.º 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 _, downXID := range t.folk.Opened() {
		ydown := YTube{kinfolk.FolkXID(downXID)}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.BulkWrite(changed)
		}()
	}
	wg.Wait()
}
Ejemplo n.º 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 _, downXID := range t.folk.Opened() {
		ydown := YTube{
			kinfolk.FolkXID(downXID),
		}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Scrub(key, notAfterRev, notAfterUpdated)
		}()
	}
	wg.Wait()
}
Ejemplo n.º 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 _, downXID := range t.folk.Opened() {
		ydown := YTube{
			kinfolk.FolkXID(downXID),
		}
		wg.Add(1)
		go func() {
			defer wg.Done()
			ydown.Write(key, rev, value)
		}()
	}
	wg.Wait()
}