Skip to content

Commit

Permalink
get_key_count (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain Slootmaekers committed May 11, 2012
1 parent 09f34c4 commit 4a74fd8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/hope/bstore.ml
Expand Up @@ -210,5 +210,7 @@ module BStore = (struct
(fun ic -> Llio.copy_stream ~length ~ic ~oc)
>>= fun () ->
Lwtc.log "raw_dump: done"

let get_key_count t = Lwt.return 0 (* TODO: baardskeerder part *)
end: STORE)

14 changes: 13 additions & 1 deletion src/hope/c.ml
Expand Up @@ -124,6 +124,9 @@ module ProtocolHandler (S:Core.STORE) = struct
| None -> Lwt.fail (Common.XException(Arakoon_exc.E_NOT_FOUND, k))
| Some v -> Lwt.return v

let _get_key_count store = S.get_key_count store


let _prefix_keys store k max = S.prefix_keys store k max

let extract_master_info = function
Expand Down Expand Up @@ -398,12 +401,21 @@ module ProtocolHandler (S:Core.STORE) = struct

| Common.GET_DB ->
Lwtc.log "GET_DB" >>= fun () ->
Lwt.catch
Lwt.catch
(fun () ->
Llio.output_int oc 0 >>= fun () ->
S.raw_dump store oc >>= fun () ->
Lwt.return true)
(Client_protocol.handle_exception oc)

| Common.GET_KEY_COUNT ->
Lwtc.log "GET_KEY_COUNT" >>= fun () ->
Lwt.catch
(fun () -> _get_key_count store >>= fun kc ->
let kc64 = Int64.of_int kc in
Client_protocol.response_ok_int64 oc kc64
)
(Client_protocol.handle_exception oc)
(*| _ -> Client_protocol.handle_exception oc (Failure "Command not implemented (yet)") *)

let protocol me (stats:Statistics.t) driver store (ic,oc) =
Expand Down
1 change: 1 addition & 0 deletions src/hope/core.ml
Expand Up @@ -129,6 +129,7 @@ module type STORE = sig

val last_entries: t -> tick -> Lwtc.oc -> unit Lwt.t
val last_update: t -> (tick * update option) option Lwt.t
val get_key_count : t -> int Lwt.t
val get_meta: t -> string option Lwt.t
val set_meta: t -> string -> unit Lwt.t
val close : t -> unit Lwt.t
Expand Down
1 change: 1 addition & 0 deletions src/hope/mem_store.ml
Expand Up @@ -48,5 +48,6 @@ module MemStore = (struct
let dump t = Lwtc.failfmt "todo"

let raw_dump t oc = Lwtc.failfmt "todo: MemStore.raw_dump"
let get_key_count t = Lwtc.failfmt "todo: MemStore.get_key_count"
end: STORE)

0 comments on commit 4a74fd8

Please sign in to comment.