Skip to content
Snippets Groups Projects
Commit 8ee2994a authored by Iustin Pop's avatar Iustin Pop
Browse files

Switch opcode data type from normal to record constructors


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>
parent 51d991d7
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment