示例#1
0
文件: writer.go 项目: maraino/gossie
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
}
示例#2
0
文件: writer.go 项目: rcrowley/gossie
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
}