java.lang.Object | |
↳ | org.rrd4j.core.RrdBackend |
![]() |
![]() |
Base implementation class for all backend classes. Each Round Robin Database object
(RrdDb
object) is backed with a single RrdBackend object which performs
actual I/O operations on the underlying storage. Rrd4j supports
three different bakcends out of the box:
RrdFileBackend
: objects of this class are created from the
RrdFileBackendFactory
class. This was the default backend used in all
Rrd4j releases prior to 1.4.0. It uses java.io.* package and
RandomAccessFile class to store RRD data in files on the disk.
RrdNioBackend
: objects of this class are created from the
RrdNioBackendFactory
class. The backend uses java.io.* and java.nio.*
classes (mapped ByteBuffer) to store RRD data in files on the disk. This backend is fast, very fast,
but consumes a lot of memory (borrowed not from the JVM but from the underlying operating system
directly). This is the default backend used in Rrd4j since 1.4.0 release.
RrdMemoryBackend
: objects of this class are created from the
RrdMemoryBackendFactory
class. This backend stores all data in memory. Once
JVM exits, all data gets lost. The backend is extremely fast and memory hungry.
RrdBackendFactory
to
find out how to do this
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates backend for a RRD storage with the given path.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes the underlying backend.
| |||||||||||
Returns the number of RRD bytes in the underlying storage.
| |||||||||||
Returns path to the storage.
| |||||||||||
Reads all RRD bytes from the underlying storage
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method suggests the caching policy to the Rrd4j frontend (high-level) classes.
| |||||||||||
Reads an array of bytes from the underlying storage starting from the given
storage offset.
| |||||||||||
Sets the number of bytes in the underlying RRD storage.
| |||||||||||
Writes an array of bytes to the underlying storage starting from the given
storage offset.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Creates backend for a RRD storage with the given path.
path | String identifying RRD storage. For files on the disk, this argument should represent file path. Other storage types might interpret this argument differently. |
---|
Returns the number of RRD bytes in the underlying storage.
IOException | Thrown in case of I/O error. |
---|
Reads all RRD bytes from the underlying storage
IOException | Thrown in case of I/O error |
---|
This method suggests the caching policy to the Rrd4j frontend (high-level) classes. If true
is returned, frontent classes will cache frequently used parts of a RRD file in memory to improve
performance. If false is returned, high level classes will never cache RRD file sections
in memory.
true
if file caching is enabled, false
otherwise. By default, the
method returns true
but it can be overriden in subclasses.
Reads an array of bytes from the underlying storage starting from the given storage offset.
offset | Storage offset. |
---|---|
b | Array which receives bytes from the underlying storage |
IOException | Thrown in case of I/O error |
---|
Sets the number of bytes in the underlying RRD storage. This method is called only once, immediately after a new RRD storage gets created.
length | Length of the underlying RRD storage in bytes. |
---|
IOException | Thrown in case of I/O error. |
---|
Writes an array of bytes to the underlying storage starting from the given storage offset.
offset | Storage offset. |
---|---|
b | Array of bytes that should be copied to the underlying storage |
IOException | Thrown in case of I/O error |
---|