couch-simple-0.0.1.0: A modern, lightweight, complete client for CouchDB

CopyrightCopyright (c) 2015, Michael Alan Dorman
LicenseMIT
Maintainermdorman@jaunder.io
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Database.Couch.Explicit.Server

Description

This module is intended to be import qualified. No attempt has been made to keep names of types or functions from clashing with obvious or otherwise commonly-used names, or even other modules within this package.

The functions here are derived from (and presented in the same order as) the Server API documentation. For each function, we attempt to link back to the original documentation, as well as make a notation as to how complete and correct we feel our implementation is.

Each function takes a Context as its final parameter, and returns a Result.

Synopsis

Documentation

meta :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Get most basic meta-information

The return value is an object whose fields often vary, so it is most easily decoded as a Value:

>>> value :: Result Value <- Server.meta ctx

Status: Complete

activeTasks :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Get a list of active tasks

The return value is a list of objects whose fields often vary, so it is easily decoded as a List of Value:

>>> value :: Result [Value] <- Server.activeTasks ctx

Status: Complete

allDbs :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Get a list of all databases

The return value is a list of database names, so it is easily decoded into a List of Text:

>>> value :: Result [Text] <- Server.allDbs ctx

Status: Complete

dbUpdates :: (FromJSON a, MonadIO m) => DbUpdates -> Context -> m (Result a) Source

Get a list of all database events

This call does not yet stream out results, so it's functionality is limited.

The return value is a list of database update events, so it is easily decoded into a List of Value:

>>> value :: Result [Value] <- Server.dbUpdates ctx

Status: Limited

log :: MonadIO m => Context -> m (Result Text) Source

Get the log output of the server

This call doesn't return a JSON result, so we're deferring support for the moment.

Status: Unimplemented

replicate :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Administer replication for databases on the server

We do not yet have a structure for specifying parameters to this call, so we're deferring support for the moment

Status: Unimplemented

restart :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Restart the server

The return value is an object that should only contain a single key "ok", so it is easily decoded into a Bool with our asBool combinator:

>>> value :: Result Bool <- Server.restart ctx >>= asBool

Status: Complete

stats :: (FromJSON a, MonadIO m) => Context -> m (Result a) Source

Get server statistics

The return value is an object whose fields often vary, so it is most easily decoded as a Value:

>>> value :: Result Value <- Server.stats ctx

Status: Complete

uuids Source

Arguments

:: (FromJSON a, MonadIO m) 
=> Int

How many UUIDs to retrieve

-> Context 
-> m (Result a) 

Get a batch of UUIDs

The return value is a list of strings representing UUIDs, so it is easily decoded as a List of UUID with our asUUID combinator:

>>> value :: Result [UUID] <- Server.stats ctx >>= asUUID

Status: Complete