persistent class %Library.GlobalEdit
extends %Persistent, %SYSTEM.Help
parameter DEFAULTCONCURRENCY = 0;
DEFAULTCONCURRENCY is the default value for the concurrency formal argument
defined for %Open, %OpenId, %Delete and %DeleteId methods. It is not the default
value of the %Concurrency property of persistent classes. If the value of the actual
concurrency argument passed to any of the above methods is -1 then the formal argument value will
be set to the value of the DEFAULTCONCURRENCY parameter value defined for the class.
property Collation
as %Library.Collate;
Collation of the global.
property DatabaseBlockSize
as %Integer(VALUELIST=",2048,4096,8192,16384,32768,65536") [ InitialExpression = $$$8k,ReadOnly ];
Block size of the database the global is in.
property Directory
as %SysPath [ ReadOnly ];
Directory global is located in.
property Exists
as Security.Datatype.BooleanYN [ ReadOnly ];
Global directory entry exists.
property FirstDataBlock
as %Integer [ Calculated ];
First data block of the global.
Note referencing this property causes a $D(global) and I/O to occur.
property GrowthBlock
as %Integer;
Growth block for the global.
property IsEmpty
as Security.Datatype.BooleanYN [ ReadOnly ];
Global contains no data.
property IsKeep
as Security.Datatype.BooleanYN;
Keep global directory attributes when deleted.
property Name
as %String;
Name of the global.
property Permission
as Security.Datatype.Permission [ ReadOnly ];
Current permission on the global.
This is the "RW" value that the process who has this
instance open has access to it.
property PointerBlock
as %Integer;
Top pointer block of the global.
property ResourceName
as %String [ ReadOnly ];
Resource name of the global.
property System
as %String [ ReadOnly ];
System name where global resides.
classmethod CheckGlobalIntegrity(Directory As %String = "", Name As %String, StopAfterAnyError As %Boolean)
as %Status
This checks the integrity of a single global. The return value contains information about the global
method CheckIntegrity(Silent As %Boolean)
as %Status
This checks the integrity of a global. The return value contains information about the global
classmethod CollationPrompt(Prompt, Obj)
method CollationSet(Arg As %Integer)
as %Status
This is a Set accessor method for the Collation property.
method Compact(PercentFull As %Integer = 90, ByRef MbProcessed As %Float, ByRef MbCompressed As %Float, MbToCompress As %Integer = 0, ByRef LastGlobalReference As %String = "")
as %Status
Compact a global.
PercentFull - How full each data page should be, 50-100
MbProcessed - How many MB of the global was processed
MbCompressed - How many MB was it compressed to
MbToCompress - How many MB of the global to compress in this call (0=ALL)
LastGlobalReference - Last reference, "" = completed
Typical useage is as follows, which compacts the data pages
to 80%full, and returns the amount of data processed, and the size it was compacted to:
s x=##Class(%GlobalEdit).Open("X",dbdirectory)
s t=x.Compact(80,.CurrSize,.NewSize)
Note that this function can be called repeatedly for the same global so that
it can be done in chunks by using the last two parameters. The following example
does 10MB chunks of the global at a time and accumulates and displays a status:
s x=##Class(%GlobalEdit).Open("X",dbdirectory)
s TotalCurrSize=0,TotalNewSize=0
do {
s t=x.Compact(80,.CurrSize,.NewSize,10,.LastReference)
s TotalCurrSize=TotalCurrSize+CurrSize
s TotalNewSize=TotalNewSize+NewSize
w !,"Global "_x.Name_" processed="_TotalCurrSize_", compacted to="_TotalNewSize
} while LastReference'=""
classmethod CompactGlobal(Name As %String, Directory As %String = $zu(12, ""), PercentFull As %Integer = 90, ByRef MbProcessed As %Integer, ByRef MbCompressed As %Integer, MbToCompress As %Integer = 0, ByRef LastGlobalReference As %String = "")
as %Status
Compact a global.
See the method Compact for details on parameters.
classmethod Create(Namespace As %String = "", Name As %String, Collation As %String, GrowthBlock As %Integer, PointerBlock As %Integer, Keep As %Boolean, JournalState As %Integer, ByRef Exists As %Boolean)
as %Status
Create a global with specified characteristics. Parameter Namespace can be a namespace or a directory. If it is a namespace global mapping rules will apply.
method FirstDataBlockGet()
as %Integer
This is a Get accessor method for the FirstDataBlock property.
classmethod GetGlobalSize(Directory As %String, GlobalName As %String, ByRef Allocated As %Integer, ByRef Used As %Integer, fast As %Boolean = 0)
as %Status
Get size of this global
'Allocated' - total size of blocks allocated for the global.
'Used' - total used data for the global.
'fast' - TRUE : faster return, it won't return the value of 'Used'.
FALSE - slower return,, it returns values for both 'Allocated' and 'Used'.
classmethod GrowthBlockPrompt(Prompt, Obj)
method GrowthBlockSet(Arg As %String)
as %Status
This is a Set accessor method for the GrowthBlock property.
classmethod IsKeepPrompt(Prompt, Obj)
method IsKeepSet(Arg As %Boolean)
as %Status
This is a Set accessor method for the IsKeep property.
method NameSet(Arg As %String)
as %Status
Set the Global name.
If prefaced by a "^" strip it off
classmethod Open(Name As %String, Directory As %String = $zu(12, ""), System As %String = "", concurrency As %Integer = -1, ByRef sc As %Status = $$$OK)
as %ObjectHandle
Open an instance of a global.
classmethod PointerBlockPrompt(Prompt, Obj)
method PointerBlockSet(Arg As %String)
as %Status
This is a Set accessor method for the PointerBlock property.