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
did: CARD = 6; -- Document Identifier
uninterpretedBytes: CARD = 7; -- (long) byte sequences
noValue: CARD = 8; -- there is no value for this object
symbolicLink: CARD = 9; -- the uninterpreted bytes of this object are a symbolic link
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, or it is a YggDID.DID. Otherwise it is a REF BitsRep.
BitsRep:
TYPE ~
RECORD [
validBytes: CARD,
b: PACKED SEQUENCE length: CARD16 OF BYTE
];
Uninterpreted bytes of a small object.
BytesFromBits:
PROC [bits: Bits, startByte:
CARD, block: PBasics.UnsafeBlock];
Fetch some bytes from an "uninterpreted bytes" object.
BitsFromBits:
PROC [bits: Bits]
RETURNS [copy: Bits];
Copy the Bits to a new Bits 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: PBasics.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] * BYTES[WORD];
TimeStamp:
TYPE =
RECORD[
counter: INT ← 0
];
nullTimeStamp: TimeStamp = [0];
NextTimeStamp: PROC [current: YggRep.TimeStamp] RETURNS [next: YggRep.TimeStamp];
MaxTimeStamp: PROC [ts1: YggRep.TimeStamp, ts2: YggRep.TimeStamp] RETURNS [maxTS: YggRep.TimeStamp];
CompareTimeStamps: PROC [ts1: YggRep.TimeStamp, ts2: YggRep.TimeStamp] RETURNS [PBasics.Comparison];
VDoc: TYPE ~ REF VDocRep;
VDocRep:
TYPE ~
RECORD [
did: YggDID.DID, -- document identifier for the document
tid: YggEnvironment.TransID, -- transactional view of the document
latched: BOOL ← FALSE,
reissued:
BOOL ←
FALSE,
-- cached value reissued
for links, the next three fields have non-trivial values
fromDID: YggDID.DID ← YggEnvironment.nullDID,
toDID: YggDID.DID ← YggEnvironment.nullDID,
linkType: Rope.ROPE ← NIL,
linkChanged: BOOL ← FALSE,
destroyed: BOOL ← FALSE,
contents: TypedPrimitiveElement ← [unknown, NIL],
contentsChanged: BOOL ← FALSE,
outlinks: LIST OF AttributeValue ← NIL, -- the outlinks of the document
outlinksChanged: LIST OF linkMod ← NIL, -- changes to the outlinks
inlinks: LIST OF AttributeValue ← NIL, -- the inlinks of the document
inlinksChanged: LIST OF linkMod ← NIL, -- changes to the inlinks
attributes: LIST OF Attribute ← NIL, -- the attributes of the document
namesOfAttributesChanged: LIST OF ROPE ← NIL, -- the names of attribute(s) changed, NIL if none
attributesChanged: LIST OF Attribute ← NIL, -- the attribute(s) changed, NIL if none
metaAttributes: LIST OF Attribute ← NIL, -- the meta attributes of the document (indices, parents, children, ...)
metaAttributesChanged: LIST OF metaAttributeMod ← NIL -- mod(s) to the meta attribute(s), NIL if none
];
the volatile representation of an object
linkMod:
TYPE ~
RECORD [
add: BOOL, -- TRUE => add link, FALSE => delete link
linkName: ROPE, -- name of the link type
linkValue: YggDID.DID -- DID for link (not the DID of the linked-to document)
];
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.
nullAttribute: Attribute = [NIL, FALSE, NIL];
AttributeValue:
TYPE ~
RECORD [
fieldName: ROPE, -- name of the attribute (not unique for a given document)
valueSet: LIST OF TypedPrimitiveElement -- set of values for field
];
nullAttributeValue: AttributeValue = [NIL, NIL];
metaAttributeMod:
TYPE ~
RECORD [
attributeName: ROPE, -- name of the meta attribute (e. g., $parents)
add: BOOL, -- TRUE => add attribute or modify existing value, FALSE => delete attribute
didValue: YggDID.DID, -- DID (if appropiate)
stringValue: ROPE -- value for rope (if appropiate)
];
VolatizeFromDID:
PROC [transID: YggEnvironment.TransID, did: YggDID.
DID, access: YggEnvironment.AccessRights ← readOnly, lock: YggEnvironment.LockOption ← [read, wait], metaAttributesOnly:
BOOL ←
FALSE]
RETURNS [vDoc: VDoc];
Given a DID, return the volatile form of the document it refers to. If metaAttributesOnly is TRUE, then the transID must be null.
LatchVDoc:
PROC [vDoc: VDoc, wait:
BOOL ←
TRUE]
RETURNS [latched:
BOOL];
Set a short term latch.
UnlatchVDoc:
PROC [vDoc: VDoc]
RETURNS [latched:
BOOL];
Remove a short term latch.