Class: HttpEventStore::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/http_event_store/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Connection

Returns a new instance of Connection.

Yields:

  • (_self)

Yield Parameters:


5
6
7
8
# File 'lib/http_event_store/connection.rb', line 5

def initialize
  setup_defaults
  yield(self) if block_given?
end

Instance Attribute Details

#endpointObject

Returns the value of attribute endpoint


3
4
5
# File 'lib/http_event_store/connection.rb', line 3

def endpoint
  @endpoint
end

#page_sizeObject

Returns the value of attribute page_size


3
4
5
# File 'lib/http_event_store/connection.rb', line 3

def page_size
  @page_size
end

#portObject

Returns the value of attribute port


3
4
5
# File 'lib/http_event_store/connection.rb', line 3

def port
  @port
end

Instance Method Details

#append_to_stream(stream_name, event_data, expected_version = nil) ⇒ Object


10
11
12
# File 'lib/http_event_store/connection.rb', line 10

def append_to_stream(stream_name, event_data, expected_version = nil)
  Actions::AppendEventToStream.new(client).call(stream_name, event_data, expected_version)
end

#delete_stream(stream_name, hard_delete = false) ⇒ Object


14
15
16
# File 'lib/http_event_store/connection.rb', line 14

def delete_stream(stream_name, hard_delete = false)
  Actions::DeleteStream.new(client).call(stream_name, hard_delete)
end

#read_all_events_backward(stream_name) ⇒ Object


30
31
32
# File 'lib/http_event_store/connection.rb', line 30

def read_all_events_backward(stream_name)
  Actions::ReadAllStreamEventsBackward.new(client, page_size).call(stream_name)
end

#read_all_events_forward(stream_name) ⇒ Object


26
27
28
# File 'lib/http_event_store/connection.rb', line 26

def read_all_events_forward(stream_name)
  Actions::ReadAllStreamEventsForward.new(client, page_size).call(stream_name)
end

#read_events_backward(stream_name, start, count) ⇒ Object


22
23
24
# File 'lib/http_event_store/connection.rb', line 22

def read_events_backward(stream_name, start, count)
  Actions::ReadStreamEventsBackward.new(client).call(stream_name, start, count)
end

#read_events_forward(stream_name, start, count, pool = 0) ⇒ Object


18
19
20
# File 'lib/http_event_store/connection.rb', line 18

def read_events_forward(stream_name, start, count, pool = 0)
  Actions::ReadStreamEventsForward.new(client).call(stream_name, start, count, pool)
end

#read_projection_state(projection_name) ⇒ Object


34
35
36
# File 'lib/http_event_store/connection.rb', line 34

def read_projection_state(projection_name)
  Actions::ReadProjectionState.new(client).call(projection_name)
end

#set_projection_state(projection_name, state) ⇒ Object


38
39
40
# File 'lib/http_event_store/connection.rb', line 38

def set_projection_state(projection_name, state)
  Actions::SetProjectionState.new(client).call(projection_name, state)
end