-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.py
More file actions
36 lines (25 loc) · 957 Bytes
/
Copy pathmodel.py
File metadata and controls
36 lines (25 loc) · 957 Bytes
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
#!/usr/bin/python2.4
"""Data model.
"""
__author__ = 'allen@thebends.org (Allen Porter)'
import base64
from google.appengine.ext import db
class Torrent(db.Model):
# Base64 encoded "info_hash" argument uniquely identifying the torrent
info_hash = db.StringProperty(required=True)
# Total number of times the tracker has registered a completion
downloaded = db.IntegerProperty()
class TorrentPeerEntry(db.Model):
# Base64 encoded "info_hash" argument identifying the torrent
torrent = db.Reference(Torrent)
# IP:port of the client
ip = db.StringProperty(required=True)
port = db.IntegerProperty(required=True)
# Client supplied identifier
peer_id = db.StringProperty(required=True)
# Total amount downloaded (probably bytes)
downloaded = db.IntegerProperty()
# Total amount uploaded (probably bytes)
uploaded = db.IntegerProperty()
# Last time we saw the client
last_datetime = db.DateTimeProperty(required=True)