Class: Fluent::Plugin::Storage

Inherits:
Base
  • Object
show all
Includes:
OwnedByMixin
Defined in:
lib/fluent/plugin/storage.rb

Direct Known Subclasses

LocalStorage

Constant Summary collapse

DEFAULT_TYPE =
'local'

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary collapse

Attributes inherited from Base

#under_plugin_development

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OwnedByMixin

#owner, #owner=

Methods inherited from Base

#acquire_worker_lock, #after_shutdown, #after_shutdown?, #after_start, #after_started?, #before_shutdown, #before_shutdown?, #called_in_test?, #close, #closed?, #configure, #configured?, #context_router, #context_router=, #fluentd_worker_id, #get_lock_path, #has_router?, #initialize, #inspect, #multi_workers_ready?, #plugin_root_dir, #reloadable_plugin?, #shutdown, #shutdown?, #start, #started?, #stop, #stopped?, #string_safe_encoding, #terminate, #terminated?

Methods included from SystemConfig::Mixin

#system_config, #system_config_override

Methods included from Configurable

#config, #configure, #configure_proxy_generate, #configured_section_create, included, #initialize, lookup_type, register_type

Constructor Details

This class inherits a constructor from Fluent::Plugin::Base

Instance Attribute Details

#logObject

Returns the value of attribute log.



39
40
41
# File 'lib/fluent/plugin/storage.rb', line 39

def log
  @log
end

Class Method Details

.validate_key(key) ⇒ Object

Raises:

  • (ArgumentError)


34
35
36
37
# File 'lib/fluent/plugin/storage.rb', line 34

def self.validate_key(key)
  raise ArgumentError, "key must be a string (or symbol for to_s)" unless key.is_a?(String) || key.is_a?(Symbol)
  key.to_s
end

Instance Method Details

#delete(key) ⇒ Object

Raises:

  • (NotImplementedError)


74
75
76
77
# File 'lib/fluent/plugin/storage.rb', line 74

def delete(key)
  # return deleted value
  raise NotImplementedError, "Implement this method in child class"
end

#fetch(key, defval) ⇒ Object

Raises:

  • (NotImplementedError)


65
66
67
# File 'lib/fluent/plugin/storage.rb', line 65

def fetch(key, defval)
  raise NotImplementedError, "Implement this method in child class"
end

#get(key) ⇒ Object

Raises:

  • (NotImplementedError)


61
62
63
# File 'lib/fluent/plugin/storage.rb', line 61

def get(key)
  raise NotImplementedError, "Implement this method in child class"
end

#implementationObject



49
50
51
# File 'lib/fluent/plugin/storage.rb', line 49

def implementation
  self
end

#loadObject



53
54
55
# File 'lib/fluent/plugin/storage.rb', line 53

def load
  # load storage data from any data source, or initialize storage internally
end

#persistent_always?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/fluent/plugin/storage.rb', line 41

def persistent_always?
  false
end

#put(key, value) ⇒ Object

Raises:

  • (NotImplementedError)


69
70
71
72
# File 'lib/fluent/plugin/storage.rb', line 69

def put(key, value)
  # return value
  raise NotImplementedError, "Implement this method in child class"
end

#saveObject



57
58
59
# File 'lib/fluent/plugin/storage.rb', line 57

def save
  # save internal data store into data source (to be loaded)
end

#synchronized?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fluent/plugin/storage.rb', line 45

def synchronized?
  false
end

#update(key, &block) ⇒ Object

transactional get-and-update

Raises:

  • (NotImplementedError)


79
80
81
# File 'lib/fluent/plugin/storage.rb', line 79

def update(key, &block) # transactional get-and-update
  raise NotImplementedError, "Implement this method in child class"
end