Class: Aspera::Ascp::Management
- Inherits:
-
Object
- Object
- Aspera::Ascp::Management
- Defined in:
- lib/aspera/ascp/management.rb
Overview
processing of ascp management port events
Constant Summary collapse
- OPERATIONS =
cspell: disable
%w[ NOP START QUERY QUERYRSP STATS STOP ERROR CANCEL DONE RATE FILEERROR SESSION NOTIFICATION INIT VLINK NOTIFICATION PUT WRITE CLOSE SKIP ARGSTOP ]
- PARAMETERS =
%w[ Type File Size Written Bytescont Rate Loss Query Code Password Progress Remaining Elapsed RexInfo BlockInfo DiskInfo RateInfo MinRate Description Elapsedusec ServiceLevel SessionId User Host Encryption Adaptive Direction Remote Port UserStr CommandId StartByte EndByte Token Cookie QueryResponse Source Destination BWMeasurement BWInfo PMTU TransferBytes FileBytes Operation Delay PreTransferFiles PreTransferDirs PreTransferSpecial PreTransferFailed PartialPreTransferBytes PreTransferBytes Priority Transport VlinkID VlinkOn VlinkCapIn VlinkCapOut ManifestFile ArgScansAttempted ArgScansCompleted PathScansAttempted PathScansFailed PathScansIrregular PathScansExcluded DirScansCompleted FileScansCompleted DirCreatesAttempted DirCreatesFailed DirCreatesPassed TransfersAttempted TransfersFailed TransfersPassed TransfersSkipped FallbackProtocol RetryTimeout PreTransferExcluded XferId XferRetry Tags FaspFileArgIndex ArgTransfersStatus ArgTransfersAttempted ArgTransfersFailed ArgTransfersPassed ArgTransfersSkipped FaspFileID RateCap MinRateCap PolicyCap PriorityCap RateLock MinRateLock PolicyLock FileChecksum ServerHostname ServerNodeId ClientNodeId ServerClusterId ClientClusterId FileChecksumType ServerDocroot ClientDocroot NodeUser ClientUser SourcePrefix RemoteAddress TCPPort Cipher ResumePolicy CreatePolicy ManifestPolicy Precalc OverwritePolicy RTTAutocorrect TimePolicy ManifestPath ManifestInprogress PartialFiles FilesEncrypt FilesDecrypt DatagramSize PrepostCommand XoptFlags VLinkVersion PeerVLinkVersion VLinkLocalEnabled VLinkLocalId VLinkLocalCL VLinkRemoteEnabled VLinkRemoteId VLRemoteCL DSPipelineDepth PeerDSPipelineDepth LocalIP SourceBase ReadBlockSize WriteBlockSize ClusterNumNodes ClusterNodeId MoveRange MoveRangeLow MoveRangeHigh Keepalive TestLogin UseProxy ProxyIP RateControlAlgorithm ClientMacAddress Offset ChunkSize PostTransferValidation OverwritePolicyCap ExtraCreatePolicy]
- MGT_HEADER =
Management port start message
'FASPMGR 2'
- MGT_FRAME_SEPARATOR =
empty line is separator to end event information
''
- INTEGER_FIELDS =
fields description for JSON generation cspell: disable
%w[Bytescont FaspFileArgIndex StartByte Rate MinRate Port Priority RateCap MinRateCap TCPPort CreatePolicy TimePolicy DatagramSize XoptFlags VLinkVersion PeerVLinkVersion DSPipelineDepth PeerDSPipelineDepth ReadBlockSize WriteBlockSize ClusterNumNodes ClusterNodeId Size Written Loss FileBytes PreTransferBytes TransferBytes PMTU Elapsedusec ArgScansAttempted ArgScansCompleted PathScansAttempted FileScansCompleted TransfersAttempted TransfersPassed Delay].freeze
- BOOLEAN_FIELDS =
%w[Encryption Remote RateLock MinRateLock PolicyLock FilesEncrypt FilesDecrypt VLinkLocalEnabled VLinkRemoteEnabled MoveRange Keepalive TestLogin UseProxy Precalc RTTAutocorrect].freeze
- BOOLEAN_TRUE =
'Yes'
Instance Attribute Summary collapse
-
#last_event ⇒ Object
readonly
Returns the value of attribute last_event.
Class Method Summary collapse
-
.enhanced_event_format(event) ⇒ Object
translates mgt port event into (enhanced) typed event.
Instance Method Summary collapse
-
#initialize ⇒ Management
constructor
A new instance of Management.
-
#process_line(line) ⇒ Hash
process line of mgt port event.
Constructor Details
#initialize ⇒ Management
Returns a new instance of Management.
216 217 218 219 220 221 |
# File 'lib/aspera/ascp/management.rb', line 216 def initialize # current event being parsed line by line @event_build = nil # last fully built event @last_event = nil end |
Instance Attribute Details
#last_event ⇒ Object (readonly)
Returns the value of attribute last_event.
222 223 224 |
# File 'lib/aspera/ascp/management.rb', line 222 def last_event @last_event end |
Class Method Details
.enhanced_event_format(event) ⇒ Object
translates mgt port event into (enhanced) typed event
205 206 207 208 209 210 211 212 213 |
# File 'lib/aspera/ascp/management.rb', line 205 def enhanced_event_format(event) return event.keys.each_with_object({}) do |e, h| new_name = e.capital_to_snake.gsub(/(usec)$/, '_\1').downcase value = event[e] value = value.to_i if INTEGER_FIELDS.include?(e) value = value.eql?(BOOLEAN_TRUE) if BOOLEAN_FIELDS.include?(e) h[new_name] = value end end |
Instance Method Details
#process_line(line) ⇒ Hash
process line of mgt port event
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/aspera/ascp/management.rb', line 227 def process_line(line) # Log.log.debug{"line=[#{line}]"} case line when MGT_HEADER # begin event @event_build = {} when /^([^:]+): (.*)$/ raise 'mgt port: unexpected line: data without header' if @event_build.nil? # event field @event_build[Regexp.last_match(1)] = Regexp.last_match(2) when MGT_FRAME_SEPARATOR raise 'mgt port: unexpected line: end frame without header' if @event_build.nil? @last_event = @event_build @event_build = nil return @last_event else Aspera.error_unexpected_value(line){'mgt port'} end return nil end |