sys::Obj sys::Virtual sys::Component pstore::PstoreFile
public class PstoreFile
[niagaraIcon="module://icons/x16/file.png"]
PstoreFile is added as a direct child of a PstoreService to reserves a range of bytes for application use as determined by the "resvOffset" and "resvSize" properties.
public property int resvOffset [config, defaultOnClone]
Offset of this file's storage reservation relative to the storage device modeled by the parent PstoreService.
public property int resvSize [config]
Size of this file's reservation in bytes.
public property byte status [range="ok, inactive, badParent, serviceErr, badOffset, badSize, dupRange, formatErr", readonly]
Status code for storage file access, see the statusXXX defines for the various codes.
public static const define int statusBadOffset
Reservation offset is out of range
public static const define int statusBadParent
Indicates that PstoreFile is not directly mounted under PstoreService
public static const define int statusBadSize
Reservation size is out of range
public static const define int statusDupRange
Reservation overlaps with another PstoreFile
public static const define int statusFormatErr
Used by subclasses when an format error is detected
public static const define int statusInactive
File component is not actively running
public static const define int statusOk
File is mapped to storage correctly
public static const define Str statusRange
File is mapped to storage correctly
public static const define int statusServiceErr
Indicates that the parent PstoreService is in an error state.
public virtual override void changed(Slot slot)
If the reservation props are changed, re-validate. If this method is override, must call super!
public bool claim()
Claim temporary ownership ofthe backing store file to perform IO. Return true on success, false on failure.
public InStream in()
Get the input stream used to read this PstoreFile's reserved range from the backing store file. If this PstoreFile is not the current owner, then return <code>Sys.nullIn</code>. No validation is performed to prevent reading past the end of this PstoreFile's reserved range.
public bool isOwner()
Is this PstoreFile currently the owner of the backing store file. See the <code>claim</code> method to claim ownership.
public OutStream out()
Get an output stream to write this PstoreFile's reserved range to the backing store file. If this PstoreFile is not the current owner, then return <code>Sys.nullOut</code>. No validation is performed to prevent writing past the end of this PstoreFile's reserved range.
public bool seek(int pos)
Seek to a specific byte offset position in the service's backing store file relative to this PstoreFile's reserved offset. This PstoreFile must the current owner. Return false on error.
public virtual override void start()
On startup we need to validate our reservation range. If this method is override, must call super!
public int tell()
Get the backing store file's pointer relative to this PstoreFile's reserved offset. This PstoreFile must the current owner. Return -1 on error.
public virtual void validate()
Validate this file's reservation range and update its status.