com.websudos.util.zookeeper

ZooKeeperConf

trait ZooKeeperConf extends AnyRef

This is a simple mixable trait for client applications to fetch ports from ZooKeeper during initialisation or register themselves on a path. In our eco-system, this is generally mixed in to objects extending TwitterServer or ClientBuilder.

The point is to allow very easy access to the local ZooKeeper node available in a Mesos deployment to fetch "the other" host:port pairs in the eco-system, allowing Thrift clients to auto-generate themselves with a trivial awaiting of a Future. The same mechanism can be used for any type of client.

This also allows applications to register themselves to a ZooKeeper path making them discoverable by other clients.

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ZooKeeperConf
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def store: ZkStore

    The store synchronising access to the ZooKeeper client.

    The store synchronising access to the ZooKeeper client.

    returns

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def add(path: String, address: InetSocketAddress): Future[Option[SetDataResponse]]

    This has the effect of pushing a new InetSocketAddress or its string representation to be price to the set already in ZooKeeper.

    This has the effect of pushing a new InetSocketAddress or its string representation to be price to the set already in ZooKeeper. A read operation is always performed first to avoid maintaining any state of the client side.

    If the data is not available in the data that was read, a write operation is carried out. If the data is already there, the write operation is skipped to save time and bandwidth a Future is immediately completed.

    path

    The ZooKeeper path to add the address to.

    address

    A Future wrapping an optional operation response. If the address is already in the set no write operation is performed.

    returns

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. def hosts(path: String): Future[Set[InetSocketAddress]]

    This method is shorthand syntax for retrieving the entire set of host:port pairs available on a ZooKeeper node.

    This method is shorthand syntax for retrieving the entire set of host:port pairs available on a ZooKeeper node. It's used in conjunction with the default parsing convention defined.

    path

    The ZooKeeper path to read from.

    returns

    A set of unique host:port combinations represented as a set of InetSocketAddress objects.

  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. def localAddress(port: Int): InetSocketAddress

    This is a simple shorthand method allowing users to get a reference to the hostname of the current machine.

    This is a simple shorthand method allowing users to get a reference to the hostname of the current machine. The purpose of this is to allow shorthand syntax for things like server.add(localAddress(somePort)){code}, effectively allowing applications to register as active and become discoverable via ZooKeeper.

    port

    The port to use in conjunction with the hostname of the current machine.

    returns

    An InetSocketAddress matching the hostname of the current machine and a chosen port.

  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. def parse(data: String): Set[InetSocketAddress]

    This method is used to parse the string of data obtained from a ZooKeeper path into a sequence of ports.

    This method is used to parse the string of data obtained from a ZooKeeper path into a sequence of ports. It's highly opinionated about the format in which teh data should be and it will only work with our default.

    Our format is "host:port*".

    data

    The data string fetched from ZooKeeper.

    returns

  21. def register(path: String, data: String): Future[SetDataResponse]

    This is a shorthand method for a UTF-8 based write operation to a ZooKeeper path.

    This is a shorthand method for a UTF-8 based write operation to a ZooKeeper path. It will simply overwrite the existing data on a path with the argument provided.

    The encoding in use by this method is always UTF 8.

    path

    The ZooKeeper path to write to.

    data

    The string of data to write to the ZooKeeper path.

    returns

    A Future wrapping the response of the write operation.

    Attributes
    protected[com.websudos.util.zookeeper]
  22. def register(path: String, address: Set[InetSocketAddress]): Future[SetDataResponse]

    Registers a new set of addresses on a ZooKeeper node.

    Registers a new set of addresses on a ZooKeeper node. This will overwrite any existing data on the path.

    path

    The ZooKeeper path to write to.

    address

    The InetSocketAddress to save as a sequence.

    returns

    A Future wrapping the response of the write operation.

  23. def register(path: String, address: InetSocketAddress): Future[SetDataResponse]

    Registers a address on a ZooKeeper node.

    Registers a address on a ZooKeeper node. This will overwrite any existing data on the path.

    path

    The ZooKeeper path to write to.

    address

    The InetSocketAddress to save as a sequence.

    returns

    A Future wrapping the response of the write operation.

  24. def remove(path: String, address: InetSocketAddress): Future[Option[SetDataResponse]]

    This will remove an address from a ZooKeeper node/path.

    This will remove an address from a ZooKeeper node/path. This is useful when a server is going out of service or any other similar situation.

    A read operation is always carried out no matter what to avoid maintaining any state of the client side. If the address to be removed is not found in the existing set, no write operation will be carried out.

    path

    The ZooKeeper path to write to.

    address

    The InetSocketAddress to remove from the existing set.

    returns

    A Future wrapping an optional operation response. If the address is not in the set no write operation is performed.

  25. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  26. implicit val timeout: Duration

    The default connection timeout.

    The default connection timeout. This is enforced when the ZooKeeper client connects to the ZooKeeper host.

  27. def toString(): String

    Definition Classes
    AnyRef → Any
  28. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  30. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped