MCPcopy Index your code
hub / github.com/tinyplex/tinybase / seenHlc

Function seenHlc

src/common/hlc.ts:54–67  ·  view source on GitHub ↗
(hlc?: Hlc)

Source from the content-addressed store, hash-verified

52 };
53
54 const seenHlc = (hlc?: Hlc): void => {
55 const previousLogicalTime = lastLogicalTime;
56 const [remoteLogicalTime, remoteCounter] =
57 isUndefined(hlc) || hlc == EMPTY_STRING ? [0, 0] : decodeHlc(hlc);
58 lastLogicalTime = mathMax(previousLogicalTime, remoteLogicalTime, getNow());
59 lastCounter =
60 lastLogicalTime == previousLogicalTime
61 ? lastLogicalTime == remoteLogicalTime
62 ? mathMax(lastCounter, remoteCounter)
63 : lastCounter
64 : lastLogicalTime == remoteLogicalTime
65 ? remoteCounter
66 : -1;
67 };
68
69 const encodeHlc = (logicalTime42: number, counter24: number, clientId?: Id) =>
70 encode(logicalTime42 / SHIFT36) +

Callers 3

getNextHlcFunction · 0.70
common.test.tsFile · 0.50
mergeContentOrChangesFunction · 0.50

Calls 2

isUndefinedFunction · 0.90
decodeHlcFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…