Giter VIP home page Giter VIP logo

interface-bigdata-hub's Introduction

Overview

This interface layer handles the communication with Big Data Hub registry service.

Usage

Requires

Charms connecting to the Big Data Hub can require this interface.

This interface layer will set the following states, as appropriate:

  • {relation_name}.connected The relation to the Big Data Hub has been established, though the service list may not be available yet. If you are providing a service, you can use the following methods to manage your service registrations:

    • register_service(name, data)
    • unregister_service(name, uuid=ALL)
  • {relation_name}.available The list of provided services is available from the Hub. You can use the following methods to get information about the provided services:

    • provided_services() The names of all services provided.
    • providers(name) All providers for a given service name.
    • service(name) The earliest registered provider for a given service.
  • {relation_name}.service.{service_name} The given service name has been provided. You can use the areforementioned methods to get information about the service.

For example, let's say that a charm wants to use HDFS. It can connect to the Big Data Hub and use the following code to wait for HDFS:

@when('flume.installed', 'hub.service.hdfs')
def hdfs_ready(hub):
    hdfs = hub.service('hdfs')
    flume.configure_hdfs(hdfs['ip'], hdfs['port'])
    flume.start()

A charm providing a NameNode could then use the following to register it:

@when('hub.connected', 'namenode.ready')
def register_namenode(hub):
    namenode = get_namenode_info()
    hub.register_service('hdfs', {
        'port': namenode['port'],
        'webhdfs_port': namenode['webhdfs_port'],
    })

The data provided for a service will vary depending on the service, but is guaranteed to contain an IP address and a UUID. If the IP address is not included in the data used to register the service, the private-address for the local unit will be resolved and used. If the UUID is not included, one will be generated.

Provides

A charm providing this interface is providing the Big Data Hub service.

This interface layer will set the following states, as appropriate:

  • {relation_name}.client One or more clients have connected. The charm can tell the client about the registered services using:

    • provide_services(services)
  • {relation_name}.provider One or more services have been registered as being provided. The charm can get the mapping of provided services with:

    • registered_services()

Example:

@when('hub.client', 'hub.provider')
def provide_services(clients, providers):
    clients.provide_services(providers.registered_services())

Contact Information

interface-bigdata-hub's People

Contributors

johnsca avatar

Watchers

James Cloos avatar  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.