class EsHttpClient::WriteableStream
Public Class Methods
new(name, connection)
click to toggle source
# File lib/es_http_client/writeable_stream.rb, line 8 def initialize(name, connection) @stream_name = name @connection = connection end
Public Instance Methods
append(event, expected_version=ExpectedVersion::Any)
click to toggle source
# File lib/es_http_client/writeable_stream.rb, line 26 def append(event, expected_version=ExpectedVersion::Any) @connection.post(Ref.head_of(@stream_name).uri, event, expected_version) true rescue EsHttpClientError => e STDERR.puts e.message false end
exists?()
click to toggle source
# File lib/es_http_client/writeable_stream.rb, line 17 def exists? ref = Ref.head_of(@stream_name) @connection.get(ref.uri, ref.etag) true rescue EsHttpClientError => e return false if e.code == 404 raise e end
replay_forward(&block)
click to toggle source
# File lib/es_http_client/writeable_stream.rb, line 34 def replay_forward(&block) StreamEvents.new(@stream_name, @connection).each(&block) end
to_s()
click to toggle source
# File lib/es_http_client/writeable_stream.rb, line 13 def to_s @stream_name end