fluent-plugin-dynamodb-streams 0.0.2 → 0.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e5741297ac53b959692b1f5fb61617797f2b537
4
- data.tar.gz: f62d4ed375bb57d37562a1808d556f8fce5b233a
3
+ metadata.gz: 9f6a67b282ccec2e95492d9d2591364f27670987
4
+ data.tar.gz: 4d199387a7dd7fd3c1b3730365496e402feb5f62
5
5
  SHA512:
6
- metadata.gz: 44da5152460a042ef52a3c82908bf97402ac8ab532828df4166b44a3cf0b586fdfab1a69a5be67df9820a4c62efc9615cb83b971fbe3728c18ca27ba7ac0cb88
7
- data.tar.gz: fd3c4ab09f1d0bdd6dd18e1cdcb14f0fc7c77995251852167055f8dfb16288d68b4cfe15d04237623e073d0e325d9e346a9f9f36d0e2afe6ab9856fdcb21943c
6
+ metadata.gz: d9371ef516f73f4a9024ff75f622418c4ed7347acd0644683ed71d70bbc178c35c72ce81f7410181bbe6f8fcddd3be63d4c91a7f80c85c5d089fd919a311ec2e
7
+ data.tar.gz: 62379f3119c5f875d5a5d0efda77747c61eb488d563e6338efe7457cc64832ed4ac74ece38c0893cf9fcac0415843a9d3195c8218bf2f6aaf02e83019efb4474
data/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/fluent-plugin-dynamodb-streams.svg)](http://badge.fury.io/rb/fluent-plugin-dynamodb-streams)
4
4
  [![Build Status](https://travis-ci.org/takus/fluent-plugin-dynamodb-streams.svg?branch=master)](https://travis-ci.org/takus/fluent-plugin-dynamodb-streams)
5
- [![Code Climate](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams/badges/gpa.svg)](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams)
6
5
  [![Test Coverage](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams/badges/coverage.svg)](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams/coverage)
6
+ [![Code Climate](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams/badges/gpa.svg)](https://codeclimate.com/github/takus/fluent-plugin-dynamodb-streams)
7
+ [![Codacy Badge](https://api.codacy.com/project/badge/grade/a9fc76d35c8d4175bcb23e5c4b38fb85)](https://www.codacy.com/app/takus/fluent-plugin-dynamodb-streams)
7
8
 
8
9
  Fluentd input plugin for [AWS DynamoDB Streams](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Streams.html).
9
10
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-dynamodb-streams"
7
- spec.version = "0.0.2"
7
+ spec.version = "0.0.3"
8
8
  spec.authors = ["Takumi Sakamoto"]
9
9
  spec.email = ["takumi.saka@gmail.com"]
10
10
  spec.summary = %q{Amazon DynamoDB Streams input plugin for Fluentd}
@@ -44,7 +44,7 @@ module Fluent
44
44
  unless @pos_file
45
45
  @pos_memory = {}
46
46
  end
47
-
47
+
48
48
  options = {}
49
49
  options[:region] = @aws_region if @aws_region
50
50
  options[:credentials] = Aws::Credentials.new(@aws_key_id, @aws_sec_key) if @aws_key_id && @aws_sec_key
@@ -66,10 +66,7 @@ module Fluent
66
66
  while @running
67
67
  sleep @fetch_interval
68
68
 
69
- @client.describe_stream({
70
- stream_arn: @stream_arn
71
- }).stream_description.shards.each do |s|
72
-
69
+ get_shards.each do |s|
73
70
  if s.sequence_number_range.ending_sequence_number
74
71
  remove_sequence(s.shard_id)
75
72
  next
@@ -100,6 +97,27 @@ module Fluent
100
97
  end
101
98
  end
102
99
 
100
+ def get_shards()
101
+ shards = []
102
+
103
+ last_shard_id = nil
104
+ begin
105
+ s = @client.describe_stream({
106
+ stream_arn: @stream_arn,
107
+ exclusive_start_shard_id: last_shard_id,
108
+ }).stream_description
109
+
110
+ shards = shards + s.shards
111
+
112
+ if s.last_evaluated_shard_id == last_shard_id then
113
+ break
114
+ end
115
+ last_shard_id = s.last_evaluated_shard_id
116
+ end while last_shard_id
117
+
118
+ shards
119
+ end
120
+
103
121
  def set_iterator(shard_id)
104
122
  if load_sequence(shard_id)
105
123
  @iterator[shard_id] = @client.get_shard_iterator({
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-dynamodb-streams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takumi Sakamoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-06 00:00:00.000000000 Z
11
+ date: 2016-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd