Sha256: 1fdf3bd3a3c743e41e72d071d7bcefff96bdb2bac146286ef8fd898162606f8e

Contents?: true

Size: 1.09 KB

Versions: 25

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
module Dynflow
  module Semaphores
    class Abstract

      # Tries to get ticket from the semaphore
      # Returns true if thing got a ticket
      # Rturns false otherwise and puts the thing into the semaphore's queue
      def wait(thing)
        raise NotImplementedError
      end

      # Gets first object from the queue
      def get_waiting
        raise NotImplementedError
      end

      # Checks if there are objects in the queue
      def has_waiting?
        raise NotImpelementedError
      end

      # Returns n tickets to the semaphore
      def release(n = 1)
        raise NotImplementedError
      end

      # Saves the semaphore's state to some persistent storage
      def save
        raise NotImplementedError
      end

      # Tries to get n tickets
      # Returns n if the semaphore has free >= n
      # Returns free if n > free
      def get(n = 1)
        raise NotImplementedErrorn
      end

      # Requests all tickets
      # Returns all free tickets from the semaphore
      def drain
        raise NotImplementedError
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
dynflow-1.8.2 lib/dynflow/semaphores/abstract.rb
dynflow-1.8.1 lib/dynflow/semaphores/abstract.rb
dynflow-1.8.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.7.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.11 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.10 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.8 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.7 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.6 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.5 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.4 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.3 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.2 lib/dynflow/semaphores/abstract.rb
dynflow-1.6.1 lib/dynflow/semaphores/abstract.rb
dynflow-1.4.9 lib/dynflow/semaphores/abstract.rb
dynflow-1.4.8 lib/dynflow/semaphores/abstract.rb
dynflow-1.5.0 lib/dynflow/semaphores/abstract.rb
dynflow-1.4.7 lib/dynflow/semaphores/abstract.rb
dynflow-1.4.6 lib/dynflow/semaphores/abstract.rb
dynflow-1.4.5 lib/dynflow/semaphores/abstract.rb