%Storage.Persistent
Class %Storage.Persistent Extends %Storage [ Abstract, Not ProcedureBlock, System = 2 ]
This class contains the storage interface methods for the default storage structure. The storage interface methods, which are implemented as method generators, work in conjunction with the persistent interface methods of the %Persistent class to provide persistent behavior for objects.
The methods of this class are not meant to be called directly. Use the methods of the %Persistent class which, in turn, call the appropriate method.
Parameters
STORAGECOMPILERCLASS
Parameter STORAGECOMPILERCLASS = "%Compiler.Storage.Persistent";
STORAGEINTERFACE
Parameter STORAGEINTERFACE As STRING [ Constraint = ",persistent,serial", Flags = ENUM ] = "persistent";
STORAGEINTERFACE defines the type of serialization implemented by this class. The value has to match the classtype of the class that is inheriting the serialization interface.
Methods
"%%CLASSNAMEStorageToLogical"
ClassMethod "%%CLASSNAMEStorageToLogical"(%val) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%AncestryStorageToLogical
"%%CLASSNAMELogicalToStorage"
ClassMethod "%%CLASSNAMELogicalToStorage"(%val) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%AncestryLogicalToStorage
%BMEBuilt
ClassMethod %BMEBuilt(ByRef bmeName As %String) As %Boolean [ CodeMode = generator, ServerOnly = 1 ]
%BuildIndices
ClassMethod %BuildIndices(pIndexList As %RawString = "", pAutoPurge As %Integer = 1, pLockFlag As %Integer = 0, pJournalFlag As %Integer = "", pStartID As %RawString = "", pEndID As %RawString = "", pIgnoreIndexList As %RawString = "", pKeepSelectability As %Integer = 0, pNumberJobs As %Integer = "") As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1, ServerOnly = 1 ]
This method will build the indexes requested for the range of ID's requested. If it is prudent to do this work in the background using multiple processes then it will be done using $system.WorkMgr. If doing the work in the background then the extent will be partitioned using one of four different algorithms. 1) Integer ID, no bitmap extent index present - compute the difference between the first ID and the last, divide by partition size; 2) Integer ID, bitmap extent index present - chunk up using bitmap chunk size and the bitmap extent; 3) Single non-integer property - 4) Composite ID on non-integer property -
%BuildDeferredIndices
ClassMethod %BuildDeferredIndices(lockFlag As %Integer = 0, journalFlag As %Integer = 1) As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1 ]
%BuildIndicesSegment
ClassMethod %BuildIndicesSegment(pStartID As %Integer, pEndID As %Integer, ByRef pIndexHandle As %Binary = 0, pLockFlag As %Integer = 1, pFirstRange As %Boolean = 0, pJob As %RawString = "") As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1, ServerOnly = 1 ]
This function generates the code to iterate over a range of ID values, invoking the index filer for each ID.
%BuildDeferredSegment
ClassMethod %BuildDeferredSegment(chunkPtr As %Integer, chunk As %Binary, pLockFlag As %Integer = 1, pJob As %RawString = "") As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1, ServerOnly = 1 ]
%DeleteData
ClassMethod %DeleteData(id As %String, concurrency As %Integer) As %Status [ CodeMode = generator, Final, Private, ProcedureBlock = 1, ServerOnly = 1 ]
%DeleteData() Delete object from persistent storage The caller is responsible for calling %IdSet() Don't include class name with id in input parameter
%Exists
ClassMethod %Exists(oid As %ObjectIdentity = "") As %Boolean [ Final, ProcedureBlock = 1, ServerOnly = 0 ]
%Exists() Check to see if an OID exists in the extent of this class...
%ExistsId
ClassMethod %ExistsId(id As %String) As %Boolean [ CodeMode = generator, Final, ProcedureBlock = 1, ServerOnly = 0 ]
%ExistsId() Check to see if an ID exists in the extent of this class...
%FileIndices
ClassMethod %FileIndices(id As %String(MAXLEN=""), ByRef pIndexHandle As %Binary = 0, ByRef pVectorBuffer As %RawString) As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1, ServerOnly = 1 ]
Files each index for the object identified by id. pIndexHandle is for internal use only.
Returns a %Status value indicating success or failure. This method is normally generated by the storage class for persistent classes using %Storage.Persistent or %Storage.SQL.
%FileIndicesBuffered
ClassMethod %FileIndicesBuffered(id As %String(MAXLEN=""), ByRef pIndexHandle As %Binary = 0, ByRef pIndexBuffer As %RawString = "", ByRef pVectorBuffer As %RawString) As %Status [ CodeMode = generator, Internal, ProcedureBlock = 1, ServerOnly = 1 ]
%InitExtentData
ClassMethod %InitExtentData() As %Status [ CodeMode = generator, Final, ServerOnly = 1 ]
Initialize the data global for extent root classes. Return an error if the class is not the extent root class.
%KillExtentData
ClassMethod %KillExtentData(killstreams As %Boolean = 0, reinitialize As %Boolean = 0) As %Status [ CodeMode = generator, Final, ServerOnly = 1 ]
Kill the data, index, and idlocations for extent root classes. Return an error if the class is not the extent root class. If killstreams is true (default is false) it will also kill the default stream storage global. If reinitialize is true (default is false) it will also call %InitExtent to re-define the globals.
%LoadData
Method %LoadData(id As %String) As %Status [ CodeMode = generator, Final, Private, ProcedureBlock = 1, ServerOnly = 1 ]
Load object from persistent storage into memory. The caller is responsible for calling %IdSet() Don't include class name with id in input parameter
%LoadFromMemory
ClassMethod %LoadFromMemory(id As %String, ByRef objstate As %String, ByRef obj As %String) As %Status [ Final, ProcedureBlock = 1, ServerOnly = 1 ]
Load object from persistent storage into memory. The caller is responsible for calling %IdSet() Don't include class name with id in input parameter state is the physical data where the structure of state mirrors the structure of the object on disk obj is an array, subscripted by property name where each array element is equal to the property value named as the subscript.
%LoadDataFromMemory
Method %LoadDataFromMemory(id As %String, ByRef objstate As %String, ByRef obj As %String) As %Status [ CodeMode = generator, Final, Internal, Private, ProcedureBlock = 1, ServerOnly = 1 ]
%PhysicalAddress
ClassMethod %PhysicalAddress(id As %String, ByRef paddr As %String) As %Status [ CodeMode = generator, Final, ServerOnly = 1 ]
Load object from persistent storage into memory. The caller is responsible for calling %IdSet() Don't include class name with id in input parameter
%OnDetermineClass
ClassMethod %OnDetermineClass(oid As %ObjectIdentity, ByRef class As %String) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%OnDetermineClass - find the most-specific-type-class for the given OID.
%PurgeIndices
ClassMethod %PurgeIndices(idxlist As %List = "", lockExtent As %Boolean = 0, pIgnoreIndexList As %RawString = "", pJournalFlag As %Library.Integer = "") As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%LockExtent
ClassMethod %LockExtent(shared As %Boolean = 0) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
Acquire (s)hared or (e)xclusive locks based on locktype parameter
%UnlockExtent
ClassMethod %UnlockExtent(shared As %Boolean = 0, immediate As %Boolean = 0) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
Release (s)hared or (e)xclusive locks based on locktype parameter
%LockId
ClassMethod %LockId(id As %String, shared As %Boolean = 0, timeout As %Integer = {$$$LockTimeout}) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 0 ]
%LockId() - Obtain an exclusive or shared lock on the object identified by id. The type of lock obtained is determined by shared. This method overrides the implementation from %Library.Persistent.
%UnlockId
ClassMethod %UnlockId(id As %String, shared As %Boolean = 0, immediate As %Boolean = 0) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 0 ]
%UnlockId() - Release an exclusive or shared lock on the object identified by id. The type of lock released is determined by shared. This method overrides the implementation from %Library.Persistent.
%SaveData
Method %SaveData(id As %String) As %Status [ CodeMode = generator, Final, Private, ProcedureBlock = 1, ServerOnly = 1 ]
%SaveData() - Save the object to a persistent state (e.g. store it on disk). Returns: oid or "" if save fails
%InsertBatch
ClassMethod %InsertBatch(objects As %List, concurrency As %Integer = 0, useTransactions As %Boolean = 0) As %List [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%SaveDirect
ClassMethod %SaveDirect(ByRef id As %String = "", idList As %List = "", ByRef data As %Binary, concurrency As %Integer = -1) As %Status [ CodeMode = generator, Final, ProcedureBlock = 1, ServerOnly = 1 ]
%SaveDirect() - saves an object to disk, checks uniqueness and referential integrity constraints, and maintains index structures. This method is implemented by the storage class.
%SaveIndices
ClassMethod %SaveIndices(pStartId As %String(MAXLEN="") = "", pEndId As %String(MAXLEN="") = "", lockExtent As %Boolean = 0) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 0 ]
Files the indices for all objects whose ID is in the range defined by pStartId and pEndId. If pEndID is null then it defaults to pStartId. If pStartId is null then the range is empty and no filing will occur. If lockExtent is true then an extent lock will be acquired before the indices are built. If the lock cannot be acquired then an error is returned. The lock is released after the index filing is completed.
Returns a %Status value indicating success or failure.
%SortBegin
ClassMethod %SortBegin(idxlist As %List = "", excludeunique As %Integer = 0) As %Status [ CodeMode = generator, ServerOnly = 1 ]
%SortBegin() This method will start a system merge sort for all indices (idxlist is null) or for specified indices
%SortEnd
ClassMethod %SortEnd(idxlist As %List = "", commit As %Integer = 1, excludeunique As %Integer = 0) As %Status [ CodeMode = generator, ProcedureBlock = 1, ServerOnly = 1 ]
%SortEnd() This method will end a system merge sort for all indices (idxlist is null) or for specified indices