-
Notifications
You must be signed in to change notification settings - Fork 1
/
ig_jobs.keyspace
179 lines (169 loc) · 6.13 KB
/
ig_jobs.keyspace
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# "First, solve the problem. Then, write the code. -John Johnson"
# "Or use Vangav M"
# www.vangav.com
# MIT License
#
# Copyright (c) 2016 Vangav
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Community
# Facebook Group: Vangav Open Source - Backend
# fb.com/groups/575834775932682/
# Facebook Page: Vangav
# fb.com/vangav.f
#
# Third party communities for Vangav Backend
# - play framework
# - cassandra
# - datastax
#
# Tag your question online (e.g.: stack overflow, etc ...) with
# #vangav_backend
# to easier find questions/answers online
# @author mustapha
# fb.com/mustapha.abdallah
{
"description": "used for all jobs-related tables -- a job is an operation that's either executed on a later time or issued by one process and executed by another where a jobs table keeps track of unsuccessful jobs which need to be reexecuted",
"name": "ig_jobs",
"replications": [
{
"description": "used for dev environment",
"name": "dev",
"replication": "'class': 'SimpleStrategy', 'replication_factor' : 1"
}
],
"tables": [
# current_jobs (job_id, job_time, job)
# hourly_current_jobs (year_month_day_hour, job_time, job_id)
# current_jobs
{
"description": "stores jobs to be issued by one service and executed asynchronously by another service -- this table is useful to trace jobs that didn't get succefully executed and retry executing them at a later point in time",
"name": "current_jobs",
"columns": [
{
"name": "job_id",
"type": "uuid"
},
{
"name": "job_time",
"type": "bigint"
},
{
"name": "job",
"type": "blob"
}
],
"partition_keys": [
"job_id"
],
"secondary_keys": [
],
"caching": "ALL",
"order_by": [
],
"queries": [
{
"description": "inserts a new job",
"name": "insert",
"prepared_statement": "INSERT INTO ig_jobs.current_jobs (job_id, job_time, job) VALUES (:job_id, :job_time, :job);"
},
{
"description": "deletes a job",
"name": "delete",
"prepared_statement": "DELETE FROM ig_jobs.current_jobs WHERE job_id = :job_id;"
},
{
"description": "selects a job",
"name": "select",
"prepared_statement": "SELECT job_time, job FROM ig_jobs.current_jobs WHERE job_id = :job_id;"
}
]
},
# hourly_current_jobs
{
"description": "indexes jobs per-hour and sorts them by the oldest",
"name": "hourly_current_jobs",
"columns": [
{
"name": "year_month_day_hour",
"type": "varchar"
},
{
"name": "job_time",
"type": "bigint"
},
{
"name": "job_id",
"type": "uuid"
}
],
"partition_keys": [
"year_month_day_hour",
"job_time",
"job_id"
],
"secondary_keys": [
],
"caching": "ALL",
"order_by": [
{
"column_name":"job_time",
"order_type":"ASC"
}
],
"queries": [
{
"description": "inserts a new job",
"name": "insert",
"prepared_statement": "INSERT INTO ig_jobs.hourly_current_jobs (year_month_day_hour, job_time, job_id) VALUES (:year_month_day_hour, :job_time, :job_id);"
},
{
"description": "deletes a job",
"name": "delete",
"prepared_statement": "DELETE FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour AND job_time = :job_time AND job_id = :job_id;"
},
{
"description": "selects earliest jobs during an hour with a limit",
"name": "select_earliest_limit",
"prepared_statement": "SELECT job_time, job_id FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour LIMIT 30;"
},
{
"description": "selects jobs at a specific time",
"name": "select_equal",
"prepared_statement": "SELECT job_time, job_id FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour AND job_time = :job_time;"
},
{
"description": "selects jobs at or after a time with a limit",
"name": "select_at_or_after_limit",
"prepared_statement": "SELECT job_time, job_id FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour AND job_time >= :job_time LIMIT 30;"
},
{
"description": "selects jobs after a time with a limit",
"name": "select_after_limit",
"prepared_statement": "SELECT job_time, job_id FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour AND job_time > :job_time LIMIT 30;"
},
{
"description": "selects all jobs jobs within an hour, consider using paging when using this query",
"name": "select",
"prepared_statement": "SELECT job_time, job_id FROM ig_jobs.hourly_current_jobs WHERE year_month_day_hour = :year_month_day_hour;"
}
]
}
]
}