Beispiel #1
0
func composeQuery(typestring string, hash objects.HKID, namesegment string) (message string) {
	message = fmt.Sprintf("%s,%s", typestring, hash.String())
	if namesegment != "" {
		message = fmt.Sprintf("%s,%s", message, namesegment)
	}
	return message

}
Beispiel #2
0
func (m multicastservice) GetCommit(h objects.HKID) (c objects.Commit, err error) {
	message := fmt.Sprintf("{\"type\":\"commit\",\"hkid\": \"%s\"}", h.String())

	commitchannel := make(chan objects.Commit, 1)
	m.waitingforcommit[h.String()] = commitchannel
	m.sendmessage(message)
	select {
	case c = <-commitchannel:
		return c, err

	case <-time.After(150 * time.Millisecond):
		//log.Printf("Timing out now")
		return c, fmt.Errorf("GetCommit on Multicast service timed out")
	}

}