renamed to magpie

This commit is contained in:
Andrew McLeod 2016-09-29 22:10:19 +02:00
parent 3a1f307a28
commit 1ad984a010
3 changed files with 20 additions and 33 deletions

View File

@ -1,18 +1,18 @@
# Overview
This interface layer handles the communication among Apache Zookeeper peers.
This interface layer handles the communication among Magpie peers.
# Usage
## Peers
This interface allows the peers of the Zookeeper deployment to be aware of
This interface allows the peers of the Magpie deployment to be aware of
each other. This interface layer will set the following states, as appropriate:
* `{relation_name}.joined` A new peer in the Zookeeper service has
joined. The Zookeeper charm should call `get_nodes()` to get
a list of tuples with unit ids and IP addresses for quorum members.
* `{relation_name}.joined` A new peer in the Magpie service has
joined. The Magpie charm should call `get_nodes()` to get
a list of tuples with unit ids and IP addresses for peer members.
* When a unit joins the set of peers, the interface ensures there
is no `{relation_name}.departed` state set in the conversation.
@ -21,9 +21,9 @@ each other. This interface layer will set the following states, as appropriate:
peer conversation so this charm can react to subsequent peers joining.
* `{relation_name}.departed` A peer in the Zookeeper service has
departed. The Zookeeper charm should call `get_nodes()` to get
a list of tuples with unit ids and IP addresses for remaining quorum members.
* `{relation_name}.departed` A peer in the Magpie service has
departed. The Magpie charm should call `get_nodes()` to get
a list of tuples with unit ids and IP addresses for remaining peer members.
* When a unit leaves the set of peers, the interface ensures there
is no `{relation_name}.joined` state set in the conversation.
@ -32,28 +32,15 @@ each other. This interface layer will set the following states, as appropriate:
peer conversation so this charm can react to subsequent peers departing.
For example, let's say that a peer is added to the Zookeeper service
deployment. The Zookeeper charm should handle the new peer like this:
For example, let's say that a peer is added to the Magpie service
deployment. The Magpie charm should handle the new peer like this:
```python
@when('zookeeper.installed', 'zkpeer.joined')
def quorum_add(zkpeer):
nodes = zkpeer.get_nodes()
increase_quorum(nodes)
zkpeer.dismiss_joined()
@when('magpie.joined')
def check_peers(magpie):
nodes = magpie.get_nodes()
# do stuff with nodes
```
Similarly, when a peer departs:
```python
@when('zookeeper.installed', 'zkpeer.departed')
def quorum_remove(zkpeer):
nodes = zkpeer.get_nodes()
decrease_quorum(nodes)
zkpeer.dismiss_departed()
```
# Contact Information
- <bigdata@lists.ubuntu.com>

View File

@ -1,4 +1,4 @@
name: zookeeper-quorum
summary: Interface used by the Apache Zookeeper quorum members
name: magpie
summary: Interface used by the Magpie charm layer for peer network tests
version: 1
maintainer: "Juju Big Data <bigdata@lists.ubuntu.com>"
maintainer: "Andrew McLeod <andrew.mcleod@canonical.com>"

View File

@ -13,16 +13,16 @@
from charms.reactive import RelationBase, hook, scopes
class ZookeeperPeers(RelationBase):
class MagpiePeers(RelationBase):
scope = scopes.UNIT
@hook('{peers:zookeeper-quorum}-relation-joined')
@hook('{peers:magpie}-relation-joined')
def joined(self):
conv = self.conversation()
conv.remove_state('{relation_name}.departed')
conv.set_state('{relation_name}.joined')
@hook('{peers:zookeeper-quorum}-relation-departed')
@hook('{peers:magpie}-relation-departed')
def departed(self):
conv = self.conversation()
conv.remove_state('{relation_name}.joined')