Esempio n. 1
0
    def create_set_request(self, address_data_map):
        entries = [
            Entry(address=address, data=data)
            for address, data in address_data_map.items()
        ]

        return TpStateSetRequest(entries=entries)
Esempio n. 2
0
    def _make_entries(self, protobuf=True):
        if protobuf:
            return [Entry(address=a, data=d)
                    for a, d in zip(self.addresses, self.data)]

        entries = OrderedDict()
        for a, d in zip(self.addresses, self.data):
            entries[a] = d
        return entries
Esempio n. 3
0
    def create_set_request(self, address_data_map):
        self._validate_addresses(
            [address for address, _ in address_data_map.items()])

        entries = [
            Entry(address=address, data=data)
            for address, data in address_data_map.items()
        ]

        return TpStateSetRequest(entries=entries)
Esempio n. 4
0
    def create_get_response(self, address_data_map):

        # Each Entry has an address, and data.
        # Data can be anything, but transaction processors may assum a
        # certain data type. For example, intkey assumes a dictionary
        # with "Name" in it and stores the "Value". A dictionary is
        # used to deal with hash collisions.

        # GetResponse object has a list of Entry objects
        entries = [
            Entry(address=address, data=data)
            for address, data in address_data_map.items()
        ]

        # Create a GetResponse object
        return TpStateGetResponse(entries=entries)
Esempio n. 5
0
 def _make_entries(self, protobuf=True):
     if protobuf:
         return [Entry(address=a, data=d)
                 for a, d in zip(self.addresses, self.data)]
     return [StateEntry(address=a, data=d)
             for a, d in zip(self.addresses, self.data)]