Beispiel #1
0
func (w *writer) addWriter(cf string, key []byte) *cassandra.Mutation {
	tm := cassandra.NewMutation()
	skey := string(key)
	if _, exists := w.writers[skey]; !exists {
		w.writers[skey] = make(map[string][]*cassandra.Mutation, 1)
	}
	w.writers[skey][cf] = append(w.writers[skey][cf], tm)
	return tm
}
Beispiel #2
0
func (w *writer) addWriter(cf string, key []byte) *cassandra.Mutation {
	tm := cassandra.NewMutation()
	var cfMuts thrift.TMap
	im, exists := w.writers.Get(key)
	if !exists {
		cfMuts = thrift.NewTMap(thrift.STRING, thrift.LIST, 1)
		w.writers.Set(key, cfMuts)
	} else {
		cfMuts = im.(thrift.TMap)
	}
	var mutList thrift.TList
	im, exists = cfMuts.Get(cf)
	if !exists {
		mutList = thrift.NewTList(thrift.STRUCT, 1)
		cfMuts.Set(cf, mutList)
	} else {
		mutList = im.(thrift.TList)
	}
	mutList.Push(tm)
	return tm
}