Exemple #1
0
 def __init__(self):
   self._responses = []
   self.state_handler = FnApiRunner.SimpleState()
   self.control_handler = self
   self.data_plane_handler = data_plane.InMemoryDataChannel()
   self.worker = sdk_worker.SdkWorker(
       self.state_handler, data_plane.InMemoryDataChannelFactory(
           self.data_plane_handler.inverse()))
Exemple #2
0
 def __init__(self):
   self.state_handler = FnApiRunner.StateServicer()
   self.control_handler = self
   self.data_plane_handler = data_plane.InMemoryDataChannel()
   self.worker = sdk_worker.SdkWorker(
       self.state_handler, data_plane.InMemoryDataChannelFactory(
           self.data_plane_handler.inverse()), {})
   self._uid_counter = 0
Exemple #3
0
 def __init__(self, unused_payload, state):
   super(EmbeddedWorkerHandler, self).__init__(
       self, data_plane.InMemoryDataChannel(), state)
   self.worker = sdk_worker.SdkWorker(
       FnApiRunner.SingletonStateHandlerFactory(self.state),
       data_plane.InMemoryDataChannelFactory(
           self.data_plane_handler.inverse()), {})
   self._uid_counter = 0
Exemple #4
0
 def __init__(self,
              unused_payload,  # type: None
              state,  # type: sdk_worker.StateHandler
              provision_info,  # type: Optional[ExtendedProvisionInfo]
              worker_manager,  # type: WorkerHandlerManager
             ):
   # type: (...) -> None
   super(EmbeddedWorkerHandler, self).__init__(
       self, data_plane.InMemoryDataChannel(), state, provision_info)
   self.control_conn = self  # type: ignore  # need Protocol to describe this
   self.data_conn = self.data_plane_handler
   state_cache = StateCache(STATE_CACHE_SIZE)
   self.bundle_processor_cache = sdk_worker.BundleProcessorCache(
       SingletonStateHandlerFactory(
           sdk_worker.CachingStateHandler(state_cache, state)),
       data_plane.InMemoryDataChannelFactory(
           self.data_plane_handler.inverse()),
       worker_manager._process_bundle_descriptors)
   self.worker = sdk_worker.SdkWorker(
       self.bundle_processor_cache,
       state_cache_metrics_fn=state_cache.get_monitoring_infos)
   self._uid_counter = 0
Exemple #5
0
 def test_in_memory_data_channel(self):
     channel = data_plane.InMemoryDataChannel()
     self._data_channel_test(channel, channel.inverse())