Query API and tests, using in-memory storage.