Class: Dryad::Core::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/dryad/core/service.rb

Constant Summary collapse

TYPE =
"microservice"
DEFAULT_OPTIONS =
{
  :portals => [],
  :load_balancing => []
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Service

Returns a new instance of Service.



13
14
15
16
17
18
19
20
21
# File 'lib/dryad/core/service.rb', line 13

def initialize(options = {})
  options = DEFAULT_OPTIONS.merge(options)
  @name = options[:name]
  @address = options[:address]
  @group = options[:group]
  @portals = options[:portals]
  @priority = options[:priority]
  @load_balancing = options[:load_balancing]
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def address
  @address
end

#groupObject

Returns the value of attribute group.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def group
  @group
end

#load_balancingObject

Returns the value of attribute load_balancing.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def load_balancing
  @load_balancing
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def name
  @name
end

#portalsObject

Returns the value of attribute portals.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def portals
  @portals
end

#priorityObject

Returns the value of attribute priority.



4
5
6
# File 'lib/dryad/core/service.rb', line 4

def priority
  @priority
end

Class Method Details

.full_name(schema, name) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/dryad/core/service.rb', line 28

def full_name(schema, name)
  case schema
  when Schema::HTTP
    name
  else
    "#{name}-#{schema}"
  end
end

Instance Method Details

#type_nameObject



23
24
25
# File 'lib/dryad/core/service.rb', line 23

def type_name
  Dryad::Core::Service::TYPE
end