DistLogEntry
Module to manipulate distribution log entries.
use DistLog;
my $entry=createDistLogEntry(event=>"REMOVE",
from=>"Store::RSyncSSH",
fromid=>1234,
fromhost=>1.2.3.4,
fromhostid=>0,
fromhostname=>"MyStorageServer";
fromloc=>"/somewhere/over/the/rainbow",
uid=>56
);
my $ref=parseDistLogEntry($entry);
Module creating and manipulating distribution log entries in the correct way. createDistLogEntry is exported as default.
create a proper distribution log entry based upon a set of parameter input.
Possible parameters are:
event Defines the event-type of the log entry. SCALAR. Optional. Defaults to "TRANSFER". Valid values are "TRANSFER", "REMOVE" and "RESURRECT".
sc StoreCollection entity ID. SCALAR. Optional. Defaults to 0 (unknown/invalid).
from From-class of the event. SCALAR. Optional. Defaults to "FILEINTERFACE". This should be the textual name of the Store-class that was used for the event. Some special class-names are allowed: FILEINTERFACE and UNKNOWN. FILEINTERFACE is not a Store-class, but signifies the local fileinterface of AURORA. UNKNOWN means that the from-class of the event is unknown, typically only used in the case of manual datasets were the data is put in place manually by the user.
fromid The entity id of the from-class of the event. SCALAR. Optional. Defaults to -6 (FILEINTERFACE). Valid values are usually anything above 0 that corresponds with an entity in the AURORA database. Lower values than zero are only used to signify special from-entities that are not Store-classes, such as FILEINTERFACE (-6) and UNKNOWN (0).
fromhost Host-address/DNS of the from-host that the event is working with. SCALAR. Optional. Defaults to blank string.
fromhostid Entity ID of the from-host, if any. SCALAR. Optional. Defaults to 0 (UNKNOWN). Valid values are entity IDs over 0 from the AURORA database.
fromhostname The textual name of the from-host, if any. SCALAR. Optional. Defaults to blank string.
fromloc The location that the event worked with on the from-host. SCALAR. Optional. Defaults to 0. The location string only have meaning for the from-class being used. It can be an integer or a string, depending upon circumstance.
to The to-class being used with the event. SCALAR. Optional. Defaults to FILEINTERFACE. This should be the textual name of the Store-class in the to-point. Some special class-names are allowed: FILEINTERFACE.
toid The entity id of the to-class of the event. SCALAR. Optional. Defaults to -6 (FILEINTERFACE). Valid values are usually anything above 0 that corresponds with an entity in the AURORA database. Lower values than zero are only used to signify special to-entities that are not Store-classes, such as FILEINTERFACE (-6).
tohost Host-address/DNS of the to-host that the event is working with. SCALAR. Optional. Defaults to blank string.
tohostid Entity ID of the to-host, if any. SCALAR. Optional. Defaults to 0 (UNKNOWN). Valid values are entity IDs over 0 from the AURORA database.
tohostname The textual name of the to-host, if any. SCALAR. Optional. Defaults to blank string.
toloc The location that the event worked with on the to-host. SCALAR. Optional. Defaults to 0. The location string only have meaning for the to-class being used. It can be an integer or a string, depending upon circumstance.
Returns a ready formatted string of the distribution log entry that can be given to the Log-service of AURORA upon success. Blank string upon failure.
The formatted string is in JSON format and looks like this:
[
STRING, (SHORT-FORM INFO of the distlog event)
{HASH} (HASH with all the key-value pairs of the event)
]
Parses a textual distlog entry that has been created with the createDistLogEntry()-method.
Input parameter: DistLog-string
Returns the parsed JSON-data as a ARRAY-reference upon success, undef upon failure.
The format of the ARRAY-reference is the same as the JSON format, mentioned in createDistLogEntry.