Type: Boolean
The singleFile property of the JadeBytes class specifies whether the binary content is stored in its own dedicated file.
This property can be set to true for persistent instances only.
Once the singleFile property is set to true or the instance has been stored in the database, the value of this property cannot be changed. You should therefore set this property as soon as possible after an instance is created.
For persistent JadeBytes objects with the value of the singleFile property set to false (the default), the binary content is stored in a common file. The name of the file is constructed from the name of the map file followed by _udr (where _udr stands for Unstructured Data Resource), as follows.
mapFile_udr.dat
For persistent JadeBytes objects with the value of the singleFile property set to true, the binary content is stored in separate files, one for each object. The names of these files are constructed from the name of the map file followed by _udr (where _udr stands for Unstructured Data Resource) and the oid of the object, as follows.
mapFile_udr[oid].dat
Certain operations on a persistent JadeBytes object in a dedicated file effectively become file system operations (which the file system is optimized to perform). For example, content is appended to a JadeBytes object by appending to the end of the file. There is no costly free-space management involved as there would be for a standard database file. Similarly, truncating data becomes a simple file system operation, and deleting an object amounts to deleting the file.
Less journal space is used when an instance is updated by full content replacement, as only the new content is included in the journal records. Transaction abort and crash recovery is handled by renaming the original file from name.dat to name.transaction-number.bak and creating a new file for the content. If the transaction completes successfully, the .bak file is removed. If the transaction is aborted, the new .dat file is removed and the .bak file is renamed to .dat.
When the value of the singleFile property is set to true, the associated dedicated file is created as an empty file.
Each JadeBytes class singleFile instance includes an MD5 checksum of its contents. Full content-replacement operations (for example, setContent or loadFromFile) update this checksum as part of the operation. Partial-update operations (for example, putData or appendData) clear the checksum and it is your responsibility to invoke the updateChecksum method, if required. To determine if unexpected changes have been made to the content, invoke the matchChecksum method.
A potential drawback of storing persistent JadeBytes objects in separate files is an operating system limit on the number of files that a process can have open at one time.