-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3426 from kenhys/generate-storage
Support to generate storage plugin template
- Loading branch information
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# | ||
# Fluentd | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
require 'fluent/test/driver/base_owned' | ||
|
||
module Fluent | ||
module Test | ||
module Driver | ||
class Storage < BaseOwned | ||
def initialize(klass, **kwargs, &block) | ||
super | ||
@section_name = "storage" | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<%= preamble %> | ||
|
||
require "fluent/plugin/storage" | ||
|
||
module Fluent | ||
module Plugin | ||
class <%= class_name %> < Fluent::Plugin::Storage | ||
Fluent::Plugin.register_storage("<%= plugin_name %>", self) | ||
|
||
def initialize | ||
super | ||
end | ||
|
||
def configure(conf) | ||
super | ||
end | ||
|
||
def load | ||
end | ||
|
||
def save | ||
end | ||
|
||
def get(key) | ||
end | ||
|
||
def fetch(key, defval) | ||
end | ||
|
||
def put(key, value) | ||
end | ||
|
||
def delete(key) | ||
end | ||
|
||
def update(key, &block) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
require "helper" | ||
require "fluent/plugin/<%= plugin_filename %>" | ||
|
||
class <%= class_name %>Test < Test::Unit::TestCase | ||
setup do | ||
Fluent::Test.setup | ||
end | ||
|
||
test "failure" do | ||
flunk | ||
end | ||
|
||
private | ||
|
||
def create_driver(conf) | ||
Fluent::Test::Driver::Storage.new(Fluent::Plugin::<%= class_name %>).configure(conf) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters