{"action":"created","comment":{"url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/comments/43995471","id":43995471,"diff_hunk":"@@ -4,44 +4,94 @@\n \"\"\"\n \n from Queue import Queue\n-\n-# TODO(yubo): Finish implementing the classes and Events for this.\n-\n+from packet import *\n+from common import *\n+from event import *\n \n class LinkBuffer(object):\n     \"\"\"\n     Representation of a Link's FIFO buffer.\n-\n-    TODO(team): Parameters related to link congestion, so we can have dynamic\n-    routing table updates.\n-    TODO(yubo): Functions for whether this is full etc.\n     \"\"\"\n \n-    def __init__(self, buffer_size_bits=None, queue=Queue()):\n+    # TODO(team): Parameters related to link congestion, so we can have dynamic\n+    # routing table updates.\n+    # TODO(yubo): packet_exemption_times deque\n+\n+    def __init__(self, max_buffer_size_bits=None, queue=Queue()):\n         \"\"\"\n-        :ivar int buffer_size_bits: maximum buffer size in bits.\n+        :ivar int max_buffer_size_bits: maximum buffer size in bits.\n         :ivar Queue queue: a FIFO queue of LinkBufferElements\n         \"\"\"\n-        self.buffer_size_bits = buffer_size_bits\n+        self.max_buffer_size_bits = max_buffer_size_bits\n         self.queue = queue\n+        self.curr_buffer_size_bits = 0 # size of current buffer in bits\n \n     def __repr__(self):\n         return str(self.__dict__)\n \n+    def remaining(self):\n+        \"\"\"\n+        returns remaining size in buffer in bits\n+\n+        not strictly necessary, push() will check remaining() condition\n+        :return: remaining buffer size in bits\n+        \"\"\"\n+        return self.max_buffer_size_bits - self.curr_buffer_size_bits\n+\n+    def push(self, packet, dest_device_addr, global_clock_sec):","path":"network_simulator/link.py","position":48,"original_position":48,"commit_id":"e0a8f42dc8da97b9674e26a6f86176ea779b53b7","original_commit_id":"e0a8f42dc8da97b9674e26a6f86176ea779b53b7","user":{"login":"sharonyang","id":6145451,"avatar_url":"https://avatars.githubusercontent.com/u/6145451?v=3","gravatar_id":"","url":"https://api.github.com/users/sharonyang","html_url":"https://github.com/sharonyang","followers_url":"https://api.github.com/users/sharonyang/followers","following_url":"https://api.github.com/users/sharonyang/following{/other_user}","gists_url":"https://api.github.com/users/sharonyang/gists{/gist_id}","starred_url":"https://api.github.com/users/sharonyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sharonyang/subscriptions","organizations_url":"https://api.github.com/users/sharonyang/orgs","repos_url":"https://api.github.com/users/sharonyang/repos","events_url":"https://api.github.com/users/sharonyang/events{/privacy}","received_events_url":"https://api.github.com/users/sharonyang/received_events","type":"User","site_admin":false},"body":"I thought we can retrieve dest_device_addr from the packet?","created_at":"2015-11-05T10:15:26Z","updated_at":"2015-11-05T10:15:26Z","html_url":"https://github.com/lakshbhasin/network_simulator/pull/11#discussion_r43995471","pull_request_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/comments/43995471"},"html":{"href":"https://github.com/lakshbhasin/network_simulator/pull/11#discussion_r43995471"},"pull_request":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11","id":49788523,"html_url":"https://github.com/lakshbhasin/network_simulator/pull/11","diff_url":"https://github.com/lakshbhasin/network_simulator/pull/11.diff","patch_url":"https://github.com/lakshbhasin/network_simulator/pull/11.patch","issue_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/11","number":11,"state":"open","locked":false,"title":"Link basics yubo","user":{"login":"yubo56","id":5651687,"avatar_url":"https://avatars.githubusercontent.com/u/5651687?v=3","gravatar_id":"","url":"https://api.github.com/users/yubo56","html_url":"https://github.com/yubo56","followers_url":"https://api.github.com/users/yubo56/followers","following_url":"https://api.github.com/users/yubo56/following{/other_user}","gists_url":"https://api.github.com/users/yubo56/gists{/gist_id}","starred_url":"https://api.github.com/users/yubo56/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yubo56/subscriptions","organizations_url":"https://api.github.com/users/yubo56/orgs","repos_url":"https://api.github.com/users/yubo56/repos","events_url":"https://api.github.com/users/yubo56/events{/privacy}","received_events_url":"https://api.github.com/users/yubo56/received_events","type":"User","site_admin":false},"body":"Implemented Link and related subclasses/events. Notably, LinkSendEvent and DeviceToLinkEvent should be working.\r\n\r\nRecords timing of pushed LinkBufferElements for possible future dynamic deque of wait times, but currently not implemented.","created_at":"2015-11-05T06:54:18Z","updated_at":"2015-11-05T10:15:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4405587b13ecfbf5479463c2cb880d0f3922d434","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11/commits","review_comments_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11/comments","review_comment_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/11/comments","statuses_url":"https://api.github.com/repos/lakshbhasin/network_simulator/statuses/e0a8f42dc8da97b9674e26a6f86176ea779b53b7","head":{"label":"lakshbhasin:link-basics-yubo","ref":"link-basics-yubo","sha":"e0a8f42dc8da97b9674e26a6f86176ea779b53b7","user":{"login":"lakshbhasin","id":1183879,"avatar_url":"https://avatars.githubusercontent.com/u/1183879?v=3","gravatar_id":"","url":"https://api.github.com/users/lakshbhasin","html_url":"https://github.com/lakshbhasin","followers_url":"https://api.github.com/users/lakshbhasin/followers","following_url":"https://api.github.com/users/lakshbhasin/following{/other_user}","gists_url":"https://api.github.com/users/lakshbhasin/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshbhasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshbhasin/subscriptions","organizations_url":"https://api.github.com/users/lakshbhasin/orgs","repos_url":"https://api.github.com/users/lakshbhasin/repos","events_url":"https://api.github.com/users/lakshbhasin/events{/privacy}","received_events_url":"https://api.github.com/users/lakshbhasin/received_events","type":"User","site_admin":false},"repo":{"id":44171299,"name":"network_simulator","full_name":"lakshbhasin/network_simulator","owner":{"login":"lakshbhasin","id":1183879,"avatar_url":"https://avatars.githubusercontent.com/u/1183879?v=3","gravatar_id":"","url":"https://api.github.com/users/lakshbhasin","html_url":"https://github.com/lakshbhasin","followers_url":"https://api.github.com/users/lakshbhasin/followers","following_url":"https://api.github.com/users/lakshbhasin/following{/other_user}","gists_url":"https://api.github.com/users/lakshbhasin/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshbhasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshbhasin/subscriptions","organizations_url":"https://api.github.com/users/lakshbhasin/orgs","repos_url":"https://api.github.com/users/lakshbhasin/repos","events_url":"https://api.github.com/users/lakshbhasin/events{/privacy}","received_events_url":"https://api.github.com/users/lakshbhasin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lakshbhasin/network_simulator","description":"A network simulator for the project portion of CS 143","fork":false,"url":"https://api.github.com/repos/lakshbhasin/network_simulator","forks_url":"https://api.github.com/repos/lakshbhasin/network_simulator/forks","keys_url":"https://api.github.com/repos/lakshbhasin/network_simulator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lakshbhasin/network_simulator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lakshbhasin/network_simulator/teams","hooks_url":"https://api.github.com/repos/lakshbhasin/network_simulator/hooks","issue_events_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/events{/number}","events_url":"https://api.github.com/repos/lakshbhasin/network_simulator/events","assignees_url":"https://api.github.com/repos/lakshbhasin/network_simulator/assignees{/user}","branches_url":"https://api.github.com/repos/lakshbhasin/network_simulator/branches{/branch}","tags_url":"https://api.github.com/repos/lakshbhasin/network_simulator/tags","blobs_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/refs{/sha}","trees_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lakshbhasin/network_simulator/statuses/{sha}","languages_url":"https://api.github.com/repos/lakshbhasin/network_simulator/languages","stargazers_url":"https://api.github.com/repos/lakshbhasin/network_simulator/stargazers","contributors_url":"https://api.github.com/repos/lakshbhasin/network_simulator/contributors","subscribers_url":"https://api.github.com/repos/lakshbhasin/network_simulator/subscribers","subscription_url":"https://api.github.com/repos/lakshbhasin/network_simulator/subscription","commits_url":"https://api.github.com/repos/lakshbhasin/network_simulator/commits{/sha}","git_commits_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/commits{/sha}","comments_url":"https://api.github.com/repos/lakshbhasin/network_simulator/comments{/number}","issue_comment_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/comments{/number}","contents_url":"https://api.github.com/repos/lakshbhasin/network_simulator/contents/{+path}","compare_url":"https://api.github.com/repos/lakshbhasin/network_simulator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lakshbhasin/network_simulator/merges","archive_url":"https://api.github.com/repos/lakshbhasin/network_simulator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lakshbhasin/network_simulator/downloads","issues_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues{/number}","pulls_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls{/number}","milestones_url":"https://api.github.com/repos/lakshbhasin/network_simulator/milestones{/number}","notifications_url":"https://api.github.com/repos/lakshbhasin/network_simulator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lakshbhasin/network_simulator/labels{/name}","releases_url":"https://api.github.com/repos/lakshbhasin/network_simulator/releases{/id}","created_at":"2015-10-13T11:21:24Z","updated_at":"2015-10-25T21:16:11Z","pushed_at":"2015-11-05T09:37:33Z","git_url":"git://github.com/lakshbhasin/network_simulator.git","ssh_url":"git@github.com:lakshbhasin/network_simulator.git","clone_url":"https://github.com/lakshbhasin/network_simulator.git","svn_url":"https://github.com/lakshbhasin/network_simulator","homepage":null,"size":324,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"lakshbhasin:master","ref":"master","sha":"a8444503fb51c60c2237d1a615a9682bee02b6f9","user":{"login":"lakshbhasin","id":1183879,"avatar_url":"https://avatars.githubusercontent.com/u/1183879?v=3","gravatar_id":"","url":"https://api.github.com/users/lakshbhasin","html_url":"https://github.com/lakshbhasin","followers_url":"https://api.github.com/users/lakshbhasin/followers","following_url":"https://api.github.com/users/lakshbhasin/following{/other_user}","gists_url":"https://api.github.com/users/lakshbhasin/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshbhasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshbhasin/subscriptions","organizations_url":"https://api.github.com/users/lakshbhasin/orgs","repos_url":"https://api.github.com/users/lakshbhasin/repos","events_url":"https://api.github.com/users/lakshbhasin/events{/privacy}","received_events_url":"https://api.github.com/users/lakshbhasin/received_events","type":"User","site_admin":false},"repo":{"id":44171299,"name":"network_simulator","full_name":"lakshbhasin/network_simulator","owner":{"login":"lakshbhasin","id":1183879,"avatar_url":"https://avatars.githubusercontent.com/u/1183879?v=3","gravatar_id":"","url":"https://api.github.com/users/lakshbhasin","html_url":"https://github.com/lakshbhasin","followers_url":"https://api.github.com/users/lakshbhasin/followers","following_url":"https://api.github.com/users/lakshbhasin/following{/other_user}","gists_url":"https://api.github.com/users/lakshbhasin/gists{/gist_id}","starred_url":"https://api.github.com/users/lakshbhasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lakshbhasin/subscriptions","organizations_url":"https://api.github.com/users/lakshbhasin/orgs","repos_url":"https://api.github.com/users/lakshbhasin/repos","events_url":"https://api.github.com/users/lakshbhasin/events{/privacy}","received_events_url":"https://api.github.com/users/lakshbhasin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lakshbhasin/network_simulator","description":"A network simulator for the project portion of CS 143","fork":false,"url":"https://api.github.com/repos/lakshbhasin/network_simulator","forks_url":"https://api.github.com/repos/lakshbhasin/network_simulator/forks","keys_url":"https://api.github.com/repos/lakshbhasin/network_simulator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lakshbhasin/network_simulator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lakshbhasin/network_simulator/teams","hooks_url":"https://api.github.com/repos/lakshbhasin/network_simulator/hooks","issue_events_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/events{/number}","events_url":"https://api.github.com/repos/lakshbhasin/network_simulator/events","assignees_url":"https://api.github.com/repos/lakshbhasin/network_simulator/assignees{/user}","branches_url":"https://api.github.com/repos/lakshbhasin/network_simulator/branches{/branch}","tags_url":"https://api.github.com/repos/lakshbhasin/network_simulator/tags","blobs_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/refs{/sha}","trees_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lakshbhasin/network_simulator/statuses/{sha}","languages_url":"https://api.github.com/repos/lakshbhasin/network_simulator/languages","stargazers_url":"https://api.github.com/repos/lakshbhasin/network_simulator/stargazers","contributors_url":"https://api.github.com/repos/lakshbhasin/network_simulator/contributors","subscribers_url":"https://api.github.com/repos/lakshbhasin/network_simulator/subscribers","subscription_url":"https://api.github.com/repos/lakshbhasin/network_simulator/subscription","commits_url":"https://api.github.com/repos/lakshbhasin/network_simulator/commits{/sha}","git_commits_url":"https://api.github.com/repos/lakshbhasin/network_simulator/git/commits{/sha}","comments_url":"https://api.github.com/repos/lakshbhasin/network_simulator/comments{/number}","issue_comment_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/comments{/number}","contents_url":"https://api.github.com/repos/lakshbhasin/network_simulator/contents/{+path}","compare_url":"https://api.github.com/repos/lakshbhasin/network_simulator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lakshbhasin/network_simulator/merges","archive_url":"https://api.github.com/repos/lakshbhasin/network_simulator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lakshbhasin/network_simulator/downloads","issues_url":"https://api.github.com/repos/lakshbhasin/network_simulator/issues{/number}","pulls_url":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls{/number}","milestones_url":"https://api.github.com/repos/lakshbhasin/network_simulator/milestones{/number}","notifications_url":"https://api.github.com/repos/lakshbhasin/network_simulator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lakshbhasin/network_simulator/labels{/name}","releases_url":"https://api.github.com/repos/lakshbhasin/network_simulator/releases{/id}","created_at":"2015-10-13T11:21:24Z","updated_at":"2015-10-25T21:16:11Z","pushed_at":"2015-11-05T09:37:33Z","git_url":"git://github.com/lakshbhasin/network_simulator.git","ssh_url":"git@github.com:lakshbhasin/network_simulator.git","clone_url":"https://github.com/lakshbhasin/network_simulator.git","svn_url":"https://github.com/lakshbhasin/network_simulator","homepage":null,"size":324,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11"},"html":{"href":"https://github.com/lakshbhasin/network_simulator/pull/11"},"issue":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/11"},"comments":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/lakshbhasin/network_simulator/statuses/e0a8f42dc8da97b9674e26a6f86176ea779b53b7"}}}}