FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
clique/src/clique_status.erl at develop · basho/clique · GitHub
basho
/
clique
Public
Notifications
You must be signed in to change notification settings
Fork
49
Star
152
Code
Issues
11
Pull requests
1
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
clique
/
src
/
clique_status.erl
Copy path
More file actions
More file actions
Latest commit
History
History
History
93 lines (82 loc) · 2.58 KB
Breadcrumbs
clique
/
src
/
clique_status.erl
Copy path
File metadata and controls
93 lines (82 loc) · 2.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
%
% -------------------------------------------------------------------
%
%
%
% Copyright (c) 2014 Basho Technologies, Inc. All Rights Reserved.
%
%
%
% This file is provided to you under the Apache License,
%
% Version 2.0 (the "License"); you may not use this file
%
% except in compliance with the License. You may obtain
%
% a copy of the License at
%
%
%
% http://www.apache.org/licenses/LICENSE-2.0
%
%
%
% Unless required by applicable law or agreed to in writing,
%
% software distributed under the License is distributed on an
%
% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
%
% KIND, either express or implied. See the License for the
%
% specific language governing permissions and limitations
%
% under the License.
%
%
%
% -------------------------------------------------------------------
-
module
(
clique_status
).
%
% API
-
export
([
parse
/
3
,
text
/
1
,
list
/
1
,
list
/
2
,
table
/
1
,
alert
/
1
,
is_status
/
1
,
usage
/
0
]).
-
include
(
"
clique_status_types.hrl
"
).
-
export_type
([
status
/
0
]).
-
spec
parse
(
status
(),
fun
(),
Acc0
::
term
())
->
term
().
parse
([],
Fun
,
Acc
)
->
Fun
(
done
,
Acc
);
%
% Alert is currently the only non-leaf element
parse
([{
alert
,
Elem
} |
T
],
Fun
,
Acc
)
->
Acc1
=
Fun
(
alert
,
Acc
),
Acc2
=
parse
(
Elem
,
Fun
,
Acc1
),
Acc3
=
Fun
(
alert_done
,
Acc2
),
parse
(
T
,
Fun
,
Acc3
);
%
% Leaf elements
parse
([
Elem
|
T
],
Fun
,
Acc
)
->
Acc1
=
Fun
(
Elem
,
Acc
),
parse
(
T
,
Fun
,
Acc1
).
%
% @doc Is the given value a status type?
-
spec
is_status
(
any
())
->
boolean
().
is_status
(
L
)
when
is_list
(
L
)
->
is_status
(
hd
(
L
));
is_status
({
text
,
_
})
->
true
;
is_status
({
list
,
_
,
_
})
->
true
;
is_status
({
table
,
_
,
_
})
->
true
;
is_status
({
alert
,
_
})
->
true
;
is_status
(
_
)
->
false
.
-
spec
text
(
iolist
())
->
text
().
text
(
IoList
)
->
{
text
,
IoList
}.
-
spec
list
([
iolist
()])
->
status_list
().
list
(
Values
)
->
{
list
,
Values
}.
-
spec
list
(
iolist
(), [
iolist
()])
->
status_list
().
list
(
Title
,
Values
)
->
{
list
,
Title
,
Values
}.
%
% @doc A table is constructed from a list of proplists. Each proplist
%
% represents a row in the table. The keys in the first row represent
%
% column headers; each following row (proplist) must contain the same
%
% number of tagged tuples but the keys are ignored.
-
spec
table
([[{
atom
() |
string
(),
term
()}]])
->
table
().
table
(
Proplists
)
->
{
table
,
Proplists
}.
%
% A list of elements
-
spec
alert
([
status_list
() |
table
() |
text
()])
->
alert
().
alert
(
List
)
->
{
alert
,
List
}.
%
% @doc Using the usage construct, a clique run can indicate that
%
% clique should display status for the current level.
usage
()
->
usage
.
Back
|
FazBrowse Home
|
New Git URL