Giter Club home page Giter Club logo

zoovisitor's Introduction

ZooVisitor

Hackage

An Apache zookeeper client for Haskell.

Tested with libzookeeper-mt [3.4, 3.6], a higher version should work but not guaranteed.

NOTE: this library is still in development.

Features

  • Simple

    • Does not require knowledge of the C APIs
    • Does not require malloc and free memory manually
    • High-level api written in Haskell
  • Safe

    • Type safe
    • A failure action should throw an exception
  • Fast

    • All underlying calls are non-blocking, you can use Haskell lightweight threads to speed up your tasks.
    • The speed should be compatible to C implementation

zoovisitor's People

Contributors

4euep avatar alissa-tung avatar commelina avatar time-hu avatar yu-zh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

zoovisitor's Issues

ZooEvent: add seperated event for watchGetChildren

In the current version, when zooWatchGetChildren is triggered, the watcherCtxType, whose type is ZooEvent is always set to ZooChildEvent. However, this is not detailed enough in some situations.

To be more detailed, when zooWatchGetChildren is triggered, we want to know if the event is one of the following:

  • ZooCreateEvent
  • ZooDeleteEvent
  • ZooChangedEvent
  • zooNoWatchingEvent

Logs spam the console and cannot be redirected

Hello- I attempted to use this library for a CLI tool and had to make some questionable moves in order to reduce log pollution, as zoo_set_log_stream is not exposed by the API, and my naive-to-Haskell attempts to bind it to /dev/null led to segfaults.

My workaround was to set the log-level to (unsafeCoerce @ZooKeeper.ZooLogLevel (0 :: CInt)) during initial connection attempts1, and run the connection attempt in a thread to allow manual timeout handling, then - upon seeing the state was ZCONNECTED 2 or timeout being reached, return or fail.

Perhaps exposing the zoo_set_log_stream API, or maybe providing an easy way to pipe them to a TQueue or similar would be helpful? Similarly, connect timeouts or retry attempt counts before throwing some sort of exception or return state would be nice.

P.S. I'm not clear of the exception handling model, but it seemed very unclear how to actually handle the results of a call without writing an FFI wrapper instead of doing the exception conversions on the fly. I didn't see any examples in the docs or tests that cleared this up, but it didn't seem worth opening another issue for, without further clarification.

Footnotes

  1. Which somehow worked despite this being apparently unsupported by the C library itself?

  2. Notably, state 999 (ZNOTCONNECTED_STATE) is not exposed by this API, and there's no exposed way beyond unsafe-coerce (or, in the other direction, parsing of show) to provide custom values to or extract the inner contents from either the state values or log levels.

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.