Class: Neo4j::Core::CypherSession::Adaptors::Bolt::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/neo4j/core/cypher_session/adaptors/bolt.rb

Overview

Represents a set of messages to send to the server

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Job

Returns a new instance of Job.



306
307
308
309
# File 'lib/neo4j/core/cypher_session/adaptors/bolt.rb', line 306

def initialize(session)
  @messages = []
  @session = session
end

Instance Method Details

#add_message(type, *args) ⇒ Object



311
312
313
# File 'lib/neo4j/core/cypher_session/adaptors/bolt.rb', line 311

def add_message(type, *args)
  @messages << Message.new(type, *args)
end

#chunked_packed_streamObject



315
316
317
318
319
320
321
322
323
324
325
# File 'lib/neo4j/core/cypher_session/adaptors/bolt.rb', line 315

def chunked_packed_stream
  io = ChunkWriterIO.new

  @messages.each do |message|
    io.write(message.packed_stream)
    io.flush(true)
  end

  io.rewind
  io.read
end

#to_sObject



327
328
329
# File 'lib/neo4j/core/cypher_session/adaptors/bolt.rb', line 327

def to_s
  @messages.join(' | ')
end