Volatile object representation
TypedPrimitiveElement:
TYPE ~
RECORD [docType: DocType, bits: Bits];
Basic elemental object part, with its type.
DocType:
TYPE ~
CARD;
Type of the primitive element.
Reserved document types are 0-65535. Here are some well known types.
unknown: CARD = 0; -- place holder during various operations; never should be seen by clients
int: CARD = 1; -- 32 bit integers
rope: CARD = 2; -- (long null containing) strings
shortRope: CARD = 3; -- strings that are short and null terminated
float: CARD = 4; -- 32 bit floating point
date: CARD = 5; -- GMT date
uninterpretedBytes: CARD = 6; -- (long) byte sequences
lastReservedDocType: CARD = 1023; -- all of types up to and including this one are reserved by the system
Bits: TYPE ~ REF; -- For well known types, Bits is a REF to an INT32, ROPE, REAL32, or YggRep.AccurateGMT. Otherwise it is a REF BitsRep.
BitsRep:
TYPE ~
RECORD [
validBytes: CARD,
b: PACKED SEQUENCE length: CARD OF BYTE
];
Uninterpreted bytes of a small object.
BytesFromBits:
PROC [bits: Bits, startByte:
CARD, block: Basics.UnsafeBlock];
Fetch some bytes from an "uninterpreted bytes" object.
SizeOfBits:
PROC [bits: Bits]
RETURNS [size:
CARD];
Size in bytes of an "uninterpreted bytes" object.
SetSizeOfBits:
PROC [bits: Bits, size:
CARD]
RETURNS [newRef:
BOOL, newBits: Bits];
Set the size in bytes of an "uninterpreted bytes" object. If this grows the object, the new bytes are uninitalized. This may grow the object and change its representation. All callers must look at the newRef and newBits return values. If newRef is TRUE, then the old bits object is no longer valid. The caller is responsible for updating the data structure from which it obtained the bits.
BytesToBits:
PROC [bits: Bits, startByte:
CARD, block: Basics.UnsafeBlock]
RETURNS [newRef:
BOOL, newBits: Bits];
Store some bytes into an uninterpreted bytes" object. This may grow the object and change its representation. All callers must look at the newRef and newBits return values. If newRef is TRUE, then the old bits object is no longer valid. The caller is responsible for updating the data structure from which it obtained the bits.
AccurateGMT: TYPE ~ REF AccurateGMTRep;
AccurateGMTRep:
TYPE ~
RECORD [
gmt: BasicTime.GMT, -- 1968 to 2036 (231 seconds)
usecs: INT32
];
AccurateGMTRepByteSize:
INT =
WORDS[AccurateGMTRep] * Basics.charsPerWord;
VDoc: TYPE ~ REF VDocRep;
VDocRep:
TYPE ~
RECORD [
did: YggDID.DID, -- document identifier for the document
contents: TypedPrimitiveElement ← [unknown, NIL],
attributes: LIST OF Attribute ← NIL -- the attributes of the document
];
the volatile representation of an object
Attribute:
TYPE ~
RECORD [
attributeName: ROPE, -- name of the attribute (not unique for a given document)
ordered: BOOL, -- whether the the valueSet is ordered
value: LIST OF AttributeValue -- set of values for attribute
];
An attribute for an object.
AttributeValue:
TYPE ~
RECORD [
fieldName: ROPE, -- name of the attribute (not unique for a given document)
valueSet: LIST OF TypedPrimitiveElement -- set of values for field
];
An attribute for an object.
VolatizeFromDID:
PROC [transID: YggEnvironment.TransID, did: YggDID.
DID, access: YggEnvironment.AccessRights ← readOnly, lock: YggEnvironment.LockOption ← [intendRead, wait]]
RETURNS [document: VDoc];
Given a DID, return the volatile form of the document it refers to.
StabilizeToFiles:
PROC [transID: YggEnvironment.TransID, did: YggDID.
DID, document: VDoc, contents, attributes, links: YggFile.FileHandle];
Given a document, write it out to the files.