Ejemplo n.º 1
0
 def append_raw(
         self,
         state_key,  # type: beam_fn_api_pb2.StateKey
         data  # type: bytes
 ):
     # type: (...) -> _Future
     with self._lock:
         self._state[self._to_key(state_key)].append(data)
     return _Future.done()
Ejemplo n.º 2
0
 def clear(self, state_key):
     # type: (beam_fn_api_pb2.StateKey) -> _Future
     with self._lock:
         try:
             del self._state[self._to_key(state_key)]
         except KeyError:
             # This may happen with the caching layer across bundles. Caching may
             # skip this storage layer for a blocking_get(key) request. Without
             # the caching, the state for a key would be initialized via the
             # defaultdict that _state uses.
             pass
     return _Future.done()