GithubHelp home page GithubHelp logo

isabella232 / interface-zookeeper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juju-solutions/interface-zookeeper

0.0 0.0 0.0 10 KB

The interface between Zookeeper and its clients

License: Other

Python 100.00%

interface-zookeeper's Introduction

Overview

This interface layer handles the communication between Apache Zookeeper and its clients. The provider end of this interface provides the Zookeeper service. The consumer part requires the existence of a provider to function.

Usage

Provides

Charms providing the Apache Zookeeper service provide this interface. This interface layer will set the following states, as appropriate:

  • {relation_name}.joined The provider has been related to a client, though the client service may not be available yet. At this point, the provider should broadcast Zookeeper configuration details using:

    • send_port(port, rest_port)
  • {relation_name}.ready Zookeeper configuration details have been sent. The provider and client should now be able to communicate.

Zookeeper provider example:

@when('client.joined')
@when_not('client.ready')
def send_config(client):
    client.send_port(get_zookeeper_port(), get_zookeeper_rest_port())

Requires

Clients require this interface to connect to Apache Zookeeper. This interface layer will set the following states, as appropriate:

  • {relation_name}.joined The client charm has been related to a Zookeeper provider. At this point, the charm waits for Zookeeper configuration details.

  • {relation_name}.ready Zookeeper is now ready for clients. The client charm should get Zookeeper configuration details using:

    • zookeepers() returns a list of zookeeper unit dicts:

      {host: xyz, port: n, rest_port: m}
      

Zookeeper client example:

@when('zookeeper.joined')
@when_not('zookeeper.ready')
def wait_for_zookeeper(zookeeper):
    hookenv.status_set('waiting', 'Waiting for Zookeeper to become available')


@when('zookeeper.ready')
@when_not('myservice.configured')
def configure(zookeeper):
    for zk_unit in zookeeper.zookeepers():
        add_zookeeper(zk_unit['host'], zk_unit['port'])
    set_state('myservice.configured')

Contact Information

interface-zookeeper's People

Contributors

johnsca avatar ktsakalozos avatar kwmonroe avatar pengale avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.