コード例 #1
0
func (e *empty) Marshal() ([]byte, error) {
	var out models.Ring

	out.Version = uint32(e.version)
	out.Type = uint32(e.Type())
	return out.Marshal()
}
コード例 #2
0
func (s *single) Marshal() ([]byte, error) {
	var out models.Ring

	out.Version = uint32(s.version)
	out.Type = uint32(s.Type())
	out.Peers = []*models.PeerInfo{s.peer}
	return out.Marshal()
}
コード例 #3
0
ファイル: mod.go プロジェクト: coreos/torus
func (m *mod) Marshal() ([]byte, error) {
	var out models.Ring

	out.Version = uint32(m.version)
	out.ReplicationFactor = uint32(m.rep)
	out.Type = uint32(m.Type())
	out.Peers = m.peers
	return out.Marshal()
}
コード例 #4
0
func (k *ketama) Marshal() ([]byte, error) {
	var out models.Ring

	out.Version = uint32(k.version)
	out.ReplicationFactor = uint32(k.rep)
	out.Type = uint32(k.Type())
	out.Peers = k.peers
	return out.Marshal()
}
コード例 #5
0
func (u *unionRing) Marshal() ([]byte, error) {
	var out models.Ring

	out.Version = uint32(u.Version())
	out.Type = uint32(u.Type())
	out.Attrs = make(map[string][]byte)
	b, err := u.oldRing.Marshal()
	if err != nil {
		return nil, err
	}
	out.Attrs["old"] = b
	b, err = u.newRing.Marshal()
	if err != nil {
		return nil, err
	}
	out.Attrs["new"] = b
	return out.Marshal()
}