Skip to main content

%Library.GlobalStreamAdaptor

Class %Library.GlobalStreamAdaptor Extends %AbstractStream [ Abstract, System = 2 ]

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

Parameters

STORAGE

Parameter STORAGE = "GLOBAL";

BUFFERLEN

Parameter BUFFERLEN = 163280;

Number of characters that we are storing in each global node

STOREGLOBALNAME

Parameter STOREGLOBALNAME = "^CacheStream";

Default location: can be overridden at run-time

Properties

StoreRoot

Property StoreRoot As %String(MAXLEN = 5000) [ InitialExpression = {..#STOREGLOBALNAME}, Private ];

Root is Global Location (name and top subscripts)

rollback

Property rollback As %String [ MultiDimensional, Private ];

StoreNode

Property StoreNode As %String(MAXLEN = 5000) [ Private ];

TempNode

Property TempNode As %String(MAXLEN = 5000) [ Private ];

MaxNodeNo

Property MaxNodeNo As %Integer [ InitialExpression = 0, Private, Transient ];

Maximum subscript in data we are reading

NodeNo

Property NodeNo As %String(MAXLEN = 5000) [ InitialExpression = 0, Private ];

The current node we are reading from.

StoreGlvn

Property StoreGlvn As %String(MAXLEN = 5000) [ Calculated, Private ];

StoreGlvn is actual location where data is stored: StoreRoot + StoreNode

TempGlvn

Property TempGlvn As %String(MAXLEN = 5000) [ Calculated, Private ];

TempGlvn is actual temp location: TEMPGLOBALNAME + TempNode

Buffer

Property Buffer As %Binary(MAXLEN = "") [ Private ];

Position

Property Position As %Integer [ InitialExpression = 1, Private ];

IOSize

Property IOSize As %Integer [ InitialExpression = 0, Private ];

%LastModified

Property %LastModified As %String [ Private, Transient ];

Methods

%LocationSet

Method %LocationSet(value As %String) As %Status

%LocationGet

Method %LocationGet() As %String [ CodeMode = expression ]

StoreGlvnGet

Method StoreGlvnGet() As %String [ CodeMode = expression, Private ]

TempGlvnGet

Method TempGlvnGet() As %String [ CodeMode = expression, Private ]

%OnNew

Method %OnNew(initval As %String = "") As %Status [ Private ]

IOInit

Method IOInit() [ Private ]

%OnClose

Method %OnClose() As %Status [ Private ]

%GetLockReference

ClassMethod %GetLockReference(pLocation As %String(MAXLEN="") = "", pId As %String(MAXLEN="") = "") As %String(MAXLEN="") [ Private ]

Returns the global reference used to lock the current stream object Throws %Exception.AbstractException

%LockStream

Method %LockStream() [ ProcedureBlock = 1, ServerOnly = 1 ]

%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.

Rewind

Method Rewind() As %Status

Flush

Method Flush() As %Status

SizeGet

Method SizeGet() As %Integer [ CodeMode = expression ]

Return the current size of the data stream.

IOGetStreamId

Method IOGetStreamId() As %String [ CodeMode = expression, Private ]

OpenStream

Method OpenStream(sid As %String) As %Status

%OnConstructClone

Method %OnConstructClone(object As %RegisteredObject, deep As %Boolean = 0, ByRef cloned As %String) As %Status [ Private, ProcedureBlock = 1 ]

%OnRollBack

Method %OnRollBack() As %Status [ Private ]

%SaveData

Method %SaveData(ByRef sid As %String) As %Status [ Private, ProcedureBlock = 1 ]

SaveStream

Method SaveStream() As %Status

IODeleteStream

ClassMethod IODeleteStream(sid As %String, concurrency As %Integer = 0) As %Status [ Private ]

Read

Method Read(ByRef len As %Integer, ByRef sc As %Status) As %RawString

Write

Method Write(data As %RawString = "") As %Status

CheckAtEnd

Method CheckAtEnd() [ Private ]

Check if we are at the end of the global, but do not read the next buffer

ReadIntoBuffer

Method ReadIntoBuffer() As %Boolean [ Private ]

Reads the next node into Buffer.

Returns 0 if there is no more data.

WriteBuffer

Method WriteBuffer() As %Status [ Private ]

MoveToEnd

Method MoveToEnd() As %Status

CopyFrom

Method CopyFrom(source As %AbstractStream) As %Status

OutputToDevice

Method OutputToDevice(ByRef len As %Integer = -1) As %Status

Clear

Method Clear(permanent As %Boolean = 1) As %Status

LastModifiedGet

Method LastModifiedGet() As %TimeStamp [ CodeMode = expression ]

ReadLine

Method ReadLine(ByRef len As %Integer = 32656, ByRef sc As %Status, ByRef eol As %Boolean) As %RawString

ReadLineIntoStream

Method ReadLineIntoStream() 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.

GlobalFromSid

ClassMethod GlobalFromSid(sid As %String) As %String

Given a stream id this returns the root global node where this stream is stored

%NormalizeObject

Method %NormalizeObject() As %Status [ CodeMode = expression ]

%ValidateObject

Method %ValidateObject(force As %Integer = 0) As %Status [ CodeMode = expression ]

%Exists

ClassMethod %Exists(soid As %ObjectIdentity) As %Boolean

%ObjectIsNull

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

StreamOIDIsNull

ClassMethod StreamOIDIsNull(soid As %ObjectIdentity) As %Boolean [ CodeMode = call ]

Return true if this stream oid is a null stream and false if the stream is not null

%ObjectSizeInternal

ClassMethod %ObjectSizeInternal(soid As %ObjectIdentity) As %Integer [ Private ]

Return the size of the stream pointed to by soid

%LOBPrefetchInternal

ClassMethod %LOBPrefetchInternal(soid As %ObjectIdentity, prefetchsize As %Integer, ByRef data As %String) As %Integer [ Private ]