lib/grumlin/client.rb in grumlin-0.7.0 vs lib/grumlin/client.rb in grumlin-0.8.0

- old
+ new

@@ -22,12 +22,12 @@ def close @client.close end - def write(*args) - @client.write(*args) + def write(bytecode) + @client.write(bytecode) ensure @count += 1 end def viable? @@ -92,15 +92,14 @@ def connected? @transport&.connected? || false end # TODO: support yielding - def write(*args) + def write(bytecode) raise NotConnectedError unless connected? - request_id = SecureRandom.uuid - request = to_query(request_id, args) + request = bytecode.to_query channel = @request_dispatcher.add_request(request) @transport.write(request) begin channel.dequeue.flat_map { |item| Typing.cast(item) } @@ -115,21 +114,9 @@ end alias to_s inspect private - - def to_query(request_id, message) - { - requestId: request_id, - op: "bytecode", - processor: "traversal", - args: { - gremlin: Typing.to_bytecode(Translator.to_bytecode_query(message)), - aliases: { g: :g } - } - } - end def build_transport Transport.new(@url, parent: @parent, **@client_options) end end