Class: HeaderBuilder

Inherits:
Object
  • Object
show all
Includes:
Infinispan::Constants
Defined in:
lib/infinispan-ruby-client/headerbuilder.rb

Class Method Summary collapse

Class Method Details

.getHeader(op_code, cache_name) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/infinispan-ruby-client/headerbuilder.rb', line 21

def self.getHeader( op_code,cache_name )
  result=[MAGIC[0].chr, #Magic
          Unsigned.encodeVint(0x04), #Message Id
          HT_VERSION.chr, # Version
          op_code.chr, # Opcode
          cache_name.size==0?[]:Unsigned.encodeVint(cache_name.size)] # Cache Name Length
  
  result<<cache_name unless cache_name.size==0 # # 	Cache Name
  
  tale=[0.chr, # Flags
        0x01.chr, # Client Intelligence
        0.chr, # Topology Id
        0.chr, # Transaction Type
        0.chr] # Transaction Id
  
  tale.each{|e| result<<e}
  result
end