-
-
Notifications
You must be signed in to change notification settings - Fork 68
/
db.py
45 lines (30 loc) · 975 Bytes
/
db.py
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
"""
Generic Database Adapter
The database is used for storing execute requests and
permalinks, as well as any extra logging required by
the web server and/or backend.
"""
class DB(object):
"""
Abstract base class for database adaptors.
"""
async def add(self, code, language, interacts):
"""
Add an entry to the database.
INPUT:
- ``code`` -- a string
- ``language`` -- a string
- ``interacts`` -- a string
OUTPUT:
- a string -- the identifier key for the entry
"""
raise NotImplementedError
async def get(self, key):
"""
Retrieve the entry from the database matching ``key``.
INPUT:
- ``key`` -- a string
OUTPUT:
- a tuple of three strings: the code, the language, the interact state.
"""
raise NotImplementedError