import { IDisposable , IErrorEvent , IEventProvider } from "@fluidframework/common-definitions" ; import { ISequencedClient } from "./clients" ; /**
 * Proposal to set the given key/value pair.
 *
 * Consensus on the proposal is achieved if the MSN is \>= the sequence number
 * at which the proposal is made and no client within the collaboration window rejects
 * the proposal.
 */ export interface IProposal { key : string ; value : any ; } /**
 * Similar to IProposal except includes the sequence number when it was made in addition to the fields on IProposal
 */ export type ISequencedProposal = { sequenceNumber : number ; } & IProposal ; /**
 * Adds the sequence number at which the message was approved to an ISequencedProposal
 */ export type IApprovedProposal = { approvalSequenceNumber : number ; } & ISequencedProposal ; /**
 * Adds the sequence number at which the message was committed to an IApprovedProposal
 */ export type ICommittedProposal = { commitSequenceNumber : number ; } & IApprovedProposal ; /**
 * A proposal that has been propposed, but not yet accepted or committed
 */ export interface IPendingProposal extends ISequencedProposal { /**
     * Sends a rejection for the proposal
     */ reject ( ) ; /**
     * Disables the sending of rejections for this proposal
     */ disableRejection ( ) ; /**
     * Returns true if rejections has been disable, otherwise false
     */ readonly rejectionDisabled : boolean ; } /**
 * Events fired by a Quorum in response to client tracking.
 */ export interface IQuorumClientsEvents extends IErrorEvent { ( event , listener ) ; ( event , listener ) ; } /**
 * Events fired by a Quorum in response to proposal tracking.
 */ export interface IQuorumProposalsEvents extends IErrorEvent { ( event , listener ) ; ( event , listener ) ; ( event , listener ) ; ( event , listener ) ; } /**
 * All events fired by an IQuorum, both client tracking and proposal tracking.
 */ export type IQuorumEvents = IQuorumClientsEvents & IQuorumProposalsEvents ; /**
 * Interface for tracking clients in the Quorum.
 */ export interface IQuorumClients extends IEventProvider < IQuorumClientsEvents > , IDisposable { getMembers ( ) : Map < string , ISequencedClient > ; getMember ( clientId ) : ISequencedClient | undefined ; } /**
 * Interface for tracking proposals in the Quorum.
 */ export interface IQuorumProposals extends IEventProvider < IQuorumProposalsEvents > , IDisposable { propose ( key , value ) : Promise < void > ; has ( key ) : boolean ; get ( key ) : any ; getApprovalData ( key ) : ICommittedProposal | undefined ; } /**
 * Interface combining tracking of clients as well as proposals in the Quorum.
 */ export interface IQuorum extends Omit < IQuorumClients , "on" | "once" | "off" > , Omit < IQuorumProposals , "on" | "once" | "off" > , IEventProvider < IQuorumEvents > { } export interface IProtocolState { sequenceNumber : number ; minimumSequenceNumber : number ; members : [ string , ISequencedClient ] [ ] ; proposals : [ number , ISequencedProposal , string [ ] ] [ ] ; values : [ string , ICommittedProposal ] [ ] ; } export interface IProcessMessageResult { immediateNoOp ? : boolean ; }