@mark1russell7/harness 0.12.3 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -1233,8 +1233,9 @@ export declare const memberConfig: (group: Group, primary: string | null) => str
1233
1233
  export declare const sentinelConfig: (group: Group, primary: string) => string;
1234
1234
  /**
1235
1235
  * This function gives the peers that a fault on a part cuts it from, by their addresses. `all` is
1236
- * each other part and the client, `group` is the other parts, and `clients` is the client. The
1237
- * observer is not a peer, thus the timeline of the group stays whole.
1236
+ * each other part and the client, `group` is the other parts, and `clients` is the client. `one`
1237
+ * and `one-way` are the first other member. The observer is not a peer, thus the timeline of the
1238
+ * group stays whole.
1238
1239
  */
1239
1240
  export declare const peersOf: (parts: {
1240
1241
  readonly members: Readonly<Record<string, RunPart>>;
package/build/index.js CHANGED
@@ -3048,15 +3048,19 @@ const sentinelConfig = (group, primary) => [
3048
3048
  ].join("\n");
3049
3049
  /**
3050
3050
  * This function gives the peers that a fault on a part cuts it from, by their addresses. `all` is
3051
- * each other part and the client, `group` is the other parts, and `clients` is the client. The
3052
- * observer is not a peer, thus the timeline of the group stays whole.
3051
+ * each other part and the client, `group` is the other parts, and `clients` is the client. `one`
3052
+ * and `one-way` are the first other member. The observer is not a peer, thus the timeline of the
3053
+ * group stays whole.
3053
3054
  */
3054
3055
  const peersOf = (parts, client, part, cuts) => {
3055
3056
  const others = [...Object.entries(parts.members), ...Object.entries(parts.sentinels)].filter(([name]) => name !== part).map(([, at]) => at.ip);
3056
3057
  if (cuts === "clients") return [client];
3057
3058
  if (cuts === "group") return others;
3059
+ if (cuts === "one" || cuts === "one-way") return Object.entries(parts.members).filter(([name]) => name !== part).slice(0, 1).map(([, at]) => at.ip);
3058
3060
  return [...others, client];
3059
3061
  };
3062
+ /** This function gives the direction of the rules of a cut: `one-way` drops only the segments from the part. */
3063
+ const directionOf = (cuts) => cuts === "one-way" ? ["--direction", "out"] : [];
3060
3064
  /** This function reads the flat reply of a command line client into its fields: name, value, name, value. */
3061
3065
  const fieldsOf = (text) => {
3062
3066
  const out = [];
@@ -3391,6 +3395,7 @@ const openGroupLab = async (group, options = {}) => {
3391
3395
  "/opt/harness/inject",
3392
3396
  kind,
3393
3397
  peers,
3398
+ ...directionOf(cuts),
3394
3399
  ...after(at)
3395
3400
  ]);
3396
3401
  },
@@ -3400,6 +3405,7 @@ const openGroupLab = async (group, options = {}) => {
3400
3405
  "/opt/harness/inject",
3401
3406
  kind === "rst" ? "clear-rst" : "clear",
3402
3407
  peers,
3408
+ ...directionOf(cuts),
3403
3409
  ...after(at)
3404
3410
  ]);
3405
3411
  },