this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bound log functions

garrison 4600eb13 bfb8dcc9

+10 -1
+10 -1
lib/trinity/sim_logger.ex
··· 12 12 13 13 @spec log_head(non_neg_integer) :: [String.t] 14 14 def log_head(count) do 15 + %{log_atomic: log_atomic} = get_sim() 16 + last_i = :atomics.get(log_atomic, 2) 17 + count = min(last_i, count) 18 + 15 19 scan_log(1, count) 16 20 end 17 21 ··· 19 23 def log_tail(count) do 20 24 %{log_atomic: log_atomic} = get_sim() 21 25 last_i = :atomics.get(log_atomic, 2) 26 + count = min(last_i, count) 27 + 22 28 scan_log(last_i - count, count) 23 29 end 24 30 25 31 @spec scan_log(non_neg_integer, non_neg_integer) :: [String.t] 26 32 def scan_log(i, count) do 27 - %{log: log} = get_sim() 33 + %{log: log, log_atomic: log_atomic} = get_sim() 34 + last_i = :atomics.get(log_atomic, 2) 35 + count = min(last_i - i, count) 36 + 28 37 do_scan_log(log, i + count, count, []) 29 38 end 30 39