/// <summary> /// Copy constructor. /// </summary> public Policy(Policy other) { this.priority = other.priority; this.readModeAP = other.readModeAP; this.readModeSC = other.readModeSC; this.replica = other.replica; this.socketTimeout = other.socketTimeout; this.totalTimeout = other.totalTimeout; this.maxRetries = other.maxRetries; this.sleepBetweenRetries = other.sleepBetweenRetries; this.sendKey = other.sendKey; }
/// <summary> /// Copy constructor. /// </summary> public Policy(Policy other) { this.priority = other.priority; this.readModeAP = other.readModeAP; this.readModeSC = other.readModeSC; this.replica = other.replica; this.predExp = other.predExp; this.socketTimeout = other.socketTimeout; this.totalTimeout = other.totalTimeout; this.maxRetries = other.maxRetries; this.sleepBetweenRetries = other.sleepBetweenRetries; this.sendKey = other.sendKey; this.compress = other.compress; this.failOnFilteredOut = other.failOnFilteredOut; }
private Arguments ParseArguments() { Arguments args; if (currentExample.IsBenchmark()) { BenchmarkArguments bargs = new BenchmarkArguments(); bargs.sync = syncButton.Checked; if (bargs.sync) { bargs.threadMax = int.Parse(syncThreadBox.Text); } else { bargs.threadMax = int.Parse(asyncThreadBox.Text); } bargs.commandMax = int.Parse(maxCommandBox.Text); bargs.records = int.Parse(recordsBox.Text); if (batchReadBox.Checked) { bargs.batchSize = int.Parse(batchSizeBox.Text); } bargs.binType = (BinType)binTypeBox.SelectedItem; bargs.binSize = int.Parse(binSizeBox.Text); bargs.readPct = int.Parse(readBox.Text); int writePct = int.Parse(writeBox.Text); if (!(bargs.readPct >= 0 && bargs.readPct <= 100 && writePct >= 0 && writePct <= 100 && bargs.readPct + writePct == 100)) { throw new Exception("Read + Write percentage must equal 100"); } int recordsInitPct = int.Parse(initPctBox.Text); bargs.recordsInit = bargs.records / 100 * recordsInitPct; if (fixedValueButton.Checked) { bargs.SetFixedValue(); } int timeout = int.Parse(timeoutBox.Text); int maxRetries = int.Parse(maxRetriesBox.Text); int sleepBetweenRetries = int.Parse(sleepBox.Text); Replica replica = (Replica)replicaBox.SelectedItem; ReadModeAP readModeAP = (ReadModeAP)readModeAPBox.SelectedItem; ReadModeSC readModeSC = (ReadModeSC)readModeSCBox.SelectedItem; bargs.policy.totalTimeout = timeout; bargs.policy.maxRetries = maxRetries; bargs.policy.sleepBetweenRetries = sleepBetweenRetries; bargs.policy.replica = replica; bargs.policy.readModeAP = readModeAP; bargs.policy.readModeSC = readModeSC; bargs.writePolicy.totalTimeout = timeout; bargs.writePolicy.maxRetries = maxRetries; bargs.writePolicy.sleepBetweenRetries = sleepBetweenRetries; bargs.writePolicy.replica = replica; bargs.batchPolicy.totalTimeout = timeout; bargs.batchPolicy.maxRetries = maxRetries; bargs.batchPolicy.sleepBetweenRetries = sleepBetweenRetries; bargs.batchPolicy.replica = replica; bargs.batchPolicy.readModeAP = readModeAP; bargs.batchPolicy.readModeSC = readModeSC; bargs.debug = debugBox.Checked; if (limitTpsBox.Checked) { bargs.throughput = int.Parse(throughputBox.Text); } bargs.latency = latencyBox.Checked; bargs.altLatencyFormat = latencyAltFormatBox.Checked; if (latencyBox.Checked) { bargs.latencyColumns = int.Parse(latencyColumnsBox.Text); bargs.latencyShift = int.Parse(latencyShiftBox.Text); if (!(bargs.latencyColumns >= 2 && bargs.latencyColumns <= 10)) { throw new Exception("Latency columns must be between 2 and 10 inclusive."); } if (!(bargs.latencyShift >= 1 && bargs.latencyShift <= 5)) { throw new Exception("Latency exponent shift must be between 1 and 5 inclusive."); } } args = bargs; } else { args = new Arguments(); args.commandMax = 40; } args.port = int.Parse(portBox.Text); args.hosts = Host.ParseHosts(hostBox.Text.Trim(), tlsName, args.port); args.user = userBox.Text.Trim(); args.password = passwordBox.Text; args.clusterName = clusterName; args.ns = nsBox.Text.Trim(); args.set = setBox.Text.Trim(); args.tlsPolicy = tlsPolicy; args.authMode = authMode; return(args); }