Home > Class Reference > %SYS namespace > %Library.GlobalStreamAdaptor

%Library.GlobalStreamAdaptor

abstract stream class %Library.GlobalStreamAdaptor extends %Library.AbstractStream

Stream adaptor for streams that store data in global nodes. Not to be used directly.

Property Inventory (Including Private)

Method Inventory (Including Private)

Parameters

parameter BUFFERLEN = 32656,32656;
Number of characters that we are storing in each global node If this includes a ',' then format size on non-long string then size on long string enabled system
parameter STORAGE = GLOBAL;
parameter STOREGLOBALNAME = ^CacheStream;
Default location: can be overridden at run-time

Properties (Including Private)

property %LastModified as %String [ Private , Transient ];
Property methods: %LastModifiedDisplayToLogical(), %LastModifiedGet(), %LastModifiedIsValid(), %LastModifiedLogicalToDisplay(), %LastModifiedLogicalToOdbc(), %LastModifiedNormalize(), %LastModifiedSet()
property Buffer as %Binary) [ Private ];
Property methods: BufferGet(), BufferIsValid(), BufferSet()
property IOSize as %Integer [ Private , InitialExpression = 0 ];
Property methods: IOSizeDisplayToLogical(), IOSizeGet(), IOSizeIsValid(), IOSizeLogicalToDisplay(), IOSizeNormalize(), IOSizeSet()
property MaxNodeNo as %Integer [ Private , InitialExpression = 0 , Transient ];
Maximum subscript in data we are reading
Property methods: MaxNodeNoDisplayToLogical(), MaxNodeNoGet(), MaxNodeNoIsValid(), MaxNodeNoLogicalToDisplay(), MaxNodeNoNormalize(), MaxNodeNoSet()
property NodeNo as %String (MAXLEN = 5000) [ Private , InitialExpression = 0 ];
The current node we are reading from.
Property methods: NodeNoDisplayToLogical(), NodeNoGet(), NodeNoIsValid(), NodeNoLogicalToDisplay(), NodeNoLogicalToOdbc(), NodeNoNormalize(), NodeNoSet()
property Position as %Integer [ Private , InitialExpression = 1 ];
Property methods: PositionDisplayToLogical(), PositionGet(), PositionIsValid(), PositionLogicalToDisplay(), PositionNormalize(), PositionSet()
property StoreGlvn as %String (MAXLEN = 5000) [ Private , Calculated ];
StoreGlvn is actual location where data is stored: StoreRoot + StoreNode
Property methods: StoreGlvnDisplayToLogical(), StoreGlvnGet(), StoreGlvnIsValid(), StoreGlvnLogicalToDisplay(), StoreGlvnLogicalToOdbc(), StoreGlvnNormalize()
property StoreNode as %String (MAXLEN = 5000) [ Private ];
Property methods: StoreNodeDisplayToLogical(), StoreNodeGet(), StoreNodeIsValid(), StoreNodeLogicalToDisplay(), StoreNodeLogicalToOdbc(), StoreNodeNormalize(), StoreNodeSet()
property StoreRoot as %String (MAXLEN = 5000) [ Private , InitialExpression = ..#STOREGLOBALNAME ];
Root is Global Location (name and top subscripts)
Property methods: StoreRootDisplayToLogical(), StoreRootGet(), StoreRootIsValid(), StoreRootLogicalToDisplay(), StoreRootLogicalToOdbc(), StoreRootNormalize(), StoreRootSet()
property TempGlvn as %String (MAXLEN = 5000) [ Private , Calculated ];
TempGlvn is actual temp location: TEMPGLOBALNAME + TempNode
Property methods: TempGlvnDisplayToLogical(), TempGlvnGet(), TempGlvnIsValid(), TempGlvnLogicalToDisplay(), TempGlvnLogicalToOdbc(), TempGlvnNormalize()
property TempNode as %String (MAXLEN = 5000) [ Private ];
Property methods: TempNodeDisplayToLogical(), TempNodeGet(), TempNodeIsValid(), TempNodeLogicalToDisplay(), TempNodeLogicalToOdbc(), TempNodeNormalize(), TempNodeSet()
property rollback as %String [ Private , MultiDimensional ];
Property methods: rollbackDisplayToLogical(), rollbackGet(), rollbackIsValid(), rollbackLogicalToDisplay(), rollbackLogicalToOdbc(), rollbackNormalize(), rollbackSet()

Methods (Including Private)

classmethod %Exists(soid As %ObjectIdentity) as %Boolean
Inherited description: Checks to see if the object identified by the OID oid exists in the extent.

Returns %Boolean TRUE is it exists, FALSE if it does not.

private classmethod %GetLockReference(pLocation As %String(MAXLEN="")="", pId As %String(MAXLEN="")="") as %String
Returns the global reference used to lock the current stream object Throws %Exception.AbstractException
private classmethod %LOBPrefetchInternal(soid As %ObjectIdentity, prefetchsize As %Integer, ByRef data As %String) as %Integer
method %LocationGet() as %String
method %LocationSet(value As %String) as %Status
method %LockStream()
%LockStream() Obtain a shared lock on the current stream object. The return value is 1 if the stream was already locked or if it was successfully locked. If the stream cannot be locked the return value is 0. This version of %LockStream differs from %Stream.Object only in the arguments passed to %GetLockReference.
method %NormalizeObject() as %Status
Inherited description: Normalizes all of an object's property values by invoking the data type Normalize methods. Many data types may allow many different representations of the same value. Normalization converts a value to its cannonical, or normalized, form.
classmethod %ObjectIsNull(soid As %ObjectIdentity) as %Boolean
Return true if this stream oid is a null stream and false if the stream is not null
private classmethod %ObjectSizeInternal(soid As %ObjectIdentity) as %Integer
Return the size of the stream pointed to by soid
private method %OnClose() as %Status
Inherited description: This callback method is invoked by the %Close() method to provide notification that the current object is being closed.

The return value of this method is ignored.

private method %OnConstructClone(object As %RegisteredObject, deep As %Boolean = 0, ByRef cloned As %String) as %Status
Inherited description: This callback method is invoked by the %ConstructClone() method to provide notification that a clone of an object is being created. It passes in the oref of the object that was cloned in object.

If this method returns an error then the object will not be created.

private method %OnNew(initval As %String = "") as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

private method %OnRollBack() as %Status
Inherited description: This callback method is invoked by the %Save() method to provide notification that a save transaction is being rolled back.

If this method returns an error then the rollback operation will be aborted.

private method %SaveData(ByRef sid As %String) as %Status
method %ValidateObject(force As %Library.Integer = 0, checkserial As %Library.Boolean = 1) as %Status
Inherited description: This method validates an object. The %Save method of a persistent class calls it before filing any objects in the database. The %ValidateObject method of a referencing object can call it. You can also call it explicitly at any time.

%ValidateObject() does the following:

  1. It tests if any required property values are missing.
  2. If the PROPERTYVALIDATION class parameter is set to ValidateOnSave, it validates each non-null property value by calling the property method IsValid on each literal property and the object's %ValidateObject method for object-valued properties.
  3. If present, it will call a user-supplied %OnValidateObject() method.

If any of these tests fail, %ValidateObject() immediately returns an error value. It is up to the caller of %ValidateObject to process the error value.

Returns a %Status value indicating success or failure.

private method CheckAtEnd()
Check if we are at the end of the global, but do not read the next buffer
method Clear(permanent As %Boolean = 1) as %Status
Inherited description: Clear the contents of this Stream from permanent storage. This will remove the permanent stream storage and any temporary stream and initialise the stream to its initial state that it starts in, including removing all the stream attributes.

Returns a %Status value indicating success or failure.

method CopyFrom(source As %AbstractStream) as %Status
Inherited description: Copies the contents of source into this Stream.

For example, you can copy oldstream into a new stream:

  Set newstream=##class(%GlobalCharacterStream).%New()
  Do newstream.CopyFrom(oldstream)
  

Returns a %Status value indicating success or failure.

method Flush() as %Status
Inherited description: Flush any output in the stream not already saved.
classmethod GlobalFromSid(sid As %String) as %String
Given a stream id this returns the root global node where this stream is stored
private classmethod IODeleteStream(sid As %String, concurrency As %Integer = 0) as %Status
Inherited description: Delete the storage for the stream identified by sid.
private method IOGetStreamId() as %String
Inherited description: Return the id for a stream; that is, an identifier that can later be used to open the same stream.
private method IOInit()
Inherited description: Initialize member variable used by the StreamAdaptor. This This is called when the containing stream is opened via %SetSerial.
method LastModifiedGet() as %TimeStamp
method MoveToEnd() as %Status
Inherited description: Move to the end of the stream so the next Write will be appended to the end. This allows you to read from a stream, then MoveToEnd() and append new data, where just calling Write() after a read will clear the stream before writing new data.

Returns a %Status value indicating success or failure.

method OpenStream(sid As %String) as %Status
method OutputToDevice(ByRef len As %Integer = -1) as %Status
Inherited description: Write out len characters of the stream to the current device starting from the current position. This method is optimised for performance by the various sub classes. If len is omitted or set to -1 then it will write out the entire stream starting at the beginning.
method Read(ByRef len As %Integer, ByRef sc As %Status) as %CacheString
Inherited description: Reads up to len characters from the current position in the stream. The current position is advanced by the number of characters read. Upon exit, len is set to the actual number of characters read. If a read occurs when the stream position is at the end of the stream, len will be set to -1 and Read() will return a null string (""). If no len is passed in, ie. 'Read()' then it is up to the Read implementation as to how much data to return. Some stream classes use this to optimize the amount of data returned to align this with the underlying storage of the stream.

You must call Rewind() if you want to read a stream from the beginning again. Calling Read() after Write() implicitly ends the Write() operation and rewinds to the start of the stream.

Returns a string up to len characters long. The byref argument sc will return a %Status if any error occurred during the read.

private method ReadIntoBuffer() as %Boolean
Reads the next node into Buffer.

Returns 0 if there is no more data.

method ReadLine(ByRef len As %Integer = 32656, ByRef sc As %Status, ByRef eol As %Boolean) as %CacheString
Inherited description: Read a line from the stream. This will look for the line terminator in the stream and once it finds the terminator it will return the string minus the terminator character/s. If it reaches the end of the stream before it finds a terminator it will return the data it has so far, and if you specify a maximum size in len it will only read up to this number of characters. On exit len will contain the actual number of characters read. The byref argument sc will return a %Status if any error occured during the read and the byref argument eol is true if it found the line terminator and false otherwise. So for example you can read in a stream a line at a time and output the results to the current device with:
While 'stream.AtEnd { Write stream.ReadLine(,.sc,.eol) If $$$ISERR(sc) { Write "ERROR" Quit } If eol { Write ! } }
method ReadLineIntoStream(ByRef sc As %Library.Status) as %AbstractStream
This reads from the stream until it find the LineTerminator and returns this as a stream. If the stream does not contain the line terminator this can potentially be the entire stream.
method Rewind() as %Status
Inherited description: Go back to the start of the stream.
method SaveStream() as %Status
Inherited description: Deprecated method, use %Save() instead. Saves the temporary copy of the stream data to a persistent location. Note that any locking or transaction handling must be done by the caller.

Returns a %Status value indicating success or failure.

method SizeGet() as %Integer
Return the current size of the data stream.
private method StoreGlvnGet() as %String
classmethod StreamOIDIsNull(soid As %ObjectIdentity) as %Boolean
Return true if this stream oid is a null stream and false if the stream is not null
private method TempGlvnGet() as %String
method Write(data As %CacheString = "") as %Status
Inherited description: Appends the string data to the stream and advances the current stream position by the number of characters in data.

Note that a write operation immediately following a read or rewind will clear out the existing data in the stream.

Returns a %Status value indicating success or failure.

private method WriteBuffer() as %Status

Inherited Members

Inherited Properties (Including Private)

Inherited Methods (Including Private)

Subclasses