Skip to content 

DeltaManager Class

Packages > @fluidframework/container-loader > DeltaManager

Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta messages in order regardless of possible network conditions or timings causing out of order delivery.

Signature:

export declare class DeltaManager extends TypedEventEmitter<IDeltaManagerInternalEvents> implements IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, IEventProvider<IDeltaManagerInternalEvents> 

Extends: TypedEventEmitter<IDeltaManagerInternalEvents>

Implements: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>, IEventProvider<IDeltaManagerInternalEvents>

Constructors

List of constructors for this class
Constructor Modifiers Description
(constructor)(serviceProvider, client, logger, reconnectAllowed) Constructs a new instance of the DeltaManager class

Properties

List of properties for this class
Property Modifiers Type Description
active boolean
clientDetails IClientDetails
connectionMode ConnectionMode The current connection mode, initially write.
disposed boolean
IDeltaSender this
inbound IDeltaQueue<ISequencedDocumentMessage>
inboundSignal IDeltaQueue<ISignalMessage>
initialSequenceNumber number
lastKnownSeqNumber number
lastSequenceNumber number
maxMessageSize number
minimumSequenceNumber number
outbound IDeltaQueue<IDocumentMessage[]>
readonly boolean | undefined Tells if container is in read-only mode. Data stores should listen for "readonly" notifications and disallow user making changes to data stores. Readonly state can be because of no storage write permission, or due to host forcing readonly mode for container. It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.
readonlyPermissions boolean | undefined Tells if user has no write permissions for file in storage It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.
reconnectMode ReconnectMode Automatic reconnecting enabled or disabled. If set to Never, then reconnecting will never be allowed.
referenceTerm number
scopes string[] | undefined
serviceConfiguration IServiceConfiguration | undefined
socketDocumentId string | undefined
version string

Methods

List of methods on this class
Method Modifiers Description
attachOpHandler(minSequenceNumber, sequenceNumber, term, handler) Sets the sequence number from which inbound messages should be returned
close(error) Closes the connection and clears inbound & outbound queues.
connect(args)
dispose()
flush()
forceReadonly(readonly) Sends signal to runtime (and data stores) to be read-only. Hosts may have read only views, indicating to data stores that no edits are allowed. This is independent from this._readonlyPermissions (permissions) and this.connectionMode (server can return "write" mode even when asked for "read") Leveraging same "readonly" event as runtime & data stores should behave the same in such case as in read-only permissions. But this.active can be used by some DDSes to figure out if ops can be sent (for example, read-only view still participates in code proposals / upgrades decisions)
setAutomaticReconnect(reconnect) Enables or disables automatic reconnecting. Will throw an error if reconnectMode set to Never.
submit(type, contents, batch, metadata)
submitSignal(content)
updateQuorumJoin()
updateQuorumLeave()

Constructors

DeltaManager.(constructor)

Constructs a new instance of the DeltaManager class

Signature:

constructor(serviceProvider: () => IDocumentService | undefined, client: IClient, logger: ITelemetryLogger, reconnectAllowed: boolean);

Parameters

List of parameters
Parameter Type Description
serviceProvider () => IDocumentService | undefined
client IClient
logger ITelemetryLogger
reconnectAllowed boolean

Properties

active

Signature:

get active(): boolean;

clientDetails

Signature:

readonly clientDetails: IClientDetails;

connectionMode

The current connection mode, initially write.

Signature:

get connectionMode(): ConnectionMode;

disposed

Signature:

get disposed(): boolean;

IDeltaSender

Signature:

get IDeltaSender(): this;

inbound

Signature:

get inbound(): IDeltaQueue<ISequencedDocumentMessage>;

inboundSignal

Signature:

get inboundSignal(): IDeltaQueue<ISignalMessage>;

initialSequenceNumber

Signature:

get initialSequenceNumber(): number;

lastKnownSeqNumber

Signature:

get lastKnownSeqNumber(): number;

lastSequenceNumber

Signature:

get lastSequenceNumber(): number;

maxMessageSize

Signature:

get maxMessageSize(): number;

minimumSequenceNumber

Signature:

get minimumSequenceNumber(): number;

outbound

Signature:

get outbound(): IDeltaQueue<IDocumentMessage[]>;

readonly

Tells if container is in read-only mode. Data stores should listen for “readonly” notifications and disallow user making changes to data stores. Readonly state can be because of no storage write permission, or due to host forcing readonly mode for container. It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.

Signature:

get readonly(): boolean | undefined;

readonlyPermissions

Tells if user has no write permissions for file in storage It is undefined if we have not yet established websocket connection and do not know if user has write access to a file.

Signature:

get readonlyPermissions(): boolean | undefined;

reconnectMode

Automatic reconnecting enabled or disabled. If set to Never, then reconnecting will never be allowed.

Signature:

get reconnectMode(): ReconnectMode;

referenceTerm

Signature:

get referenceTerm(): number;

scopes

Signature:

get scopes(): string[] | undefined;

serviceConfiguration

Signature:

get serviceConfiguration(): IServiceConfiguration | undefined;

socketDocumentId

Signature:

get socketDocumentId(): string | undefined;

version

Signature:

get version(): string;

Methods

attachOpHandler

Sets the sequence number from which inbound messages should be returned

Signature:

attachOpHandler(minSequenceNumber: number, sequenceNumber: number, term: number, handler: IDeltaHandlerStrategy): void;

Parameters

List of parameters
Parameter Type Description
minSequenceNumber number
sequenceNumber number
term number
handler IDeltaHandlerStrategy

Returns:

void

close

Closes the connection and clears inbound & outbound queues.

Signature:

close(error?: ICriticalContainerError): void;

Parameters

List of parameters
Parameter Type Description
error ICriticalContainerError

Returns:

void

connect

Signature:

connect(args?: IConnectionArgs): Promise<IConnectionDetails>;

Parameters

List of parameters
Parameter Type Description
args IConnectionArgs

Returns:

Promise<IConnectionDetails>

dispose

Signature:

dispose(): void;

Returns:

void

flush

Signature:

flush(): void;

Returns:

void

forceReadonly

Sends signal to runtime (and data stores) to be read-only. Hosts may have read only views, indicating to data stores that no edits are allowed. This is independent from this._readonlyPermissions (permissions) and this.connectionMode (server can return “write” mode even when asked for “read”) Leveraging same “readonly” event as runtime & data stores should behave the same in such case as in read-only permissions. But this.active can be used by some DDSes to figure out if ops can be sent (for example, read-only view still participates in code proposals / upgrades decisions)

Signature:

forceReadonly(readonly: boolean): void;

Parameters

List of parameters
Parameter Type Description
readonly boolean

Returns:

void

setAutomaticReconnect

Enables or disables automatic reconnecting. Will throw an error if reconnectMode set to Never.

Signature:

setAutomaticReconnect(reconnect: boolean): void;

Parameters

List of parameters
Parameter Type Description
reconnect boolean

Returns:

void

submit

Signature:

submit(type: MessageType, contents: any, batch?: boolean, metadata?: any): number;

Parameters

List of parameters
Parameter Type Description
type MessageType
contents any
batch boolean
metadata any

Returns:

number

submitSignal

Signature:

submitSignal(content: any): void;

Parameters

List of parameters
Parameter Type Description
content any

Returns:

void

updateQuorumJoin

Signature:

updateQuorumJoin(): void;

Returns:

void

updateQuorumLeave

Signature:

updateQuorumLeave(): void;

Returns:

void