%Archive.Session
Class %Archive.Session Extends %RegisteredObject [ System = 4 ]
API for data archiving
Sample script that initiates a connection to an archive server Set SessionOref = ##class(%Archive.Session).%New() Set SessionOref.Host = 123.45.6.78 // IP address of the archive server Set SessionOref.AuthFile = AuthFilePath // path of the .pea file (for Centera) Set Status = SessionOref.Connect()
Once connected, here is a sample script that stores a content (cf. %Archive.Content): // create a content object as source, whose handle is ContentOref (see %Archive.Content) Set Status = SessionOref.Store(ContentOref, .ContentUID)
After Store() returns successfully, you need to save the ContentUID value somewhere (say, in a database) for future retrieval purpose.
Here is a sample script to retrieve the file from the archive server, using the ContentUID and open connection above: // create a content object as target, whose handle is ContentOref (see %Archive.Content) Set Status = SessionOref.Retrieve(ContentOref, ContentUID)
Limitations:
- Only EMC Centera server is supported as an archive server
- The source of storing and the target of retrieval must be files
- Only one open connection per process. Attempt to open additional connections (whether to the same server as the existing connection or not) would get an error.
- Retrieving selected files from a content containing multiple files ("blobs") is not supported.
Parameters
TYPE
Parameter TYPE = "Centera";
Type of the archive system (EMC Centera)
VERSION
Parameter VERSION = 0.1;
Version of the API
Properties
Host
Property Host As %String;
Connection information, a comma-delimited list of IP addresses
For example, "10.2.3.4,10.6.7.8"
AuthFile
Property AuthFile As %String;
The path of a Pool Entry Authorization file (*.pea)
UserName
Property UserName As %Library.Username;
An alternative to a PEA file is a pair of UserName and Password
Password
Property Password As %String;
ApplicationName
Property ApplicationName As %String;
Name of the application, default to something like "Cache for Windows (x86-32)" (from $zv)
ApplicationVersion
Property ApplicationVersion As %String;
Version of the application, default to something like "2008.2 (Build 366U)" (from $zv)
BufferSizeInKB
Property BufferSizeInKB As %Integer [ InitialExpression = 64, Private ];
The size of an internal C-Clip buffer in bytes. This value must be greater than 0. The SDK default value is 16KB. The default value we use here is 64KB.
PrefetchSizeInKB
Property PrefetchSizeInKB As %Integer(MAXVAL = 1024) [ InitialExpression = 1024, Private ];
The size of the prefetch buffer. This buffer is used to assist in determining the size of the blob. The SDK default size is 32 KB. The maximum size is 1 MB, which is the default value we use here.
EmbeddedDataThreshold
Property EmbeddedDataThreshold As %Integer(MAXVAL = 102400) [ InitialExpression = 102400, Private ];
The maximum data size, in bytes, for data to be embedded in the CDF instead of being stored as separate blobs. The SDK default value is 0 bytes, meaning data is never embedded in the CDF. The maximum value is 102400 bytes (100 KB), which is the default value we use here. The value for the embedded data threshold can be set to less than or equal to 102400 bytes.
dllid
Property dllid As %Integer [ Internal, MultiDimensional, Private ];
dllid = DLL ID dllid(FuncName) = DLL Function ID
Methods
GetAuthorization
Method GetAuthorization() As %String [ Private ]
Create a string based on AuthFile or UserName and Password. The string will be part of the connection argument for opening the pool.
Connect
Method Connect() As %Status
Connect to the server
Disconnect
Method Disconnect() As %Status
Disconnect from the server
DeleteContent
Method DeleteContent(ContentUID As %String) As %Status
Delete a content (C-Clip) by its UID (ContentAddress)
AccessContent
Method AccessContent(ContentUID As %String) As %Status
Test the existence of a content (C-Clip) by its UID (ContentAddress)
%OnNew
Method %OnNew() As %Status [ Private ]
Load DLL
%OnClose
Method %OnClose() As %Status [ Private ]
Unload DLL
Store
Method Store(ContentOref As %Archive.Content, ByRef ContentUID As %String) As %Status
Store an entire content to server, commit and return a UID by reference
Retrieve
Method Retrieve(ContentOref As %Archive.Content, ContentUID As %String) As %Status
Retrieve an entire content from server
LookUpDLLFunc
Method LookUpDLLFunc(FuncName) As %Integer [ Private ]
CheckVersion
Method CheckVersion() As %Status [ Private ]
Register
Method Register() As %Status [ Private ]
SetEmbeddedDataThreshold
Method SetEmbeddedDataThreshold() As %Status [ Private ]
SetBufferSize
Method SetBufferSize() As %Status [ Private ]
GetErrorDetail
Method GetErrorDetail() As %Status [ Private ]
Write
Method Write(DataSource As %String, TagName As %String) As %Status [ Private ]
A name for the data is required and cannot be NULL
ReadNext
Method ReadNext(DataSink As %String) As %Status [ Private ]
WriteFile
Method WriteFile(Path As %String) As %Status [ Private ]
Create a tag with a 'TagName' and stream the given file to the blob associated with the tag Acceptable characters for a TagName are ASCII characters in the Set [a-zA-Z0-9_-.]. [No restriction in Unicode version] The first character must be a letter or an underscore "_". The name must be XML compliant and cannot start with the prefix "xml" or "eclip". May generate error
ReadFile
Method ReadFile(Path As %String) As %Status [ Private ]
Read the blob associated with the tag by the name 'TagName' to the file given by 'Path' If TagName is not specified, use the current tag (either the first tag or the tag pointed to by GetNextTag()) If TagName is not unique in the content, use the first matching tag. May generate error
WriteStream
Method WriteStream(StreamOref As %Stream, TagName As %String = "_") As %Status [ Private ]
Similar to WriteFile, except that the data source is a %Stream object. NOT IMPLEMENTED.
ReadStream
Method ReadStream(StreamOref As %Stream, TagName As %String) As %Status [ Private ]
Similar to ReadFile, except that the data sink is a %Stream object. NOT IMPLEMENTED.
Create
Method Create(ContentOref As %Archive.Content) As %Status [ Private ]
Commit
Method Commit(ByRef ContentUID As %String) As %Status [ Private ]
Open
Method Open(ContentOref As %Archive.Content, ContentUID As %String) As %Status [ Private ]
Close
Method Close() As %Status [ Private ]
SetAttribute
Method SetAttribute(AttribName As %String, AttribValue As %String) As %Status [ Private ]
NewTag
Method NewTag(Name) As %Status [ Private ]
NextTag
Method NextTag(ByRef Name As %String) As %Status [ Private ]