forked from coreos/torus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
empty.go
43 lines (34 loc) · 835 Bytes
/
empty.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package ring
import (
"github.com/coreos/agro"
"github.com/coreos/agro/models"
)
type empty struct {
version int
}
func init() {
registerRing(Empty, "empty", makeEmpty)
}
func makeEmpty(r *models.Ring) (agro.Ring, error) {
return &empty{
version: int(r.Version),
}, nil
}
func (e *empty) GetPeers(key agro.BlockRef) (agro.PeerPermutation, error) {
return agro.PeerPermutation{
Peers: []string{},
Replication: 0,
}, nil
}
func (e *empty) Members() agro.PeerList { return []string{} }
func (e *empty) Describe() string {
return "Ring: Empty"
}
func (e *empty) Type() agro.RingType { return Empty }
func (e *empty) Version() int { return e.version }
func (e *empty) Marshal() ([]byte, error) {
var out models.Ring
out.Version = uint32(e.version)
out.Type = uint32(e.Type())
return out.Marshal()
}