mongoriver 0.4.2 → 0.4.3

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.
@@ -53,6 +53,14 @@ module Mongoriver
53
53
  return entries_left
54
54
  end
55
55
 
56
+ def most_recent_state(before_time=nil)
57
+ record = latest_oplog_entry(before_time)
58
+ {
59
+ 'time' => time_for(record),
60
+ 'position' => position(record)
61
+ }
62
+ end
63
+
56
64
  # state to save to the database for this record
57
65
  def state_for(record)
58
66
  {
@@ -36,6 +36,18 @@ module Mongoriver
36
36
  end
37
37
  end
38
38
 
39
+ # Return a time for a record object
40
+ # @return Time
41
+ def time_for(record)
42
+ return nil unless record
43
+ case database_type
44
+ when :mongo
45
+ return Time.at(record['ts'].seconds)
46
+ when :toku
47
+ return record['ts']
48
+ end
49
+ end
50
+
39
51
  # Find the most recent entry in oplog and return a position for that
40
52
  # position. The position can be passed to the tail function (or run_forever)
41
53
  # and the tailer will start tailing after that.
@@ -1,3 +1,3 @@
1
1
  module Mongoriver
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoriver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-17 00:00:00.000000000 Z
12
+ date: 2014-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongo