summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2010-08-02 16:56:21 +0100
committerSimon MacMullen <simon@rabbitmq.com>2010-08-02 16:56:21 +0100
commita211fd73ce5b7a2fdc7129cc3b341faf55de64c5 (patch)
treec7d74daea28eb47b41d177024de6617a73476831
parentfd8e8769729c112525a32ad58d1a7d0649ee7333 (diff)
downloadrabbitmq-server-a211fd73ce5b7a2fdc7129cc3b341faf55de64c5.tar.gz
Attempt to improve specs.
-rw-r--r--src/rabbit_event.erl22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/rabbit_event.erl b/src/rabbit_event.erl
index e2d0094d..e9406c12 100644
--- a/src/rabbit_event.erl
+++ b/src/rabbit_event.erl
@@ -38,17 +38,27 @@
-export([stats_level/1]).
-export([notify/2]).
--opaque(state() :: {atom(), atom()}).
+-ifdef(use_specs).
+
+-type(level() :: 'none' | 'coarse' | 'fine').
+
+-opaque(state() :: #state {
+ level :: level(),
+ timer :: atom()
+ }).
+
+-type(timer_fun() :: fun (() -> 'ok')).
-spec(init_stats_timer/0 :: () -> state()).
--spec(ensure_stats_timer/3 ::
- (state(), fun (() -> 'ok'), fun (() -> 'ok')) -> state()).
--spec(stop_stats_timer/2 :: (state(), fun (() -> 'ok')) -> state()).
--spec(ensure_stats_timer_after/2 :: (state(), fun (() -> 'ok')) -> state()).
+-spec(ensure_stats_timer/3 :: (state(), timer_fun(), timer_fun()) -> state()).
+-spec(stop_stats_timer/2 :: (state(), timer_fun()) -> state()).
+-spec(ensure_stats_timer_after/2 :: (state(), timer_fun()) -> state()).
-spec(reset_stats_timer_after/1 :: (state()) -> 'ok').
--spec(stats_level/1 :: (state()) -> atom()).
+-spec(stats_level/1 :: (state()) -> level()).
-spec(notify/2 :: (atom(), term()) -> 'ok').
+-endif.
+
-record(state, {level, timer}).
%%----------------------------------------------------------------------------