コード例 #1
0
    def __init__(self, max_byte_size, max_entries):
        self.key_map = {}
        self.key_ids = common_utils.IDStore(2**16)
        self.lru_ids = common_utils.IDStore(2**16)
        self.state_size = 0
        self.num_vals = 0
        self.max_vals = max_entries
        self.max_state_size = max_byte_size
        self.pinned = None
        self.remove_val_cb = None
        #self.lru = deque()
        self.lru = LRU()
        self.lru_idx_to_ve = {}
        self.key_idx_to_ke = {}

        for (k, v) in g_default_kvs:
            ke = self.FindKeyEntry(key)
            if ke is None:
                self.key_map[key] = ke = self.NewKE(key)
            ke.val_map[val] = ve = self.NewVE(key, val, ke)
            ve.lru_idx = lru_idx = self.GetNextUnusedLruId()
            self.lru_idx_to_ve[lru_idx] = ve
            self.lru_ids.minimum_id = lru_idx
コード例 #2
0
ファイル: __init__.py プロジェクト: mnot/compression-test
 def __init__(self, options, is_request, params):
   BaseProcessor.__init__(self, options, is_request, params)
   description = "request"
   if not is_request:
     description = "response"
   self.compressor   = spdy4_codec_impl.Spdy4CoDe(params, description, options)
   self.decompressor = spdy4_codec_impl.Spdy4CoDe(params, description, options)
   self.hosts = {}
   self.group_ids = common_utils.IDStore(255)
   if is_request:
     self.compressor.huffman = request_huffman
     self.decompressor.huffman = request_huffman
   else:
     self.compressor.huffman = response_huffman
     self.decompressor.huffman = response_huffman
コード例 #3
0
 def __init__(self, options, is_request, params):
   # 'params' is ignored
   self.compressor   = spdy4_codec_impl.Spdy4CoDe()
   self.decompressor = spdy4_codec_impl.Spdy4CoDe()
   self.options = options
   self.hosts = {}
   self.group_ids = common_utils.IDStore(2**31)
   self.wf = self.compressor.wf
   self.name = "delta2_bohe"
   if is_request:
     request_freq_table = header_freq_tables.request_freq_table
     self.compressor.huffman_table = huffman.Huffman(request_freq_table)
     self.decompressor.huffman_table = huffman.Huffman(request_freq_table)
   else:
     response_freq_table = header_freq_tables.response_freq_table
     self.compressor.huffman_table = huffman.Huffman(response_freq_table)
     self.decompressor.huffman_table = huffman.Huffman(response_freq_table)
コード例 #4
0
 def __init__(self, options, is_request, params):
     BaseProcessor.__init__(self, options, is_request, params)
     self.compressor = spdy4_codec_impl.Spdy4CoDe(params)
     self.decompressor = spdy4_codec_impl.Spdy4CoDe(params)
     self.hosts = {}
     self.group_ids = common_utils.IDStore(255)
     self.wf = self.compressor.wf
     if is_request:
         request_freq_table = header_freq_tables.request_freq_table
         self.compressor.huffman_table = huffman.Huffman(request_freq_table)
         self.decompressor.huffman_table = huffman.Huffman(
             request_freq_table)
     else:
         response_freq_table = header_freq_tables.response_freq_table
         self.compressor.huffman_table = huffman.Huffman(
             response_freq_table)
         self.decompressor.huffman_table = huffman.Huffman(
             response_freq_table)