Sedona

pstore::PstoreFile


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.


resvOffset

public property int resvOffset [config, defaultOnClone]

Offset of this file's storage reservation relative to the storage device modeled by the parent PstoreService.

resvSize

public property int resvSize [config]

Size of this file's reservation in bytes.

status

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.

statusBadOffset

public static const define int statusBadOffset

Reservation offset is out of range

statusBadParent

public static const define int statusBadParent

Indicates that PstoreFile is not directly mounted under PstoreService

statusBadSize

public static const define int statusBadSize

Reservation size is out of range

statusDupRange

public static const define int statusDupRange

Reservation overlaps with another PstoreFile

statusFormatErr

public static const define int statusFormatErr

Used by subclasses when an format error is detected

statusInactive

public static const define int statusInactive

File component is not actively running

statusOk

public static const define int statusOk

File is mapped to storage correctly

statusRange

public static const define Str statusRange

File is mapped to storage correctly

statusServiceErr

public static const define int statusServiceErr

Indicates that the parent PstoreService is in an error state.

changed

public virtual override void changed(Slot slot)

If the reservation props are changed, re-validate. If this method is override, must call super!

claim

public bool claim()

Claim temporary ownership ofthe backing store file to perform IO. Return true on success, false on failure.

in

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.

isOwner

public bool isOwner()

Is this PstoreFile currently the owner of the backing store file. See the <code>claim</code> method to claim ownership.

out

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.

seek

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.

start

public virtual override void start()

On startup we need to validate our reservation range. If this method is override, must call super!

tell

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.

validate

public virtual void validate()

Validate this file's reservation range and update its status.