Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fluidframework/server-lambdas

Package Overview
Dependencies
Maintainers
3
Versions
251
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fluidframework/server-lambdas - npm Package Compare versions

Comparing version 0.1014.0-5564 to 0.1014.0-5901

23

dist/deli/checkpointContext.d.ts

@@ -5,26 +5,7 @@ /*!

*/
import { IRangeTrackerSnapshot } from "@fluidframework/common-utils";
import { ICollection, IContext, IDocument, IQueuedMessage } from "@fluidframework/server-services-core";
export interface IClientSequenceNumber {
canEvict: boolean;
clientId: string;
lastUpdate: number;
nack: boolean;
referenceSequenceNumber: number;
clientSequenceNumber: number;
scopes: string[];
}
export interface ICheckpointParams extends IDeliCheckpoint {
import { ICollection, IContext, IDeliState, IDocument, IQueuedMessage } from "@fluidframework/server-services-core";
export interface ICheckpointParams extends IDeliState {
queuedMessage: IQueuedMessage;
clear?: boolean;
}
export interface IDeliCheckpoint {
branchMap: IRangeTrackerSnapshot;
clients: IClientSequenceNumber[];
durableSequenceNumber: number;
logOffset: number;
sequenceNumber: number;
epoch: number;
term: number;
}
export declare class CheckpointContext {

@@ -31,0 +12,0 @@ private readonly tenantId;

2

dist/deli/clientSeqManager.d.ts

@@ -5,3 +5,3 @@ /*!

*/
import { IClientSequenceNumber } from "./checkpointContext";
import { IClientSequenceNumber } from "@fluidframework/server-services-core";
export declare class ClientSequenceNumberManager {

@@ -8,0 +8,0 @@ private readonly clientNodeMap;

@@ -7,3 +7,2 @@ /*!

export * from "./lambdaFactory";
export { IDeliCheckpoint } from "./checkpointContext";
//# sourceMappingURL=index.d.ts.map

@@ -5,4 +5,3 @@ /*!

*/
import { ICollection, IContext, IDocument, IPartitionLambda, IProducer, IQueuedMessage } from "@fluidframework/server-services-core";
import { IDeliCheckpoint } from "./checkpointContext";
import { ICollection, IContext, IDeliState, IDocument, IPartitionLambda, IProducer, IQueuedMessage } from "@fluidframework/server-services-core";
export declare class DeliLambda implements IPartitionLambda {

@@ -12,3 +11,3 @@ private readonly context;

private readonly documentId;
readonly lastCheckpoint: IDeliCheckpoint;
readonly lastCheckpoint: IDeliState;
private readonly forwardProducer;

@@ -35,3 +34,3 @@ private readonly reverseProducer;

private canClose;
constructor(context: IContext, tenantId: string, documentId: string, lastCheckpoint: IDeliCheckpoint, dbObject: IDocument, collection: ICollection<IDocument>, forwardProducer: IProducer, reverseProducer: IProducer, clientTimeout: number, activityTimeout: number, noOpConsolidationTimeout: number);
constructor(context: IContext, tenantId: string, documentId: string, lastCheckpoint: IDeliState, dbObject: IDocument, collection: ICollection<IDocument>, forwardProducer: IProducer, reverseProducer: IProducer, clientTimeout: number, activityTimeout: number, noOpConsolidationTimeout: number);
handler(rawMessage: IQueuedMessage): void;

@@ -38,0 +37,0 @@ close(): void;

@@ -13,3 +13,2 @@ "use strict";

const lambda_1 = require("./lambda");
const migrateDbObject_1 = require("./migrateDbObject");
// We expire clients after 5 minutes of no activity

@@ -52,3 +51,3 @@ exports.ClientSequenceTimeout = 5 * 60 * 1000;

// TODO - is this storage specific to the orderer in place? Or can I generalize the output context?
let dbObject = await this.collection.findOne({ documentId, tenantId });
const dbObject = await this.collection.findOne({ documentId, tenantId });
if (!dbObject) {

@@ -58,4 +57,2 @@ // Temporary guard against failure until we figure out what causing this to trigger.

}
// Migrate the db object to new schema if applicable.
dbObject = await migrateDbObject_1.migrateSchema(dbObject, this.collection, leaderEpoch, 1);
let lastCheckpoint;

@@ -96,7 +93,7 @@ const messageMetaData = {

}
// back-compat for older documents.
// For cases such as detached container where the document was generated outside the scope of deli
// and checkpoint was written manually.
if (lastCheckpoint.epoch === undefined) {
lastCheckpoint.epoch = leaderEpoch;
lastCheckpoint.term = 1;
lastCheckpoint.durableSequenceNumber = lastCheckpoint.sequenceNumber;
}

@@ -103,0 +100,0 @@ const newCheckpoint = FlipTerm ?

{
"name": "@fluidframework/server-lambdas",
"version": "0.1014.0-5564",
"version": "0.1014.0-5901",
"description": "Fluid service lambdas",

@@ -53,7 +53,7 @@ "homepage": "https://fluidframework.com",

"@fluidframework/common-utils": "^0.24.0-0",
"@fluidframework/gitresources": "^0.1014.0-5564",
"@fluidframework/protocol-base": "^0.1014.0-5564",
"@fluidframework/protocol-definitions": "^0.1014.0-5564",
"@fluidframework/server-services-client": "^0.1014.0-5564",
"@fluidframework/server-services-core": "^0.1014.0-5564",
"@fluidframework/gitresources": "^0.1014.0-5901",
"@fluidframework/protocol-base": "^0.1014.0-5901",
"@fluidframework/protocol-definitions": "^0.1014.0-5901",
"@fluidframework/server-services-client": "^0.1014.0-5901",
"@fluidframework/server-services-core": "^0.1014.0-5901",
"@types/semver": "^6.0.1",

@@ -72,3 +72,3 @@ "async": "^2.6.1",

"@fluidframework/eslint-config-fluid": "^0.19.1",
"@fluidframework/server-test-utils": "^0.1014.0-5564",
"@fluidframework/server-test-utils": "^0.1014.0-5901",
"@types/async": "^2.0.50",

@@ -75,0 +75,0 @@ "@types/json-stringify-safe": "^5.0.0",

@@ -8,17 +8,5 @@ /*!

import { IRangeTrackerSnapshot } from "@fluidframework/common-utils";
import { ICollection, IContext, IDocument, IQueuedMessage } from "@fluidframework/server-services-core";
import { ICollection, IContext, IDeliState, IDocument, IQueuedMessage } from "@fluidframework/server-services-core";
export interface IClientSequenceNumber {
// Whether or not the object can expire
canEvict: boolean;
clientId: string;
lastUpdate: number;
nack: boolean;
referenceSequenceNumber: number;
clientSequenceNumber: number;
scopes: string[];
}
export interface ICheckpointParams extends IDeliCheckpoint {
export interface ICheckpointParams extends IDeliState {
queuedMessage: IQueuedMessage;

@@ -28,12 +16,2 @@ clear?: boolean;

export interface IDeliCheckpoint {
branchMap: IRangeTrackerSnapshot;
clients: IClientSequenceNumber[];
durableSequenceNumber: number;
logOffset: number;
sequenceNumber: number;
epoch: number;
term: number;
}
export class CheckpointContext {

@@ -97,3 +75,3 @@ private pendingUpdateP: Promise<void>;

if (!checkpoint.clear) {
const deliCheckpoint: IDeliCheckpoint = {
const deliCheckpoint: IDeliState = {
branchMap: checkpoint.branchMap,

@@ -100,0 +78,0 @@ clients: checkpoint.clients,

@@ -7,3 +7,3 @@ /*!

import { Heap, IComparer, IHeapNode } from "@fluidframework/common-utils";
import { IClientSequenceNumber } from "./checkpointContext";
import { IClientSequenceNumber } from "@fluidframework/server-services-core";

@@ -10,0 +10,0 @@ const SequenceNumberComparer: IComparer<IClientSequenceNumber> = {

@@ -8,2 +8,1 @@ /*!

export * from "./lambdaFactory";
export { IDeliCheckpoint } from "./checkpointContext";

@@ -27,5 +27,7 @@ /*!

extractBoxcar,
IClientSequenceNumber,
ICollection,
IContext,
IControlMessage,
IDeliState,
IDocument,

@@ -44,3 +46,3 @@ IMessage,

} from "@fluidframework/server-services-core";
import { CheckpointContext, ICheckpointParams, IClientSequenceNumber, IDeliCheckpoint } from "./checkpointContext";
import { CheckpointContext, ICheckpointParams } from "./checkpointContext";
import { ClientSequenceNumberManager } from "./clientSeqManager";

@@ -116,3 +118,3 @@

private readonly documentId: string,
readonly lastCheckpoint: IDeliCheckpoint,
readonly lastCheckpoint: IDeliState,
dbObject: IDocument,

@@ -755,3 +757,3 @@ collection: ICollection<IDocument>,

private generateDeliCheckpoint(): IDeliCheckpoint {
private generateDeliCheckpoint(): IDeliState {
return {

@@ -758,0 +760,0 @@ branchMap: this.branchMap ? this.branchMap.serialize() : undefined,

@@ -12,2 +12,3 @@ /*!

IContext,
IDeliState,
IDocument,

@@ -26,5 +27,3 @@ ILogger,

import { NoOpLambda } from "../utils";
import { IDeliCheckpoint } from "./checkpointContext";
import { DeliLambda } from "./lambda";
import { migrateSchema } from "./migrateDbObject";

@@ -44,3 +43,3 @@ // We expire clients after 5 minutes of no activity

const getDefaultCheckpooint = (epoch: number): IDeliCheckpoint => {
const getDefaultCheckpooint = (epoch: number): IDeliState => {
return {

@@ -77,3 +76,3 @@ branchMap: undefined,

// TODO - is this storage specific to the orderer in place? Or can I generalize the output context?
let dbObject = await this.collection.findOne({ documentId, tenantId });
const dbObject = await this.collection.findOne({ documentId, tenantId });
if (!dbObject) {

@@ -84,7 +83,4 @@ // Temporary guard against failure until we figure out what causing this to trigger.

// Migrate the db object to new schema if applicable.
dbObject = await migrateSchema(dbObject, this.collection, leaderEpoch, 1);
let lastCheckpoint: IDeliState;
let lastCheckpoint: IDeliCheckpoint;
const messageMetaData = {

@@ -124,7 +120,7 @@ documentId,

// back-compat for older documents.
// For cases such as detached container where the document was generated outside the scope of deli
// and checkpoint was written manually.
if (lastCheckpoint.epoch === undefined) {
lastCheckpoint.epoch = leaderEpoch;
lastCheckpoint.term = 1;
lastCheckpoint.durableSequenceNumber = lastCheckpoint.sequenceNumber;
}

@@ -172,3 +168,3 @@

gitManager: IGitManager,
logger: ILogger): Promise<IDeliCheckpoint> {
logger: ILogger): Promise<IDeliState> {
const existingRef = await gitManager.getRef(encodeURIComponent(documentId));

@@ -178,3 +174,3 @@ if (existingRef) {

const content = await gitManager.getContent(existingRef.object.sha, ".serviceProtocol/deli");
const summaryCheckpoint = JSON.parse(toUtf8(content.content, content.encoding)) as IDeliCheckpoint;
const summaryCheckpoint = JSON.parse(toUtf8(content.content, content.encoding)) as IDeliState;
return summaryCheckpoint;

@@ -206,4 +202,4 @@ } catch (exception) {

logger: ILogger,
checkpoint: IDeliCheckpoint,
leaderEpoch: number): Promise<IDeliCheckpoint> {
checkpoint: IDeliState,
leaderEpoch: number): Promise<IDeliState> {
let newCheckpoint = checkpoint;

@@ -236,3 +232,3 @@ if (leaderEpoch !== newCheckpoint.epoch) {

gitManager: IGitManager,
checkpoint: IDeliCheckpoint,
checkpoint: IDeliState,
documentId: string) {

@@ -239,0 +235,0 @@ const existingRef = await gitManager.getRef(encodeURIComponent(documentId));

@@ -9,3 +9,3 @@ /*!

import { IGitManager } from "@fluidframework/server-services-client";
import { IDeliCheckpoint } from "../deli";
import { IDeliState } from "@fluidframework/server-services-core";
import { ILatestSummaryState, ISummaryReader } from "./interfaces";

@@ -39,3 +39,3 @@

const scribe = toUtf8(scribeContent.content, scribeContent.encoding);
const deli = JSON.parse(toUtf8(deliContent.content, deliContent.encoding)) as IDeliCheckpoint;
const deli = JSON.parse(toUtf8(deliContent.content, deliContent.encoding)) as IDeliState;
const term = deli.term;

@@ -42,0 +42,0 @@ const messages = JSON.parse(

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc