pt.unl.fct.di.novasys.babel.crdts.operation.utils

Class Operation

  • Direct Known Subclasses:
    CounterOperation


    public abstract class Operation
    extends Object
    A generic representation of an operation that is issued (and executed) in operation-based CRDTs. The operation stores its operation type (mapped to an OperationType enumerator instance), the CRDT identifier and its type.
    • Constructor Detail

      • Operation

        public Operation(OperationType opType,
                         String crdtId,
                         CRDTsTypes crdtType)
        Creates a generic operation
        Parameters:
        opType - operation type as an OperationType
        crdtId - the CRDT identifier
        crdtType - the CRDT type as a CRDTsTypes
    • Method Detail

      • getOpType

        public OperationType getOpType()
        Get the operation type
        Returns:
        the operation type
      • getCrdtId

        public String getCrdtId()
        Get the CRDT identifier
        Returns:
        the CRDT identifier
      • getCrdtType

        public CRDTsTypes getCrdtType()
        Gets the CRDT type
        Returns:
        the CRDT type
      • serialize

        public static void serialize(Operation op,
                                     io.netty.buffer.ByteBuf out)
                              throws IOException
        Static method that serializes the operation generic information into a ByteBuf. The information is serialized by the following order: operation type, CRDT identifier and CRDT type.
        Parameters:
        op - operation to be serialized
        out - ByteBuf where the operation is serialized
        Throws:
        IOException - if there is an error parsing the object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object

Copyright © 2024. All rights reserved.