def __init__(self, stream, shard, consumer=None): self.stream = stream self.shard = shard self.batch_size = 100 self.client = Kinesis(stream) if consumer is None else Kinesis( stream, consumer) self.log = Util.get_logger("consumer:{}".format(self.stream))
def __init__(self, payload): self.log = Util.get_logger("Block") self.payload = payload self.height = self.dict()["height"] self.total_tx = self.dict()["nTx"] self.total_btc_sent = self.dict()["totalBTCSent"] / 100000000 self.found_by_link = self.dict()["foundBy"]["link"] self.found_by_tx_id = self.found_by_link.split("/")[-1]
def __init__(self, payload): self.log = Util.get_logger("Transaction") self.payload = payload self.size = self.dict()["size"] self.input_count = len(self.dict()["inputs"]) self.input_values = [in_dict["prev_out"]["value"] for in_dict in self.dict()["inputs"]] self.output_count = len(self.dict()["out"]) self.output_values = [out_dict["value"] for out_dict in self.dict()["out"]]
def __init__(self, rfile, dfile, stream, batch_size): self.rfile = rfile self.dfile = dfile self.stream = stream self.batch_size = batch_size self.client = Kinesis(self.stream) mapper = {} with open(rfile, 'r') as csv_file: ref_reader = csv.reader(csv_file, delimiter=',', quotechar='"') next(ref_reader, None) for ref_data in ref_reader: ref = Symbol(ref_data) mapper[ref.company_id] = ref company_id = self.dfile.split('/')[-1].split('.')[0] self.symbol = mapper[company_id].symbol self.log = Util.get_logger("producer:{}".format(self.stream))
def __init__(self, stream_name, consumer_name=None): self.stream_name = stream_name self.client = boto3.client("kinesis") self.log = Util.get_logger("kinesis") self.consumer_name = consumer_name if consumer_name is not None else "default" self.stream_arn = self.client.describe_stream(StreamName=stream_name)["StreamDescription"]["StreamARN"]