event_store 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -1,34 +1,50 @@
1
1
  # EventStore
2
2
 
3
- Ruby implementation of an EventSource (A+ES) for the Nexia Ecosystem.
3
+ A Very Fast Ruby implementation of an EventStore (A+ES).
4
+ For more detail on what an EventStore is checkout what Gregg Young has to stay about it:
5
+ http://codebetter.com/gregyoung/2010/02/20/why-use-event-sourcing/
4
6
 
5
7
  # Usage
6
8
 
7
- Currently, `EventStore` supports `postgres` adapters. Define your adapter and the connection parameters in the `EventStore` configure block.
9
+ Currently, `EventStore` supports `postgres` and `vertica` adapters.
8
10
 
9
- ### Connecting
11
+ ### Connecting in Development or Test
10
12
  ```ruby
11
- EventStore.connect {
12
- :adapter => :postgres,
13
- :database => "my_database",
14
- :host => "db.example.com",
15
- :username => "user1234",
16
- :password => "password",
17
- :port => 5432
18
- }
13
+ EventStore.postgres(:development)
14
+ EventStore.postgres #test
15
+
16
+ EventStore.vertica(:development)
17
+ EventStore.vertica #test
18
+
19
+ #Production
20
+ EventStore.connect_db(redis_config, database_config) #The redis and database configs are the standard hashes expected by the databases -- we just pass them directly in
19
21
  ```
20
- The arguments to `EventStore#connect` are the same as those to `Sequel#connect`
21
22
 
22
23
  ### Notes on Connecting
23
24
 
25
+ - `EventStore` expects a database called `history_store` to exist.
26
+ - `postgres` will try to connect in dev and test mode as 'nexia:Password1@localhost'
24
27
  - `postgres` will assume a port of `5432` if one is not supplied.
25
28
 
29
+ - `vertica` expects to find an environment variable (VERTICA_HOST) to be set and will use this as the host in dev and test mode
30
+ - `vertica` will assume its default port if one is not supplied.
31
+ - `vertica` will try to connect in dev and test mode as 'dbadmin:password@[vertica_host]'
32
+ - To find the ip address of vertica on your local box (running in a vm):
33
+ 1. open Settings -> Network and select Wi-Fi
34
+ 2. open a terminal in the VM
35
+ 3. do /sbin/ifconfig (ifconfig is not in $PATH)
36
+ 4. the inet address for en0 is what you want
37
+ Hint: if it just hangs, you have have the wrong IP
38
+
26
39
  ### Creating a client
27
40
 
28
41
  ```ruby
29
42
  client = EventStore::Client.new(aggregate_id)
30
43
 
31
- # Get an aggregate's event stream
44
+ # Get a list of events representing a snapshot of the aggregate's current state (fast)
45
+ client.snapshot
46
+
47
+ # Get an aggregate's entire event stream (can be very large)
32
48
  client.event_stream
33
49
 
34
50
  # Get an aggregate's event stream starting from a version
@@ -42,12 +58,10 @@ client.peek
42
58
 
43
59
  # Append events to an aggregate's event stream
44
60
  client.append(events, expected_version)
45
- ```
46
-
47
- ### Migrating your database
48
61
 
49
- With the `sequel` gem installed, you have access to its command line tool. To migrate your database, enter the following command:
50
- `$ sequel -m path/to/migrations/folder postgres://username:password@localhost:5432/event_store_test`
62
+ # Get the current version of an aggregate
63
+ client.version
51
64
 
52
- - The first argument is the path to the folder containing migrations, not a specific file. An example migration can be found at [001_create_event_store_events.rb](https://github.com/nexiahome/event_store/blob/master/db/migrations/001_create_event_store_events.rb)
53
- - The second argument is your full database connection url
65
+ # Drop all the events associated with an aggregate, including its snapshot
66
+ client.destroy!
67
+ ```
@@ -1,3 +1,3 @@
1
1
  module EventStore
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/event_store.rb CHANGED
@@ -95,7 +95,7 @@ module EventStore
95
95
  #3. do /sbin/ifconfig (ifconfig is not in $PATH)
96
96
  #4. the inet address for en0 is what you want
97
97
  #Hint: if it just hangs, you have have the wrong IP
98
- db_config['host'] = vertica_host
98
+ db_config['host'] = ENV['VERTICA_HOST'] || vertica_host
99
99
  @migrations_dir = 'db/migrations'
100
100
  else
101
101
  @migrations_dir = 'db/pg_migrations'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: