pt.unl.fct.di.novasys.babel.crdts.state.generic

Class StateBasedCRDT

  • All Implemented Interfaces:
    GenericCRDT, StateCRDT
    Direct Known Subclasses:
    StatePNCounter


    public abstract class StateBasedCRDT
    extends CRDT
    implements StateCRDT
    An abstract class that implements the generic state-based CRDT interface. It stores the CRDT state as an object with the replica ID and a version vector. The class should be realized by one of the concrete implementations materialized in the implementations package.
    • Field Detail

      • state

        protected VVState state
        State of the replica. Stores the replica identifier and its causal context.
    • Constructor Detail

      • StateBasedCRDT

        public StateBasedCRDT(CRDTsTypes type,
                              VVState state)
        Creates an abstract state-based CRDT type, with a previously created state.
        Parameters:
        type - the type of the CRDT
        state - the state of the replica
      • StateBasedCRDT

        public StateBasedCRDT(CRDTsTypes type,
                              ReplicaID replicaID)
        Creates an abstract state-based CRDT type. It creates a new replica state.
        Parameters:
        type - type of the CRDT
        replicaID - replica identifier.
    • Method Detail

      • getReplicaState

        public VVState getReplicaState()
        Description copied from interface: StateCRDT
        Gets the replica state. At the moment this state stores the replica identifier and a version vector to handle causal context.
        Specified by:
        getReplicaState in interface StateCRDT
        Returns:
        the replica state
      • getReplicaID

        public ReplicaID getReplicaID()
        Description copied from interface: StateCRDT
        Gets the replica identifier
        Specified by:
        getReplicaID in interface StateCRDT
        Returns:
        the replica identifier.

Copyright © 2024. All rights reserved.