Skip to content
  • Iustin Pop's avatar
    8ee2994a
    Switch opcode data type from normal to record constructors · 8ee2994a
    Iustin Pop authored
    
    
    Currently, the OpCode definitions are using normal constructors:
    
      data OpCode = OpTestDelay Double Bool [String]
                  | OpInstanceFailover String Bool (Maybe String)
                  …
    
    While this works for a few opcodes, it becomes unwieldy when dealing
    with a bigger number of opcode definitions and/or with opcodes having
    many fields.
    
    This patch changes the opcodes to record-based constructors, so that
    we get for free accessor functions:
    
      data OpCode
        = OpTestDelay {
            opDuration :: Double,
            opOnMaster :: Bool,
            opOnNodes :: [String]
          }
          | OpInstanceFailover {
             opInstanceName :: String,
             opIgnoreConsistency :: Bool,
             opTargetNode :: Maybe String
          }
          …
    
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarAdeodato Simo <dato@google.com>
    8ee2994a
    Switch opcode data type from normal to record constructors
    Iustin Pop authored
    
    
    Currently, the OpCode definitions are using normal constructors:
    
      data OpCode = OpTestDelay Double Bool [String]
                  | OpInstanceFailover String Bool (Maybe String)
                  …
    
    While this works for a few opcodes, it becomes unwieldy when dealing
    with a bigger number of opcode definitions and/or with opcodes having
    many fields.
    
    This patch changes the opcodes to record-based constructors, so that
    we get for free accessor functions:
    
      data OpCode
        = OpTestDelay {
            opDuration :: Double,
            opOnMaster :: Bool,
            opOnNodes :: [String]
          }
          | OpInstanceFailover {
             opInstanceName :: String,
             opIgnoreConsistency :: Bool,
             opTargetNode :: Maybe String
          }
          …
    
    Signed-off-by: default avatarIustin Pop <iustin@google.com>
    Reviewed-by: default avatarAdeodato Simo <dato@google.com>
Loading