Rationalise the interface a bit.

- Move the cleanup parts of sync_done to an internal method, called
  automatically as needed. Polling for the end of the search can be
  achieved by waiting for ->state to return to 'idle'.

- Rename start_sync to sync, and wait_for_sync to wait_for_idle.

- Make non-async mode work properly. Previously ->state and ->search
  were only set after $L->search returned a Search object; this meant
  that calling stop_sync from a callback would fail. Introduce a new
  state 'starting', which triggers the callback to save the Search
  object it's passed. (For a sync-mode search, this is the first time we
  see the Search; $L->search hasn't returned yet.)

- Since the simplest case is now a sync-mode refreshOnly search, which
  simply updates the cache and returns, make persist=>0 the default.
Allow more callbacks.
Hold the search params in the object.

This means we will use the same parameters every time, which is a
requirement of the protocol. It also means that having created an object
we can run syncs on it without having to remember the search parameters.
Freeze and thaw search params.

This will clear the cache if the search has changed.

Freeze (at least) currently doesn't work if we don't have a cache. I
need to fix that: there is every reason to freeze without a cache.
Actually, I need to fix no-cache operation generally.