Failure reasons

This commit is contained in:
ameba23
2021-04-15 21:24:22 +02:00
parent fec74ed343
commit 79369f4e7a
2 changed files with 23 additions and 1 deletions

View File

@@ -5,7 +5,7 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
@NotNullByDefault
public interface CustodianTask {
void start(Observer observer);
void start(Observer observer, byte[] payload);
void cancel();

View File

@@ -39,9 +39,31 @@ public interface SecretOwnerTask {
}
public static class Success extends State {
private final byte[] remotePayload;
public Success(byte[] remotePayload) { this.remotePayload = remotePayload; }
public byte[] getRemotePayload() { return remotePayload; }
}
public static class Failure extends State {
public enum Reason {
CANCELLED,
SECURITY,
NO_CONNECTION,
OTHER
}
private final Reason reason;
public Failure(Reason reason) {
this.reason = reason;
}
public Reason getReason() {
return reason;
}
}
}
}