Ejemplo n.º 1
0
    def __init__(self, env):
        self._env = env
        self.put_queue = self.PutQueue()
        """Queue/list of events waiting to get something out of the resource.
        """
        self.get_queue = self.GetQueue()
        """Queue/list of events waiting to put something into the resource."""

        # Bind event constructors as methods
        BoundClass.bind_early(self)
Ejemplo n.º 2
0
    def __init__(self, env, capacity):
        self._env = env
        self._capacity = capacity
        self.put_queue = self.PutQueue()
        """Queue of pending *put* requests."""
        self.get_queue = self.GetQueue()
        """Queue of pending *get* requests."""

        # Bind event constructors as methods
        BoundClass.bind_early(self)
Ejemplo n.º 3
0
    def __init__(self, env):
        self._env = env
        self.put_queue = self.PutQueue()
        """Queue/list of events waiting to get something out of the resource.
        """
        self.get_queue = self.GetQueue()
        """Queue/list of events waiting to put something into the resource."""

        # Bind event constructors as methods
        BoundClass.bind_early(self)
Ejemplo n.º 4
0
    def __init__(self, env, capacity):
        self._env = env
        self._capacity = capacity
        self.put_queue = self.PutQueue()
        """Queue of pending *put* requests."""
        self.get_queue = self.GetQueue()
        """Queue of pending *get* requests."""

        # Bind event constructors as methods
        BoundClass.bind_early(self)
    def __init__(self, fds=None):
        if fds is None:
            fds = {}

        self._queue = []
        """A list with all currently scheduled events."""
        self._eid = count()
        self._active_proc = None

        self.fds = fds

        BoundClass.bind_early(self)
Ejemplo n.º 6
0
    def __init__(self, env, capacity=float('inf')):
        # BaseResource
        self._env = env
        self._capacity = capacity
        self.lock = threading.RLock()
        self.put_queue = SynchronizedList(self.lock)
        self.get_queue = SynchronizedList(self.lock)
        BoundClass.bind_early(self)

        self.callbacks = []
        # Store
        self.items = []
Ejemplo n.º 7
0
 def __init__(self, env, capacity=float('inf'), hard_cap=False, items=()):
     self.env = env
     #: Capacity of the queue (maximum number of items).
     self.capacity = capacity
     self._hard_cap = hard_cap
     self.items = list(items)
     self._putters = []
     self._getters = []
     self._any_waiters = []
     self._full_waiters = []
     self._put_hook = None
     self._get_hook = None
     BoundClass.bind_early(self)
Ejemplo n.º 8
0
 def __init__(self, env, capacity=float('inf'), hard_cap=False, items=(),
              name=None):
     self.env = env
     #: Capacity of the queue (maximum number of items).
     self.capacity = capacity
     self._hard_cap = hard_cap
     self.items = list(items)
     self.name = name
     self._put_waiters = []
     self._get_waiters = []
     self._at_most_waiters = []
     self._at_least_waiters = []
     self._put_hook = None
     self._get_hook = None
     BoundClass.bind_early(self)
Ejemplo n.º 9
0
 def __init__(self, env, capacity=float('inf'), init=0, hard_cap=False,
              name=None):
     self.env = env
     #: Capacity of the pool (maximum level).
     self.capacity = capacity
     #: Current fill level of the pool.
     self.level = init
     self._hard_cap = hard_cap
     self.name = name
     self._put_waiters = []
     self._get_waiters = []
     self._at_most_waiters = []
     self._at_least_waiters = []
     self._put_hook = None
     self._get_hook = None
     BoundClass.bind_early(self)
Ejemplo n.º 10
0
 def __init__(self, env, capacity=float('inf'), init=0, hard_cap=False,
              name=None):
     self.env = env
     #: Capacity of the queue (maximum number of items).
     self.capacity = capacity
     self._hard_cap = hard_cap
     self.level = init
     self.name = name
     self._putters = []
     self._getters = []
     self._new_waiters = []
     self._any_waiters = []
     self._full_waiters = []
     self._put_hook = None
     self._get_hook = None
     BoundClass.bind_early(self)
Ejemplo n.º 11
0
 def __init__(self,
              env,
              capacity=float('inf'),
              init=0,
              hard_cap=False,
              name=None):
     self.env = env
     #: Capacity of the pool (maximum level).
     self.capacity = capacity
     #: Current fill level of the pool.
     self.level = init
     self._hard_cap = hard_cap
     self.name = name
     self._put_waiters = []
     self._get_waiters = []
     self._at_most_waiters = []
     self._at_least_waiters = []
     self._put_hook = None
     self._get_hook = None
     BoundClass.bind_early(self)
Ejemplo n.º 12
0
 def __init__(
     self,
     env: Environment,
     capacity: Union[int, float] = float('inf'),
     hard_cap: bool = False,
     items: Iterable[ItemType] = (),
     name: Optional[str] = None,
 ) -> None:
     self.env = env
     #: Capacity of the queue (maximum number of items).
     self.capacity = capacity
     self._hard_cap = hard_cap
     self.items: List[ItemType] = list(items)
     self.name = name
     self._put_waiters: List[QueuePutEvent] = []
     self._get_waiters: List[QueueGetEvent] = []
     self._at_most_waiters: List[QueueWhenAtMostEvent] = []
     self._at_least_waiters: List[QueueWhenAtLeastEvent] = []
     self._put_hook: Optional[Callable[[], Any]] = None
     self._get_hook: Optional[Callable[[], Any]] = None
     BoundClass.bind_early(self)
Ejemplo n.º 13
0
 def __init__(
     self,
     env: Environment,
     capacity: PoolAmount = float('inf'),
     init: PoolAmount = 0,
     hard_cap: bool = False,
     name: Optional[str] = None,
 ):
     self.env = env
     #: Capacity of the pool (maximum level).
     self.capacity = capacity
     #: Current fill level of the pool.
     self.level = init
     self._hard_cap = hard_cap
     self.name = name
     self._put_waiters: List[PoolPutEvent] = []
     self._get_waiters: List[PoolGetEvent] = []
     self._at_most_waiters: List[PoolWhenAtMostEvent] = []
     self._at_least_waiters: List[PoolWhenAtLeastEvent] = []
     self._put_hook: Optional[Callable[[], Any]] = None
     self._get_hook: Optional[Callable[[], Any]] = None
     BoundClass.bind_early(self)