Class: AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Cluster Private

Inherits:
Object
  • Object
show all
Includes:
Support::InfoBaseFind, Support::SendToOle, Support::ServerConnection
Defined in:
lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Object descrbed 1C cluster

Constant Summary collapse

DEF_PORT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Deafult 1C:Enterprise cluster TCP port

'1541'

Instance Attribute Summary

Attributes included from Support::ServerConnection

#host, #password, #port, #user

Instance Method Summary collapse

Methods included from Support::InfoBaseFind

#infobase_find, #infobase_include?

Methods included from Support::SendToOle

#method_missing

Methods included from Support::ServerConnection

#eql?, #host_port, #initialize, #ping?, #tcp_ping

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class AssMaintainer::InfoBase::ServerIb::EnterpriseServers::Support::SendToOle

Instance Method Details

#alive_wprocess_getObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



96
97
98
99
100
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 96

def alive_wprocess_get
  wp_info = wprocesses.select{|p| p.Running == 1 && p.ping?}[0]
  fail 'No alive working processes found' unless wp_info
  wp_info
end

#attach(agent) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Attache cluster into server agent

Parameters:

Raises:

  • (RuntimeError)

    if cluster not found on #sagent server



23
24
25
26
27
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 23

def attach(agent)
  @sagent = agent unless @sagent
  ole_set
  authenticate
end

#authenticateObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Authenticate cluster user

Raises:

  • (RuntimeError)

    if cluster not found on #sagent server



46
47
48
49
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 46

def authenticate
  sagent.Authenticate(ole, user.to_s, password.to_s)
  self
end

#default_portString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns DEF_PORT.

Returns:



16
17
18
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 16

def default_port
  DEF_PORT
end

#drop_infobase!(infobase_wrapper, mode) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Delete infobase

Parameters:



106
107
108
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 106

def drop_infobase!(infobase_wrapper, mode)
  wp_connection(infobase_wrapper).drop_infobase!(mode)
end

#infobase_sessions(ib_name) ⇒ nil Array<Wrappers::Session>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

runned in cluster. nil if infobase ib_name not registred in cluster.

Parameters:

  • ib_name (String)

    infobase name

Returns:

Raises:

  • (RuntimeError)

    unless cluster attached



70
71
72
73
74
75
76
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 70

def infobase_sessions(ib_name)
  ib = infobase_find(ib_name)
  return unless ib
  sagent.GetInfoBaseSessions(ole, ib).map do |s|
    Wrappers::Session.new(s, self)
  end
end

#infobasesArray<WIN32OLE>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

registred in cluster

Returns:

  • (Array<WIN32OLE>)

    aray of IInfoBaseShort ole objects

Raises:

  • (RuntimeError)

    if cluster not found on #sagent server

  • (RuntimeError)

    unless cluster attached



61
62
63
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 61

def infobases
  sagent.GetInfoBases(ole)
end

#oleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns IClusterInfo ole object.

Returns:

  • IClusterInfo ole object

Raises:

  • (RuntimeError)

    if cluster not found on #sagent server



38
39
40
41
42
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 38

def ole
  fail ArgumentError, "Cluster `#{host_port}'"\
    " not found on server `#{sagent.host_port}'" unless @ole
  @ole
end

#sagentServerAgent

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns which cluster attached.

Returns:

Raises:

  • (RuntimeError)

    unless cluster attached



31
32
33
34
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 31

def sagent
  fail 'Cluster must be attachet to ServerAgent' unless @sagent
  @sagent
end

#wp_connection(infobase_wrapper) ⇒ WpConnection

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Connect to working process

Returns:

  • (WpConnection)

    object for comunication with 1C Working process



89
90
91
92
93
94
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 89

def wp_connection(infobase_wrapper)
  if !@wp_connection.nil? && !@wp_connection.ping?
    @wp_connection = nil
  end
  @wp_connection ||= alive_wprocess_get.connect(infobase_wrapper)
end

#wprocessesArray<Wrappers::WorkingProcessInfo]

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

All Working processes in cluster

Returns:



80
81
82
83
84
# File 'lib/ass_maintainer/info_base/server_ib/enterprise_servers/cluster.rb', line 80

def wprocesses
  sagent.GetWorkingProcesses(ole).map do |wpi|
    Wrappers::WorkingProcessInfo.new(wpi, self)
  end
end