Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 6 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
1  MANIFESTO.md
View
@@ -7,3 +7,4 @@ This manifesto defines the rules for this project. Loosely inspired by the 'Dogm
* You may only write code when you know how to write a test case for the code.
* A test case is a QC model. If you don't know how to model it, you have no test case. You need a property. However, you are allowed to use any property. Also very simple ones.
* The dogfooding principle: there must be a user of code and a need for a given feature before it is written. The code must be used somewhere. If not, the code will be removed from the repository.
+* Discussions about tabs, spaces and indentation are only allowed when all other important discussions are solved. These include, code design, API design, implementation, tests and so on.
2  rebar.config
View
@@ -5,6 +5,6 @@
{deps, [
{lager, ".*",
{git, "git://github.com/basho/lager.git",
- {branch, "master"}}}
+ {tag, "1.2.1"}}}
]}.
8 src/sv_codel.erl
View
@@ -17,6 +17,8 @@
%% Scrutiny
-export([qstate/1]).
+-define(Q, queue).
+
-type task() :: term().
%% Internal state
@@ -24,7 +26,7 @@
%% The underlying queue to use. For now, since we are mainly in a test phase, we just use a standard
%% functional queue. But later the plan is to use a module here and then call the right kind of queue
%% functions for that module.
- queue = queue:new(),
+ queue = ?Q:new(),
%% The `dropping' field tracks if the CoDel system is in a dropping state or not.
dropping = false,
@@ -87,7 +89,7 @@ init(Target, Interval) -> #state{ target = Target, interval = Interval }.
%% @end
-spec enqueue(task(), term(), #state{}) -> #state{}.
enqueue(Pkt, TS, #state { queue = Q } = State) ->
- State#state { queue = queue:in({Pkt, TS}, Q) }.
+ State#state { queue = ?Q:in({Pkt, TS}, Q) }.
%% @doc Dequeue a packet from the CoDel system
%% Given a point in time, `Now' and a CoDel `State', extract the next task from it.
@@ -114,7 +116,7 @@ control_law(T, I, C) ->
%% This is a helper function. It dequeues from the underlying queue and then analyzes the Sojourn
%% time together with the next function, dodequeue_.
dodequeue(Now, #state { queue = Q } = State) ->
- case queue:out(Q) of
+ case ?Q:out(Q) of
{empty, NQ} ->
{nodrop, empty, State#state { first_above_time = 0, queue = NQ }};
{{value, {Pkt, InT}}, NQ} ->
2  src/sv_queue.erl
View
@@ -190,7 +190,7 @@ process_queue(0, Q, TS, Started) ->
{Started, Q, TS};
process_queue(K, Q, TS, Started) ->
case ?QUEUE:out(Q) of
- {{value, {_Timestamp, {Pid, _} = From}}, Q2} ->
+ {{value, {Pid, _}= From}, Q2} ->
Ref = erlang:monitor(process, Pid),
gen_server:reply(From, {go, Ref}),
process_queue(K-1, Q2, gb_sets:add_element(Ref, TS), Started+1);
4 src/sv_queue_ets.erl
View
@@ -33,9 +33,9 @@ out(QName) ->
case ets:first(QName) of
'$end_of_table' -> {empty, QName};
Key ->
- [Obj] = ets:lookup(QName, Key),
+ [{_TS, V} = Obj] = ets:lookup(QName, Key),
true = ets:delete_object(QName, Obj),
- {{value, Obj}, QName}
+ {{value, V}, QName}
end.
len(QName) ->

No commit comments for this range

Something went wrong with that request. Please try again.