Example #1
0
func (dm *clusterMutation) Unserialize(reader typedio.Reader) {
	dm.version, _ = reader.ReadInt64()
	nbNodes, _ := reader.ReadUint16()
	dm.nodes = make([]*cluster.Node, nbNodes)

	var i uint16
	for i = 0; i < nbNodes; i++ {
		node := cluster.NewEmptyNode()
		node.Unserialize(reader)
		dm.nodes[i] = node
	}
}
Example #2
0
func (cl *CommitLog) readOne(reader typedio.Reader) (mutInfo mutationInfo, size int64) {
	// read mutation id
	id, err := reader.ReadUint8()
	if err != nil {
		log.Fatal("CommitLog: Couldn't read mutation from commit log: %s", err)
	}

	// get the right mutation for the read id
	mutInfo, found := cl.mutations[id]
	if !found {
		log.Fatal("CommitLog: Cannot find mutation id %d!", id)
	}

	// read the mutation
	mutInfo.mutation.Unserialize(reader)

	// read size of the mutation record
	size, err = reader.ReadInt64()
	if err != nil && err != os.EOF {
		log.Fatal("CommitLog: Couldn't read size of mutation from commit log: %s", err)
	}

	return mutInfo, size
}
Example #3
0
func (m *Int64Mutation) Unserialize(reader typedio.Reader) {
	m.val, _ = reader.ReadInt64()
}