Skip to content

Instantly share code, notes, and snippets.

@iyedb
Created February 23, 2017 19:10
Show Gist options
  • Save iyedb/936259c4ebcbb6fbdca89ff2f792177c to your computer and use it in GitHub Desktop.
Save iyedb/936259c4ebcbb6fbdca89ff2f792177c to your computer and use it in GitHub Desktop.

Revisions

  1. iyedb created this gist Feb 23, 2017.
    44 changes: 44 additions & 0 deletions hashcode.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,44 @@
    class Cache(object):
    def __init__(self, seq, size, latency):
    self.size = size
    self.seq = seq
    self.latency = latency

    def put(self, video):
    if self.size >= video:
    self.size -= video
    return True
    return False


    class Endpoint(object):

    def __init__(self, seq, caches, dc_latency):
    self.seq = seq
    self.caches = caches
    self.dc_latency = dc_latency

    def place_video(self, video):
    pass


    class Demand(object):
    def __init__(self, nbreqs, endpoint, video):
    self.nbreqs = nbreqs
    self.endpoint = endpoint
    self.video = video


    def buildrepartition(demand):
    pass


    repartition = []
    demands = []



    for d in demands:
    repartition.append(buildrepartition(d))

    # 1500 requests for video 3 coming from endpoint 0