Plugin Helper: Storage
The storage
plugin helper manages the plugin's internal states.
Here is an example:
The created storage is managed by the plugin helper. No need of storage shutdown code in plugin's shutdown
. It shutdowns the created storages automatically.
For more details, see Storage section.
Methods
storage_create(usage: '', type: nil, conf: nil, default_type: nil)
storage_create(usage: '', type: nil, conf: nil, default_type: nil)
This method executes storage with the given parameters and routine.
usage
: unique string value (default:''
)type
: storage plugin type (default:nil
)conf
: storage plugin configuration (default:nil
)default_conf
: storage plugin default configuration (default:nil
)
Storage Plugin Helper Instance Types
Instance Type
Attributes
Raw | persistent && persistent_always? || otherwise
| Persistent Wrapper | persistent
| Synchronized Wrapper | !synchronized?
|
Raw
Storage plugins will handle as-is.
Persistent Wrapper
This wrapper makes the handled storage plugin operate values persistently.
Synchronized Wrapper
This wrapper makes handled storage plugin operate values synchronically.
Common Methods
Storage plugin helper encapsulates storage plugin implementation. Normally, the following methods will be called by the owner plugin through this plugin helper:
load
load
This method loads persistently stored value.
save
save
This method saves value persistently.
get(key)
get(key)
key
: symbol value.
This method obtains stored value by key.
fetch(key, defval)
fetch(key, defval)
key
: symbol value.defval
: default value.
This method obtains the stored value by key. If missing, it returns the default value.
put(key, value)
put(key, value)
key
: symbol value.value
: store value.
This method updates the stored value by key.
delete(key)
delete(key)
key
: symbol value.
This method deletes the stored value by key.
update(key, &block)
update(key, &block)
key
: symbol value.&block
: aProc
object.
This method updates the stored value using a Proc
object.
Plugins using storage
storage
If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last updated