Fix pattern match exhaustivity warnings

Although the function names aren't obvious, these were both on the
request marshalling path. These functions are only used by our
well-behaved request marshaller, which should never marshal either
Errors or Watchevents as requests.

Fixed by making one function total, and the other an explicit exception
and a note describing why it can never happen. Perhaps we could
encode this in the types somehow.

Fixes [djs55/ocaml-xenstore#13]

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
test: remove unused binding (fixes compiler warning)

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Break out Store.Node into Node

The Node is the part of the functional core of xenstore.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
What constitutes a valid path is part of the protocol, not the server

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Define Protocol.{Name,Path}

Protocol.Path: a sequence of elements (internally strings)
describing a walk down the tree

Protocol.Name: a thing which is named in the protocol, which
can be a path (absolute or relative to the connection's
homedir) or a well-known watch.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Finally remove the module 'Junk'

The only non-trivial function still in use was 'hexify' which will
hopefully disappear when we move to use Cstruct.t more (instead of
strings)

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
server_test: re-add previously commented out unit test fragment

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Remove old 'coalesce' based transaction merging algorithm

The server-side replay algorithm has better performance and is
simpler to maintain.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Track writes and deletes, separately from watches

There is only one case where watches are not fired but
the store is updated: when a directory is implicitly
created (cf 'mkdir -p'). To cover this case we track
watches separately from writes and deletes.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Move the implicit directory creation into the Transaction module

Implicit directory creation is conflated with watch event generation
in the protocol, which is tied to the transaction (i.e. the events are
queued until transaction commit)

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Correct a comment in transaction.ml

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Apply the remaining side-effects at the I/O layer

The aim is to keep the core as functional as possible, and keep
the side-effects separate.

Signed-off-by: David Scott <dave.scott@eu.citrix.com>
Merge pull request #22 from djs55/refactor

More tidyups