Range queries - pass out as binaries
Avoid converting to erlang temr wihtin the FSM and then requiring a copy outside of the FSM - pass out as a binary
This commit is contained in:
parent
f287895db0
commit
c203e2ee06
1 changed files with 10 additions and 9 deletions
|
@ -196,9 +196,15 @@ sst_get(Pid, LedgerKey, Hash) ->
|
||||||
gen_fsm:sync_send_event(Pid, {get_kv, LedgerKey, Hash}, infinity).
|
gen_fsm:sync_send_event(Pid, {get_kv, LedgerKey, Hash}, infinity).
|
||||||
|
|
||||||
sst_getkvrange(Pid, StartKey, EndKey, ScanWidth) ->
|
sst_getkvrange(Pid, StartKey, EndKey, ScanWidth) ->
|
||||||
gen_fsm:sync_send_event(Pid,
|
Reply = gen_fsm:sync_send_event(Pid,
|
||||||
{get_kvrange, StartKey, EndKey, ScanWidth},
|
{get_kvrange, StartKey, EndKey, ScanWidth},
|
||||||
infinity).
|
infinity),
|
||||||
|
FetchFun =
|
||||||
|
fun({SlotBin, SK, EK}, Acc) ->
|
||||||
|
Acc ++ binaryslot_trimmedlist(SlotBin, SK, EK)
|
||||||
|
end,
|
||||||
|
{SlotsToFetchBinList, SlotsToPoint} = Reply,
|
||||||
|
lists:foldl(FetchFun, [], SlotsToFetchBinList) ++ SlotsToPoint.
|
||||||
|
|
||||||
sst_getslots(Pid, SlotList) ->
|
sst_getslots(Pid, SlotList) ->
|
||||||
SlotBins = gen_fsm:sync_send_event(Pid, {get_slots, SlotList}, infinity),
|
SlotBins = gen_fsm:sync_send_event(Pid, {get_slots, SlotList}, infinity),
|
||||||
|
@ -493,12 +499,7 @@ fetch_range(StartKey, EndKey, ScanWidth, State) ->
|
||||||
end,
|
end,
|
||||||
|
|
||||||
SlotsToFetchBinList = read_slots(Handle, SlotsToFetch),
|
SlotsToFetchBinList = read_slots(Handle, SlotsToFetch),
|
||||||
|
{SlotsToFetchBinList, SlotsToPoint}.
|
||||||
FetchFun =
|
|
||||||
fun({SlotBin, SK, EK}, Acc) ->
|
|
||||||
Acc ++ binaryslot_trimmedlist(SlotBin, SK, EK)
|
|
||||||
end,
|
|
||||||
lists:foldl(FetchFun, [], SlotsToFetchBinList) ++ SlotsToPoint.
|
|
||||||
|
|
||||||
|
|
||||||
write_file(RootPath, Filename, SummaryBin, SlotsBin) ->
|
write_file(RootPath, Filename, SummaryBin, SlotsBin) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue