def generate_random_chunk(block_id, key=os.urandom(32), size=1000, min_val=0, max_val=30): chunk = ChunkData() for i in range(size): entry = DoubleEntry(int(time.time()), "test", float(random.uniform(min_val, max_val))) chunk.add_entry(entry) stream_ident = DataStreamIdentifier(PRIVATE_KEY.public_key().address(), STREAMID, NONCE, TXID) return create_cloud_chunk(stream_ident, block_id, get_priv_key(PRIVATE_KEY), 10, key, chunk)
def _generate_cloud_chunk(self, block_id, sym_key, chunk, timer_chunk): stream_ident = DataStreamIdentifier( self.bc_privatekey.public_key().address(), self.stream_id, self.policy_nonce, self.txid) return create_cloud_chunk(stream_ident, block_id, self.local_private_key, 0, sym_key, chunk, time_keeper=timer_chunk)
def generate_random_chunk(private_key, block_id, stream_identifier, tag="test", key=os.urandom(32), size=1000, max_float=1000): chunk = ChunkData() for i in range(size): entry = DoubleEntry(int(time.time()), tag, random.uniform(0, max_float)) chunk.add_entry(entry) return create_cloud_chunk(stream_identifier, block_id, get_priv_key(private_key), 0, key, chunk)
def generate_random_chunk_from_data(chunk, private_key, block_id, stream_identifier, time_keeper=TimeKeeper(), do_compression=False): time_keeper.start_clock() cloud_chunk = create_cloud_chunk(stream_identifier, block_id, get_priv_key(private_key), 0, aes_key, chunk, use_compression=do_compression) time_keeper.stop_clock("time_create_chunk") return cloud_chunk
def generate_cloud_chunk(chunk_data, private_key, block_id, stream_identifier, key=os.urandom(32)): return create_cloud_chunk(stream_identifier, block_id, get_priv_key(private_key), 0, key, chunk_data)